mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
071a3682fd
Summary: D18669664 Reviewed By: chadaustin Differential Revision: D18670157 fbshipit-source-id: 74c8c3e2fae16973079e5d3d3bc2fe18adf088a7
58 lines
1.4 KiB
C++
58 lines
1.4 KiB
C++
/*
|
|
* 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 <folly/futures/Future.h>
|
|
#include <memory>
|
|
|
|
namespace folly {
|
|
template <typename T>
|
|
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<std::unique_ptr<Tree>> getTree(const Hash& id) = 0;
|
|
virtual folly::SemiFuture<std::unique_ptr<Blob>> getBlob(const Hash& id) = 0;
|
|
virtual folly::SemiFuture<std::unique_ptr<Tree>> getTreeForCommit(
|
|
const Hash& commitID) = 0;
|
|
virtual folly::SemiFuture<std::unique_ptr<Tree>> getTreeForManifest(
|
|
const Hash& commitID,
|
|
const Hash& manifestID) = 0;
|
|
FOLLY_NODISCARD virtual folly::Future<folly::Unit> prefetchBlobs(
|
|
const std::vector<Hash>& /*ids*/) const {
|
|
return folly::unit;
|
|
}
|
|
|
|
private:
|
|
// Forbidden copy constructor and assignment operator
|
|
BackingStore(BackingStore const&) = delete;
|
|
BackingStore& operator=(BackingStore const&) = delete;
|
|
};
|
|
} // namespace eden
|
|
} // namespace facebook
|