This is pretty complicated and touches a lot of things, so I'm interested in reviews, maybe from @ajaspers or @progval ?
The core idea here is to refactor persistence to eventually support datastores other than buntdb. There are two problems:
We don't want typical chat operations to block on the datastore (this is mostly implemented already, with the asynchronous persistence / markDirty stuff, but there are some cases where we would still block, particularly for accounts where every login currently incurs a read from the datastore)
We don't want to require nontrivial consistency guarantees from the datastore
The new approach is best illustrated by the new, weak datastore API:
which exposes key-value pairs. Each key has a UUID and is associated with a "table". There are four operations:
Read everything from a table. This is used at ircd startup to read all persisted data. The source of truth then becomes the in-memory datastructures, with asynchronous persistence back to the datastore
Set a key, with an optional TTL that will be respected by the datastore
Delete a key
Read a single key (this is used for some edge cases, like schema changes)
This branch refactors channels and channel purge records to use the new API.
This is pretty complicated and touches a lot of things, so I'm interested in reviews, maybe from @ajaspers or @progval ?
The core idea here is to refactor persistence to eventually support datastores other than buntdb. There are two problems:
markDirty
stuff, but there are some cases where we would still block, particularly for accounts where every login currently incurs a read from the datastore)The new approach is best illustrated by the new, weak datastore API:
https://github.com/slingamn/ergo/blob/7ce06362764ee35629521eacc1fdee5405370efd/irc/datastore/datastore.go
which exposes key-value pairs. Each key has a UUID and is associated with a "table". There are four operations:
This branch refactors channels and channel purge records to use the new API.