1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
6 #include <seastar/core/future.hh>
7 #include <seastar/core/shared_mutex.hh>
9 #include "common/ceph_context.h"
10 #include "os/ObjectStore.h"
11 #include "osd/osd_types.h"
13 #include "crimson/os/futurized_collection.h"
14 #include "crimson/os/futurized_store.h"
15 #include "crimson/thread/ThreadPool.h"
21 namespace crimson::os
{
22 class AlienStore final
: public FuturizedStore
{
24 mutable std::unique_ptr
<crimson::thread::ThreadPool
> tp
;
25 AlienStore(const std::string
& path
, const ConfigValues
& values
);
28 seastar::future
<> start() final
;
29 seastar::future
<> stop() final
;
30 seastar::future
<> mount() final
;
31 seastar::future
<> umount() final
;
33 seastar::future
<> mkfs(uuid_d new_osd_fsid
) final
;
34 read_errorator::future
<ceph::bufferlist
> read(CollectionRef c
,
35 const ghobject_t
& oid
,
38 uint32_t op_flags
= 0) final
;
40 get_attr_errorator::future
<ceph::bufferptr
> get_attr(CollectionRef c
,
41 const ghobject_t
& oid
,
42 std::string_view name
) const final
;
43 get_attrs_ertr::future
<attrs_t
> get_attrs(CollectionRef c
,
44 const ghobject_t
& oid
) final
;
46 seastar::future
<omap_values_t
> omap_get_values(
48 const ghobject_t
& oid
,
49 const omap_keys_t
& keys
) final
;
51 seastar::future
<std::vector
<ghobject_t
>, ghobject_t
> list_objects(
53 const ghobject_t
& start
,
54 const ghobject_t
& end
,
55 uint64_t limit
) const final
;
57 /// Retrieves paged set of values > start (if present)
58 seastar::future
<bool, omap_values_t
> omap_get_values(
59 CollectionRef c
, ///< [in] collection
60 const ghobject_t
&oid
, ///< [in] oid
61 const std::optional
<std::string
> &start
///< [in] start, empty for begin
62 ) final
; ///< @return <done, values> values.empty() iff done
64 seastar::future
<CollectionRef
> create_new_collection(const coll_t
& cid
) final
;
65 seastar::future
<CollectionRef
> open_collection(const coll_t
& cid
) final
;
66 seastar::future
<std::vector
<coll_t
>> list_collections() final
;
68 seastar::future
<> do_transaction(CollectionRef c
,
69 ceph::os::Transaction
&& txn
) final
;
71 seastar::future
<> write_meta(const std::string
& key
,
72 const std::string
& value
) final
;
73 seastar::future
<int, std::string
> read_meta(const std::string
& key
) final
;
74 uuid_d
get_fsid() const final
;
75 seastar::future
<store_statfs_t
> stat() const final
;
76 unsigned get_max_attr_name_length() const final
;
79 constexpr static unsigned MAX_KEYS_PER_OMAP_GET_CALL
= 32;
80 const std::string path
;
81 uint64_t used_bytes
= 0;
83 std::unique_ptr
<ObjectStore
> store
;
84 std::unique_ptr
<CephContext
> cct
;
85 seastar::gate transaction_gate
;
86 std::unordered_map
<coll_t
, CollectionRef
> coll_map
;
87 seastar::shared_mutex tp_mutex
;