mirror of
https://github.com/facebook/sapling.git
synced 2024-10-05 14:28:17 +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
45 lines
1.3 KiB
C++
45 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2018-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 <folly/Synchronized.h>
|
|
#include "eden/fs/sqlite/Sqlite.h"
|
|
#include "eden/fs/store/LocalStore.h"
|
|
|
|
namespace facebook {
|
|
namespace eden {
|
|
|
|
/** An implementation of LocalStore that stores values in Sqlite.
|
|
* SqliteLocalStore is thread safe, allowing reads and writes from
|
|
* any thread.
|
|
* */
|
|
class SqliteLocalStore : public LocalStore {
|
|
public:
|
|
explicit SqliteLocalStore(AbsolutePathPiece pathToDb);
|
|
void close() override;
|
|
void clearKeySpace(KeySpace keySpace) override;
|
|
void compactKeySpace(KeySpace keySpace) override;
|
|
StoreResult get(LocalStore::KeySpace keySpace, folly::ByteRange key)
|
|
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<LocalStore::WriteBatch> beginWrite(
|
|
size_t bufSize = 0) override;
|
|
|
|
private:
|
|
mutable SqliteDatabase db_;
|
|
};
|
|
|
|
} // namespace eden
|
|
} // namespace facebook
|