-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathmooncake_backend.h
More file actions
41 lines (31 loc) · 1.47 KB
/
mooncake_backend.h
File metadata and controls
41 lines (31 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include <memory>
#include "3rdparty/mooncake/client_c.h"
#include "kv_cache_manager/data_storage/data_storage_backend.h"
namespace kv_cache_manager {
class MetricsRegistry;
class MooncakeBackend : public DataStorageBackend {
public:
MooncakeBackend() = delete;
explicit MooncakeBackend(std::shared_ptr<MetricsRegistry> metrics_registry);
~MooncakeBackend() override;
DataStorageType GetType() override;
bool Available() override;
double GetStorageUsageRatio(const std::string &trace_id) const override;
public:
ErrorCode DoOpen(const StorageConfig &storage_config, const std::string &trace_id) override;
ErrorCode Close() override;
std::vector<SpecCreateResult> Create(const CreateBlocksRequest &request,
const std::string &trace_id,
std::function<void()> cb) override;
std::vector<ErrorCode> Delete(const std::vector<DataStorageUri> &storage_uris,
const std::string &trace_id,
std::function<void()> cb) override;
std::vector<bool> Exist(const std::vector<DataStorageUri> &storage_uris) override;
std::vector<ErrorCode> Lock(const std::vector<DataStorageUri> &storage_uris) override;
std::vector<ErrorCode> UnLock(const std::vector<DataStorageUri> &storage_uris) override;
private:
client_t client_{nullptr};
MooncakeStorageSpec spec_;
};
} // namespace kv_cache_manager