mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:28:12 +00:00
LibSQL: Introduce Serializer as a mediator between Heap and client code
Classes reading and writing to the data heap would communicate directly with the Heap object, and transfer ByteBuffers back and forth with it. This makes things like caching and locking hard. Therefore all data persistence activity will be funneled through a Serializer object which in turn submits it to the Heap. Introducing this unfortunately resulted in a huge amount of churn, in which a number of smaller refactorings got caught up as well.
This commit is contained in:
parent
9e43508d30
commit
85a84b0794
30 changed files with 995 additions and 780 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibSQL/Forward.h>
|
||||
#include <LibSQL/Meta.h>
|
||||
#include <LibSQL/Value.h>
|
||||
|
||||
namespace SQL {
|
||||
|
@ -26,16 +27,17 @@ class Row : public Tuple {
|
|||
public:
|
||||
Row();
|
||||
explicit Row(TupleDescriptor const&);
|
||||
explicit Row(RefPtr<TableDef>);
|
||||
Row(RefPtr<TableDef>, u32, ByteBuffer&);
|
||||
explicit Row(RefPtr<TableDef>, u32 pointer = 0);
|
||||
Row(RefPtr<TableDef>, u32, Serializer&);
|
||||
Row(Row const&) = default;
|
||||
virtual ~Row() override = default;
|
||||
|
||||
[[nodiscard]] u32 next_pointer() const { return m_next_pointer; }
|
||||
void next_pointer(u32 ptr) { m_next_pointer = ptr; }
|
||||
RefPtr<TableDef> table() const { return m_table; }
|
||||
virtual void serialize(ByteBuffer&) const override;
|
||||
[[nodiscard]] virtual size_t data_length() const override { return Tuple::data_length() + sizeof(u32); }
|
||||
[[nodiscard]] virtual size_t length() const override { return Tuple::length() + sizeof(u32); }
|
||||
virtual void serialize(Serializer&) const override;
|
||||
virtual void deserialize(Serializer&) override;
|
||||
|
||||
protected:
|
||||
void copy_from(Row const&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue