mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
59ff8f90b5
Summary: The `LocalStore` constructor was updated to accept a `ReloadableConfig` argument in D12949577, but this was never used anywhere. Remove it for now to help simplify the code. If we do want to add it back in the future I think we should make it required, rather than allowing a null config to be specified. Reviewed By: wez Differential Revision: D15350217 fbshipit-source-id: 8571b48dff8c8d079ba6b25821dd0b1d77ffe791
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
/*
|
|
* Copyright (c) 2016-present, 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 "eden/fs/rocksdb/RocksHandles.h"
|
|
#include "eden/fs/store/LocalStore.h"
|
|
#include "eden/fs/utils/UnboundedQueueExecutor.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
class FaultInjector;
|
|
|
|
/** An implementation of LocalStore that uses RocksDB for the underlying
|
|
* storage.
|
|
*/
|
|
class RocksDbLocalStore : public LocalStore {
|
|
public:
|
|
/**
|
|
* The given FaultInjector must be valid during the lifetime of this
|
|
* RocksDbLocalStore object.
|
|
*/
|
|
explicit RocksDbLocalStore(AbsolutePathPiece pathToRocksDb, FaultInjector*);
|
|
~RocksDbLocalStore();
|
|
void close() override;
|
|
void clearKeySpace(KeySpace keySpace) override;
|
|
void compactKeySpace(KeySpace keySpace) override;
|
|
StoreResult get(LocalStore::KeySpace keySpace, folly::ByteRange key)
|
|
const override;
|
|
FOLLY_NODISCARD folly::Future<StoreResult> getFuture(
|
|
KeySpace keySpace,
|
|
folly::ByteRange key) const override;
|
|
FOLLY_NODISCARD folly::Future<std::vector<StoreResult>> getBatch(
|
|
KeySpace keySpace,
|
|
const std::vector<folly::ByteRange>& keys) const override;
|
|
bool hasKey(LocalStore::KeySpace keySpace, folly::ByteRange key)
|
|
const override;
|
|
void put(
|
|
LocalStore::KeySpace keySpace,
|
|
folly::ByteRange key,
|
|
folly::ByteRange value) override;
|
|
std::unique_ptr<WriteBatch> beginWrite(size_t bufSize = 0) override;
|
|
|
|
// Call RocksDB's RepairDB() function on the DB at the specified location
|
|
static void repairDB(AbsolutePathPiece path);
|
|
|
|
// Get the approximate number of bytes stored on disk for the
|
|
// specified key space.
|
|
uint64_t getApproximateSize(KeySpace keySpace) const;
|
|
|
|
private:
|
|
FaultInjector& faultInjector_;
|
|
RocksHandles dbHandles_;
|
|
mutable UnboundedQueueExecutor ioPool_;
|
|
};
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|