tursodatabase / libsql

libSQL is a fork of SQLite that is both Open Source, and Open Contributions.
https://turso.tech/libsql
MIT License
9.54k stars 252 forks source link

Namespace configurators #1632

Closed MarinPostma closed 1 month ago

MarinPostma commented 1 month ago

In this PR, we rework how the namespace store instantiates namespaces to make a place for libsql wal replicas. To that end, we introduce the NamespaceConfgurators, which are responsible for instantiating replicas, primaries, or schema databases. The NamespaceConfigurators is set up during program initialization with whatever state is required to instantiate a particular namespace type. Depending on the configuration, the NamespaceStore will call the appropriate namespace configurator to load the namespace.

This is useful for libsql-wal since we must keep a handle to the libsql-wal registry to get an injector or a replicator instance.

To reduce the scope of this PR, the implementation of the replication protocol using libsql wal will be integrated later.