summaryrefslogtreecommitdiffstats
path: root/src/crimson/os/cyan_store.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 18:24:20 +0000
commit483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch)
treee5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/crimson/os/cyan_store.h
parentInitial commit. (diff)
downloadceph-upstream.tar.xz
ceph-upstream.zip
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/crimson/os/cyan_store.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/crimson/os/cyan_store.h b/src/crimson/os/cyan_store.h
new file mode 100644
index 00000000..0b7f3d87
--- /dev/null
+++ b/src/crimson/os/cyan_store.h
@@ -0,0 +1,63 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <string>
+#include <unordered_map>
+#include <map>
+#include <vector>
+#include <seastar/core/future.hh>
+#include "osd/osd_types.h"
+#include "include/uuid.h"
+
+namespace ceph::os {
+
+class Collection;
+class Transaction;
+
+// a just-enough store for reading/writing the superblock
+class CyanStore {
+ using CollectionRef = boost::intrusive_ptr<Collection>;
+ const std::string path;
+ std::unordered_map<coll_t, CollectionRef> coll_map;
+ std::map<coll_t,CollectionRef> new_coll_map;
+ uint64_t used_bytes = 0;
+
+public:
+ CyanStore(const std::string& path);
+ ~CyanStore();
+
+ seastar::future<> mount();
+ seastar::future<> umount();
+
+ seastar::future<> mkfs(uuid_d osd_fsid);
+ seastar::future<bufferlist> read(CollectionRef c,
+ const ghobject_t& oid,
+ uint64_t offset,
+ size_t len,
+ uint32_t op_flags = 0);
+ using omap_values_t = std::map<std::string,bufferlist, std::less<>>;
+ seastar::future<omap_values_t> omap_get_values(
+ CollectionRef c,
+ const ghobject_t& oid,
+ std::vector<std::string>&& keys);
+ CollectionRef create_new_collection(const coll_t& cid);
+ CollectionRef open_collection(const coll_t& cid);
+ std::vector<coll_t> list_collections();
+
+ seastar::future<> do_transaction(CollectionRef ch,
+ Transaction&& txn);
+
+ void write_meta(const std::string& key,
+ const std::string& value);
+ int read_meta(const std::string& key, std::string* value);
+
+private:
+ int _write(const coll_t& cid, const ghobject_t& oid,
+ uint64_t offset, size_t len, const bufferlist& bl,
+ uint32_t fadvise_flags);
+ int _create_collection(const coll_t& cid, int bits);
+};
+
+}