/* * Copyright (c) Facebook, Inc. and its affiliates. * * This software may be used and distributed according to the terms of the * GNU General Public License version 2. */ #pragma once #include #include #include "eden/fs/store/ImportPriority.h" #include "eden/fs/store/ObjectFetchContext.h" namespace folly { template class Future; } namespace facebook { namespace eden { class Blob; class Hash; class Tree; /** * Abstract interface for a BackingStore. * * A BackingStore fetches tree and blob information from an external * authoritative data source. * * BackingStore implementations must be thread-safe, and perform their own * internal locking. */ class BackingStore { public: BackingStore() {} virtual ~BackingStore() {} virtual folly::SemiFuture> getTree( const Hash& id, ObjectFetchContext& context, ImportPriority priority = ImportPriority::kNormal()) = 0; virtual folly::SemiFuture> getBlob( const Hash& id, ObjectFetchContext& context, ImportPriority priority = ImportPriority::kNormal()) = 0; virtual folly::SemiFuture> getTreeForCommit( const Hash& commitID) = 0; virtual folly::SemiFuture> getTreeForManifest( const Hash& commitID, const Hash& manifestID) = 0; FOLLY_NODISCARD virtual folly::SemiFuture prefetchBlobs( const std::vector& /*ids*/) { return folly::unit; } virtual void periodicManagementTask() {} private: // Forbidden copy constructor and assignment operator BackingStore(BackingStore const&) = delete; BackingStore& operator=(BackingStore const&) = delete; }; } // namespace eden } // namespace facebook