mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
fae4229ff2
Summary: Add the beginnings of an eden gc command. Today it's equivalent to `eden debug clear_local_caches` followed by `eden debug_compact_local_storage`, except that it compacts each column as they're cleared to minimize peak disk consumption. Eventually, it will also unload in-memory inodes, flush data from the overlay, and clear the kernel's VFS cache too. Reviewed By: wez Differential Revision: D9138305 fbshipit-source-id: b303a63f601014cf38ca94c9e6f7c04394159ea8
51 lines
1.6 KiB
C++
51 lines
1.6 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 {
|
|
|
|
/** An implementation of LocalStore that uses RocksDB for the underlying
|
|
* storage.
|
|
*/
|
|
class RocksDbLocalStore : public LocalStore {
|
|
public:
|
|
explicit RocksDbLocalStore(AbsolutePathPiece pathToRocksDb);
|
|
~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;
|
|
|
|
private:
|
|
RocksHandles dbHandles_;
|
|
mutable UnboundedQueueExecutor ioPool_;
|
|
};
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|