From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/crimson/os/seastore/seastore.h | 181 +++++++++++++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 src/crimson/os/seastore/seastore.h (limited to 'src/crimson/os/seastore/seastore.h') diff --git a/src/crimson/os/seastore/seastore.h b/src/crimson/os/seastore/seastore.h new file mode 100644 index 000000000..798442c34 --- /dev/null +++ b/src/crimson/os/seastore/seastore.h @@ -0,0 +1,181 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#pragma once + +#include +#include +#include +#include +#include + +#include +#include + +#include "osd/osd_types.h" +#include "include/uuid.h" + +#include "os/Transaction.h" +#include "crimson/os/seastore/segment_cleaner.h" +#include "crimson/os/futurized_store.h" +#include "transaction.h" + +namespace crimson::os::seastore { + +class SeastoreCollection; +class SegmentManager; +class OnodeManager; +class Onode; +using OnodeRef = boost::intrusive_ptr; +class Journal; +class LBAManager; +class TransactionManager; +class Cache; + +class SeaStore final : public FuturizedStore { + uuid_d osd_fsid; + +public: + + SeaStore(const std::string& path); + ~SeaStore() final; + + seastar::future<> stop() final; + seastar::future<> mount() final; + seastar::future<> umount() final; + + seastar::future<> mkfs(uuid_d new_osd_fsid) final; + seastar::future stat() const final; + + read_errorator::future read( + CollectionRef c, + const ghobject_t& oid, + uint64_t offset, + size_t len, + uint32_t op_flags = 0) final; + read_errorator::future readv( + CollectionRef c, + const ghobject_t& oid, + interval_set& m, + uint32_t op_flags = 0) final; + get_attr_errorator::future get_attr( + CollectionRef c, + const ghobject_t& oid, + std::string_view name) const final; + get_attrs_ertr::future get_attrs( + CollectionRef c, + const ghobject_t& oid) final; + + seastar::future stat( + CollectionRef c, + const ghobject_t& oid) final; + + read_errorator::future omap_get_values( + CollectionRef c, + const ghobject_t& oid, + const omap_keys_t& keys) final; + + /// Retrieves paged set of values > start (if present) + read_errorator::future> omap_get_values( + CollectionRef c, ///< [in] collection + const ghobject_t &oid, ///< [in] oid + const std::optional &start ///< [in] start, empty for begin + ) final; ///< @return values.empty() iff done + + read_errorator::future omap_get_header( + CollectionRef c, + const ghobject_t& oid) final; + + seastar::future, ghobject_t>> list_objects( + CollectionRef c, + const ghobject_t& start, + const ghobject_t& end, + uint64_t limit) const final; + + seastar::future create_new_collection(const coll_t& cid) final; + seastar::future open_collection(const coll_t& cid) final; + seastar::future> list_collections() final; + + seastar::future<> do_transaction( + CollectionRef ch, + ceph::os::Transaction&& txn) final; + + seastar::future get_omap_iterator( + CollectionRef ch, + const ghobject_t& oid) final; + seastar::future> fiemap( + CollectionRef ch, + const ghobject_t& oid, + uint64_t off, + uint64_t len) final; + + seastar::future<> write_meta(const std::string& key, + const std::string& value) final; + seastar::future> read_meta(const std::string& key) final; + uuid_d get_fsid() const final; + + unsigned get_max_attr_name_length() const final { + return 256; + } + +private: + std::unique_ptr segment_manager; + std::unique_ptr segment_cleaner; + std::unique_ptr cache; + std::unique_ptr journal; + std::unique_ptr lba_manager; + std::unique_ptr transaction_manager; + std::unique_ptr onode_manager; + + + using write_ertr = crimson::errorator< + crimson::ct_error::input_output_error>; + write_ertr::future<> _do_transaction_step( + TransactionRef &trans, + CollectionRef &col, + std::vector &onodes, + ceph::os::Transaction::iterator &i); + + write_ertr::future<> _remove( + TransactionRef &trans, + OnodeRef &onode); + write_ertr::future<> _touch( + TransactionRef &trans, + OnodeRef &onode); + write_ertr::future<> _write( + TransactionRef &trans, + OnodeRef &onode, + uint64_t offset, size_t len, const ceph::bufferlist& bl, + uint32_t fadvise_flags); + write_ertr::future<> _omap_set_values( + TransactionRef &trans, + OnodeRef &onode, + std::map &&aset); + write_ertr::future<> _omap_set_header( + TransactionRef &trans, + OnodeRef &onode, + const ceph::bufferlist &header); + write_ertr::future<> _omap_rmkeys( + TransactionRef &trans, + OnodeRef &onode, + const omap_keys_t& aset); + write_ertr::future<> _omap_rmkeyrange( + TransactionRef &trans, + OnodeRef &onode, + const std::string &first, + const std::string &last); + write_ertr::future<> _truncate( + TransactionRef &trans, + OnodeRef &onode, uint64_t size); + write_ertr::future<> _setattrs( + TransactionRef &trans, + OnodeRef &onode, + std::map& aset); + write_ertr::future<> _create_collection( + TransactionRef &trans, + const coll_t& cid, int bits); + + boost::intrusive_ptr _get_collection(const coll_t& cid); +}; + +} -- cgit v1.2.3