1#include "duckdb/storage/buffer_manager.hpp"
2#include "duckdb/common/allocator.hpp"
3#include "duckdb/common/exception.hpp"
4#include "duckdb/common/file_buffer.hpp"
5#include "duckdb/storage/standard_buffer_manager.hpp"
6
7namespace duckdb {
8
9unique_ptr<BufferManager> BufferManager::CreateStandardBufferManager(DatabaseInstance &db, DBConfig &config) {
10 return make_uniq<StandardBufferManager>(args&: db, args&: config.options.temporary_directory);
11}
12
13shared_ptr<BlockHandle> BufferManager::RegisterSmallMemory(idx_t block_size) {
14 throw NotImplementedException("This type of BufferManager can not create 'small-memory' blocks");
15}
16
17Allocator &BufferManager::GetBufferAllocator() {
18 throw NotImplementedException("This type of BufferManager does not have an Allocator");
19}
20
21void BufferManager::ReserveMemory(idx_t size) {
22 throw NotImplementedException("This type of BufferManager can not reserve memory");
23}
24void BufferManager::FreeReservedMemory(idx_t size) {
25 throw NotImplementedException("This type of BufferManager can not free reserved memory");
26}
27
28void BufferManager::SetLimit(idx_t limit) {
29 throw NotImplementedException("This type of BufferManager can not set a limit");
30}
31
32vector<TemporaryFileInformation> BufferManager::GetTemporaryFiles() {
33 throw InternalException("This type of BufferManager does not allow temporary files");
34}
35
36const string &BufferManager::GetTemporaryDirectory() {
37 throw InternalException("This type of BufferManager does not allow a temporary directory");
38}
39
40BufferPool &BufferManager::GetBufferPool() {
41 throw InternalException("This type of BufferManager does not have a buffer pool");
42}
43
44void BufferManager::SetTemporaryDirectory(const string &new_dir) {
45 throw NotImplementedException("This type of BufferManager can not set a temporary directory");
46}
47
48DatabaseInstance &BufferManager::GetDatabase() {
49 throw NotImplementedException("This type of BufferManager is not linked to a DatabaseInstance");
50}
51
52bool BufferManager::HasTemporaryDirectory() const {
53 return false;
54}
55
56unique_ptr<FileBuffer> BufferManager::ConstructManagedBuffer(idx_t size, unique_ptr<FileBuffer> &&source,
57 FileBufferType type) {
58 throw NotImplementedException("This type of BufferManager can not construct managed buffers");
59}
60
61// Protected methods
62
63void BufferManager::AddToEvictionQueue(shared_ptr<BlockHandle> &handle) {
64 throw NotImplementedException("This type of BufferManager does not support 'AddToEvictionQueue");
65}
66
67void BufferManager::WriteTemporaryBuffer(block_id_t block_id, FileBuffer &buffer) {
68 throw NotImplementedException("This type of BufferManager does not support 'WriteTemporaryBuffer");
69}
70
71unique_ptr<FileBuffer> BufferManager::ReadTemporaryBuffer(block_id_t id, unique_ptr<FileBuffer> buffer) {
72 throw NotImplementedException("This type of BufferManager does not support 'ReadTemporaryBuffer");
73}
74
75void BufferManager::DeleteTemporaryFile(block_id_t id) {
76 throw NotImplementedException("This type of BufferManager does not support 'DeleteTemporaryFile");
77}
78
79} // namespace duckdb
80