mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 10:55:06 +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
|
@ -29,8 +29,7 @@ class Tuple {
|
|||
public:
|
||||
Tuple();
|
||||
explicit Tuple(NonnullRefPtr<TupleDescriptor> const&, u32 pointer = 0);
|
||||
Tuple(NonnullRefPtr<TupleDescriptor> const&, ByteBuffer&, size_t&);
|
||||
Tuple(NonnullRefPtr<TupleDescriptor> const&, ByteBuffer&);
|
||||
Tuple(NonnullRefPtr<TupleDescriptor> const&, Serializer&);
|
||||
Tuple(Tuple const&);
|
||||
virtual ~Tuple() = default;
|
||||
|
||||
|
@ -62,23 +61,25 @@ public:
|
|||
void set_pointer(u32 ptr) { m_pointer = ptr; }
|
||||
|
||||
[[nodiscard]] size_t size() const { return m_data.size(); }
|
||||
[[nodiscard]] size_t length() const { return m_descriptor->size(); }
|
||||
[[nodiscard]] virtual size_t length() const;
|
||||
void clear() { m_descriptor->clear(); }
|
||||
[[nodiscard]] NonnullRefPtr<TupleDescriptor> descriptor() const { return m_descriptor; }
|
||||
[[nodiscard]] int compare(Tuple const&) const;
|
||||
[[nodiscard]] int match(Tuple const&) const;
|
||||
[[nodiscard]] u32 hash() const;
|
||||
virtual void serialize(ByteBuffer&) const;
|
||||
[[nodiscard]] virtual size_t data_length() const { return descriptor()->data_length(); }
|
||||
|
||||
protected:
|
||||
[[nodiscard]] Optional<size_t> index_of(String) const;
|
||||
void copy_from(Tuple const&);
|
||||
void deserialize(ByteBuffer&, size_t&);
|
||||
virtual void serialize(Serializer&) const;
|
||||
virtual void deserialize(Serializer&);
|
||||
|
||||
private:
|
||||
NonnullRefPtr<TupleDescriptor> m_descriptor;
|
||||
Vector<Value> m_data;
|
||||
u32 m_pointer { 0 };
|
||||
u32 m_pointer { 2 * sizeof(u32) };
|
||||
|
||||
friend Serializer;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue