#pragma once #include #include #include namespace DB { class MetadataStorageFromPlainRewritableObjectStorage final : public MetadataStorageFromPlainObjectStorage { private: const std::string metadata_key_prefix; std::shared_ptr path_map; public: MetadataStorageFromPlainRewritableObjectStorage( ObjectStoragePtr object_storage_, String storage_path_prefix_, size_t object_metadata_cache_size); ~MetadataStorageFromPlainRewritableObjectStorage() override; MetadataStorageType getType() const override { return MetadataStorageType::PlainRewritable; } bool existsFile(const std::string & path) const override; bool existsDirectory(const std::string & path) const override; bool existsFileOrDirectory(const std::string & path) const override; std::vector listDirectory(const std::string & path) const override; std::optional getLastModifiedIfExists(const String & path) const override; protected: std::string getMetadataKeyPrefix() const override { return metadata_key_prefix; } std::shared_ptr getPathMap() const override { return path_map; } std::unordered_set getDirectChildrenOnDisk(const std::filesystem::path & local_path) const; private: bool useSeparateLayoutForMetadata() const; }; }