]>
git.proxmox.com Git - ceph.git/blob - ceph/src/crimson/os/futurized_store.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
7 #include <unordered_map>
12 #include <seastar/core/future.hh>
14 #include "crimson/osd/exceptions.h"
15 #include "include/buffer_fwd.h"
16 #include "include/uuid.h"
17 #include "osd/osd_types.h"
23 namespace crimson::os
{
24 class FuturizedCollection
;
26 class FuturizedStore
{
29 static std::unique_ptr
<FuturizedStore
> create(const std::string
& type
,
30 const std::string
& data
,
31 const ConfigValues
& values
);
32 FuturizedStore() = default;
33 virtual ~FuturizedStore() = default;
36 explicit FuturizedStore(const FuturizedStore
& o
) = delete;
37 const FuturizedStore
& operator=(const FuturizedStore
& o
) = delete;
39 virtual seastar::future
<> start() {
40 return seastar::now();
42 virtual seastar::future
<> stop() = 0;
43 virtual seastar::future
<> mount() = 0;
44 virtual seastar::future
<> umount() = 0;
46 virtual seastar::future
<> mkfs(uuid_d new_osd_fsid
) = 0;
47 virtual seastar::future
<store_statfs_t
> stat() const = 0;
49 using CollectionRef
= boost::intrusive_ptr
<FuturizedCollection
>;
50 using read_errorator
= crimson::errorator
<crimson::ct_error::enoent
,
51 crimson::ct_error::input_output_error
>;
52 virtual read_errorator::future
<ceph::bufferlist
> read(
54 const ghobject_t
& oid
,
57 uint32_t op_flags
= 0) = 0;
59 using get_attr_errorator
= crimson::errorator
<
60 crimson::ct_error::enoent
,
61 crimson::ct_error::enodata
>;
62 virtual get_attr_errorator::future
<ceph::bufferptr
> get_attr(
64 const ghobject_t
& oid
,
65 std::string_view name
) const = 0;
67 using get_attrs_ertr
= crimson::errorator
<
68 crimson::ct_error::enoent
>;
69 using attrs_t
= std::map
<std::string
, ceph::bufferptr
, std::less
<>>;
70 virtual get_attrs_ertr::future
<attrs_t
> get_attrs(
72 const ghobject_t
& oid
) = 0;
74 using omap_values_t
= std::map
<std::string
, bufferlist
, std::less
<>>;
75 using omap_keys_t
= std::set
<std::string
>;
76 virtual seastar::future
<omap_values_t
> omap_get_values(
78 const ghobject_t
& oid
,
79 const omap_keys_t
& keys
) = 0;
80 virtual seastar::future
<std::vector
<ghobject_t
>, ghobject_t
> list_objects(
82 const ghobject_t
& start
,
83 const ghobject_t
& end
,
84 uint64_t limit
) const = 0;
85 virtual seastar::future
<bool, omap_values_t
> omap_get_values(
86 CollectionRef c
, ///< [in] collection
87 const ghobject_t
&oid
, ///< [in] oid
88 const std::optional
<std::string
> &start
///< [in] start, empty for begin
89 ) = 0; ///< @return <done, values> values.empty() iff done
91 virtual seastar::future
<CollectionRef
> create_new_collection(const coll_t
& cid
) = 0;
92 virtual seastar::future
<CollectionRef
> open_collection(const coll_t
& cid
) = 0;
93 virtual seastar::future
<std::vector
<coll_t
>> list_collections() = 0;
95 virtual seastar::future
<> do_transaction(CollectionRef ch
,
96 ceph::os::Transaction
&& txn
) = 0;
98 virtual seastar::future
<> write_meta(const std::string
& key
,
99 const std::string
& value
) = 0;
100 virtual seastar::future
<int, std::string
> read_meta(const std::string
& key
) = 0;
101 virtual uuid_d
get_fsid() const = 0;
102 virtual unsigned get_max_attr_name_length() const = 0;