-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathhf3fs_backend.h
More file actions
44 lines (34 loc) · 1.53 KB
/
hf3fs_backend.h
File metadata and controls
44 lines (34 loc) · 1.53 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
42
43
44
#pragma once
#include <filesystem>
#include <memory>
#include "kv_cache_manager/data_storage/data_storage_backend.h"
namespace kv_cache_manager {
class MetricsRegistry;
class Hf3fsBackend : public DataStorageBackend {
public:
Hf3fsBackend() = delete;
explicit Hf3fsBackend(std::shared_ptr<MetricsRegistry> metrics_registry);
~Hf3fsBackend() override = default;
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:
bool DoInit();
bool TouchFile(const std::string &file_path);
private:
ThreeFSStorageSpec spec_;
std::filesystem::path base_path_;
};
} // namespace kv_cache_manager