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
15namespace duckdb {
16class AttachedDatabase;
17struct AttachInfo;
18class Catalog;
19class TransactionManager;
20
21//! The StorageExtensionInfo holds static information relevant to the storage extension
22struct StorageExtensionInfo {
23 virtual ~StorageExtensionInfo() {
24 }
25};
26
27typedef unique_ptr<Catalog> (*attach_function_t)(StorageExtensionInfo *storage_info, AttachedDatabase &db,
28 const string &name, AttachInfo &info, AccessMode access_mode);
29typedef unique_ptr<TransactionManager> (*create_transaction_manager_t)(StorageExtensionInfo *storage_info,
30 AttachedDatabase &db, Catalog &catalog);
31
32class StorageExtension {
33public:
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