sapling/eden/fs/store/SqliteLocalStore.h
Adam Simpkins 59ff8f90b5 remove the config parameter from LocalStore
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
2019-05-15 12:19:20 -07:00

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