2#include "barretenberg/common/streams.hpp"
3#include "hash_path.hpp"
20 bool put(std::vector<uint8_t>
const& key, std::vector<uint8_t>
const& value)
22 auto key_str = to_string(key);
23 return put(key_str, value);
26 bool put(std::string
const& key, std::vector<uint8_t>
const& value)
28 puts_[key] = to_string(value);
33 bool del(std::vector<uint8_t>
const& key)
35 auto key_str = to_string(key);
37 deletes_.insert(key_str);
41 bool get(std::vector<uint8_t>
const& key, std::vector<uint8_t>& value) {
return get(to_string(key), value); }
43 bool get(std::string
const& key, std::vector<uint8_t>& value)
45 if (deletes_.find(key) != deletes_.end()) {
48 auto it = puts_.find(key);
49 if (it != puts_.end()) {
50 value = std::vector<uint8_t>(it->second.begin(), it->second.end());
54 auto it = store_.find(key);
55 if (it != store_.end()) {
56 value = { it->second.begin(), it->second.end() };
65 for (
auto it : puts_) {
68 for (
auto key : deletes_) {
82 std::string to_string(std::vector<uint8_t>
const& input) {
return std::string((
char*)input.data(), input.size()); }
84 std::map<std::string, std::string> store_;
85 std::map<std::string, std::string> puts_;
86 std::set<std::string> deletes_;
Definition: memory_store.hpp:11
Definition: widget.bench.cpp:13