Kùzu C++ API
Loading...
Searching...
No Matches
catalog_set.h
Go to the documentation of this file.
1#pragma once
2
3#include <mutex>
4
5#include "catalog_entry.h"
7
8namespace kuzu {
9namespace binder {
10struct BoundAlterInfo;
11} // namespace binder
12
13namespace storage {
14class UndoBuffer;
15} // namespace storage
16
17namespace transaction {
18class Transaction;
19} // namespace transaction
20
22
23namespace catalog {
25 friend class storage::UndoBuffer;
26
27public:
28 //===--------------------------------------------------------------------===//
29 // getters & setters
30 //===--------------------------------------------------------------------===//
31 bool containsEntry(transaction::Transaction* transaction, const std::string& name);
32 CatalogEntry* getEntry(transaction::Transaction* transaction, const std::string& name);
34 std::unique_ptr<CatalogEntry> entry);
35 void dropEntry(transaction::Transaction* transaction, const std::string& name);
36 void alterEntry(transaction::Transaction* transaction, const binder::BoundAlterInfo& alterInfo);
38
39 uint64_t assignNextOID() {
40 std::lock_guard lck{mtx};
41 return nextOID++;
42 }
43
44 //===--------------------------------------------------------------------===//
45 // serialization & deserialization
46 //===--------------------------------------------------------------------===//
47 void serialize(common::Serializer serializer) const;
48 static std::unique_ptr<CatalogSet> deserialize(common::Deserializer& deserializer);
49
50private:
51 bool containsEntryNoLock(transaction::Transaction* transaction, const std::string& name) const;
52 CatalogEntry* getEntryNoLock(transaction::Transaction* transaction, const std::string& name);
53 CatalogEntry* createEntryNoLock(transaction::Transaction* transaction,
54 std::unique_ptr<CatalogEntry> entry);
55 CatalogEntry* dropEntryNoLock(transaction::Transaction* transaction, const std::string& name);
56
57 void validateExistNoLock(transaction::Transaction* transaction, const std::string& name) const;
58 void validateNotExistNoLock(transaction::Transaction* transaction,
59 const std::string& name) const;
60
61 void emplaceNoLock(std::unique_ptr<CatalogEntry> entry);
62 void eraseNoLock(const std::string& name);
63
64 std::unique_ptr<CatalogEntry> createDummyEntryNoLock(std::string name) const;
65
66 CatalogEntry* traverseVersionChainsForTransactionNoLock(transaction::Transaction* transaction,
67 CatalogEntry* currentEntry) const;
68 CatalogEntry* getCommittedEntryNoLock(CatalogEntry* entry) const;
69
70private:
71 std::mutex mtx;
72 uint64_t nextOID = 0;
74};
75
76} // namespace catalog
77} // namespace kuzu
#define KUZU_API
Definition api.h:25
Definition catalog_entry.h:18
Definition catalog_set.h:24
uint64_t assignNextOID()
Definition catalog_set.h:39
static std::unique_ptr< CatalogSet > deserialize(common::Deserializer &deserializer)
void serialize(common::Serializer serializer) const
CatalogEntry * getEntry(transaction::Transaction *transaction, const std::string &name)
bool containsEntry(transaction::Transaction *transaction, const std::string &name)
KUZU_API void createEntry(transaction::Transaction *transaction, std::unique_ptr< CatalogEntry > entry)
void alterEntry(transaction::Transaction *transaction, const binder::BoundAlterInfo &alterInfo)
CatalogEntrySet getEntries(transaction::Transaction *transaction)
void dropEntry(transaction::Transaction *transaction, const std::string &name)
Definition deserializer.h:15
Definition serializer.h:15
Definition undo_buffer.h:71
Definition transaction.h:28
std::unordered_map< std::string, T, CaseInsensitiveStringHashFunction, CaseInsensitiveStringEquality > case_insensitive_map_t
Definition case_insensitive_map.h:21
Definition alter_type.h:5
common::case_insensitive_map_t< catalog::CatalogEntry * > CatalogEntrySet
Definition catalog_set.h:21
Definition bound_alter_info.h:25