mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 13:57:35 +00:00
LibSQL: BTree index, Heap, and Meta objects for SQL Storage layer
Unfortunately this patch is quite large. The main functionality included are a BTree index implementation and the Heap class which manages persistent storage. Also included are a Key subclass of the Tuple class, which is a specialization for index key tuples. This "dragged in" the Meta layer, which has classes defining SQL objects like tables and indexes.
This commit is contained in:
parent
2a46529170
commit
224804b424
15 changed files with 2153 additions and 0 deletions
30
Userland/Libraries/LibSQL/Key.h
Normal file
30
Userland/Libraries/LibSQL/Key.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jan de Visser <jan@de-visser.net>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibSQL/Forward.h>
|
||||
#include <LibSQL/Tuple.h>
|
||||
|
||||
namespace SQL {
|
||||
|
||||
class Key : public Tuple {
|
||||
public:
|
||||
Key();
|
||||
explicit Key(TupleDescriptor const&);
|
||||
explicit Key(RefPtr<IndexDef>);
|
||||
Key(TupleDescriptor const&, ByteBuffer&, size_t& offset);
|
||||
Key(RefPtr<IndexDef>, ByteBuffer&, size_t& offset);
|
||||
Key(Key const&) = default;
|
||||
RefPtr<IndexDef> index() const { return m_index; }
|
||||
[[nodiscard]] virtual size_t data_length() const override { return Tuple::data_length() + sizeof(u32); }
|
||||
|
||||
private:
|
||||
RefPtr<IndexDef> m_index;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue