mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 15:57:43 +03:00
d9be0757b8
Summary: Add the basic BackingStore interface, plus a NullBackingStore implementation that always returns null. This updates the ObjectStore to query the BackingStore if data is not found in the LocalStore. Additionally, this updates EdenServer to manage the BackingStore objects. It maintains a map of the BackingStore objects created for each known repository. Reviewed By: bolinfest Differential Revision: D3409602 fbshipit-source-id: 2920dc4c24ee1ec37efb542f058d0d121ceb5532
45 lines
1.0 KiB
C++
45 lines
1.0 KiB
C++
/*
|
|
* Copyright (c) 2016, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
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 std::unique_ptr<Tree> getTree(const Hash& id) = 0;
|
|
virtual std::unique_ptr<Blob> getBlob(const Hash& id) = 0;
|
|
|
|
private:
|
|
// Forbidden copy constructor and assignment operator
|
|
BackingStore(BackingStore const&) = delete;
|
|
BackingStore& operator=(BackingStore const&) = delete;
|
|
};
|
|
}
|
|
} // facebook::eden
|