1//===----------------------------------------------------------------------===//
2// DuckDB
3//
4// duckdb/transaction/cleanup_state.hpp
5//
6//
7//===----------------------------------------------------------------------===//
8
9#pragma once
10
11#include "duckdb/transaction/undo_buffer.hpp"
12#include "duckdb/common/types/data_chunk.hpp"
13#include "duckdb/common/unordered_map.hpp"
14
15namespace duckdb {
16
17class DataTable;
18
19struct DeleteInfo;
20struct UpdateInfo;
21
22class CleanupState {
23public:
24 CleanupState();
25 ~CleanupState();
26
27 // all tables with indexes that possibly need a vacuum (after e.g. a delete)
28 unordered_map<string, optional_ptr<DataTable>> indexed_tables;
29
30public:
31 void CleanupEntry(UndoFlags type, data_ptr_t data);
32
33private:
34 // data for index cleanup
35 optional_ptr<DataTable> current_table;
36 DataChunk chunk;
37 row_t row_numbers[STANDARD_VECTOR_SIZE];
38 idx_t count;
39
40private:
41 void CleanupDelete(DeleteInfo &info);
42 void CleanupUpdate(UpdateInfo &info);
43
44 void Flush();
45};
46
47} // namespace duckdb
48