| 971 | |
| 972 | template <typename Container> |
| 973 | KeyValueStoreMemory<Container>::KeyValueStoreMemory(IDiskQueue* log, |
| 974 | Reference<AsyncVar<ServerDBInfo> const> db, |
| 975 | UID id, |
| 976 | int64_t memoryLimit, |
| 977 | KeyValueStoreType storeType, |
| 978 | bool disableSnapshot, |
| 979 | bool replaceContent, |
| 980 | bool exactRecovery, |
| 981 | bool enableEncryption) |
| 982 | : type(storeType), id(id), log(log), db(db), committedWriteBytes(0), overheadWriteBytes(0), currentSnapshotEnd(-1), |
| 983 | previousSnapshotEnd(-1), committedDataSize(0), transactionSize(0), transactionIsLarge(false), resetSnapshot(false), |
| 984 | disableSnapshot(disableSnapshot), replaceContent(replaceContent), firstCommitWithSnapshot(true), snapshotCount(0), |
| 985 | memoryLimit(memoryLimit), enableEncryption(enableEncryption) { |
| 986 | // create reserved buffer for radixtree store type |
| 987 | this->reserved_buffer = |
| 988 | (storeType == KeyValueStoreType::MEMORY) ? nullptr : new uint8_t[CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT]; |
| 989 | if (this->reserved_buffer != nullptr) |
| 990 | memset(this->reserved_buffer, 0, CLIENT_KNOBS->SYSTEM_KEY_SIZE_LIMIT); |
| 991 | |
| 992 | recovering = recover(this, exactRecovery); |
| 993 | snapshotting = snapshot(this); |
| 994 | commitActors = actorCollection(addActor.getFuture()); |
| 995 | if (enableEncryption) { |
| 996 | refreshCipherKeysActor = refreshCipherKeys(this); |
| 997 | } |
| 998 | } |
| 999 | |
| 1000 | IKeyValueStore* keyValueStoreMemory(std::string const& basename, |
| 1001 | UID logID, |