| 1 | //===----------------------------------------------------------------------===// |
|---|---|
| 2 | // DuckDB |
| 3 | // |
| 4 | // duckdb/storage/storage_extension.hpp |
| 5 | // |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | |
| 9 | #pragma once |
| 10 | |
| 11 | #include "duckdb/common/common.hpp" |
| 12 | #include "duckdb/common/enums/access_mode.hpp" |
| 13 | #include "duckdb/parser/tableref/table_function_ref.hpp" |
| 14 | |
| 15 | namespace duckdb { |
| 16 | class AttachedDatabase; |
| 17 | struct AttachInfo; |
| 18 | class Catalog; |
| 19 | class TransactionManager; |
| 20 | |
| 21 | //! The StorageExtensionInfo holds static information relevant to the storage extension |
| 22 | struct StorageExtensionInfo { |
| 23 | virtual ~StorageExtensionInfo() { |
| 24 | } |
| 25 | }; |
| 26 | |
| 27 | typedef unique_ptr<Catalog> (*attach_function_t)(StorageExtensionInfo *storage_info, AttachedDatabase &db, |
| 28 | const string &name, AttachInfo &info, AccessMode access_mode); |
| 29 | typedef unique_ptr<TransactionManager> (*create_transaction_manager_t)(StorageExtensionInfo *storage_info, |
| 30 | AttachedDatabase &db, Catalog &catalog); |
| 31 | |
| 32 | class StorageExtension { |
| 33 | public: |
| 34 | attach_function_t attach; |
| 35 | create_transaction_manager_t create_transaction_manager; |
| 36 | |
| 37 | //! Additional info passed to the various storage functions |
| 38 | shared_ptr<StorageExtensionInfo> storage_info; |
| 39 | |
| 40 | virtual ~StorageExtension() { |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | } // namespace duckdb |
| 45 |