This commit is contained in:
parent
08779b154b
commit
7919135f7f
|
@ -1,6 +1,6 @@
|
|||
add_library(dfly_core compact_object.cc dragonfly_core.cc extent_tree.cc
|
||||
external_alloc.cc interpreter.cc mi_memory_resource.cc
|
||||
segment_allocator.cc small_string.cc tx_queue.cc dense_set.cc string_set.cc)
|
||||
segment_allocator.cc small_string.cc tx_queue.cc dense_set.cc string_set.cc string_map.cc)
|
||||
cxx_link(dfly_core base absl::flat_hash_map absl::str_format redis_lib TRDP::lua lua_modules
|
||||
Boost::fiber crypto)
|
||||
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2022, DragonflyDB authors. All rights reserved.
|
||||
// See LICENSE for licensing terms.
|
||||
//
|
||||
|
||||
#include "core/string_map.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace dfly {
|
||||
|
||||
bool StringMap::AddOrSet(string_view field, string_view value, uint32_t ttl_sec) {
|
||||
|
||||
}
|
||||
|
||||
bool StringMap::Erase(string_view field) {
|
||||
}
|
||||
|
||||
bool StringMap::Contains(string_view field) const {
|
||||
}
|
||||
|
||||
void StringMap::Clear() {
|
||||
|
||||
}
|
||||
|
||||
} // namespace dfly
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright 2022, DragonflyDB authors. All rights reserved.
|
||||
// See LICENSE for licensing terms.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "core/dense_set.h"
|
||||
|
||||
extern "C" {
|
||||
#include "redis/sds.h"
|
||||
}
|
||||
|
||||
namespace dfly {
|
||||
|
||||
class StringMap : public DenseSet {
|
||||
public:
|
||||
StringMap(std::pmr::memory_resource* res = std::pmr::get_default_resource()) : DenseSet(res) {
|
||||
}
|
||||
|
||||
~StringMap() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool AddOrSet(std::string_view field, std::string_view value, uint32_t ttl_sec = UINT32_MAX);
|
||||
|
||||
bool Erase(std::string_view s1);
|
||||
|
||||
bool Contains(std::string_view s1) const;
|
||||
|
||||
void Clear();
|
||||
};
|
||||
|
||||
} // namespace dfly
|
|
@ -158,10 +158,6 @@ std::optional<std::string> StringSet::Pop() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
sds StringSet::PopRaw() {
|
||||
return (sds)PopInternal();
|
||||
}
|
||||
|
||||
uint32_t StringSet::Scan(uint32_t cursor, const std::function<void(const sds)>& func) const {
|
||||
return DenseSet::Scan(cursor, [func](const void* ptr) { func((sds)ptr); });
|
||||
}
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
// Copyright 2022, DragonflyDB authors. All rights reserved.
|
||||
// See LICENSE for licensing terms.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
@ -26,7 +30,6 @@ class StringSet : public DenseSet {
|
|||
void Clear();
|
||||
|
||||
std::optional<std::string> Pop();
|
||||
sds PopRaw();
|
||||
|
||||
~StringSet() {
|
||||
Clear();
|
||||
|
|
Loading…
Reference in New Issue