mirror of
https://github.com/tursodatabase/libsql.git
synced 2025-07-04 10:13:35 +00:00
* introduce `Database` enum stores different kinds of databases int the same type, and multiplex the connection type the same way. * move NamespaceName to own module * move NamespaceStore to own module - Namespace store is not generic over the Namespace anymore - create method takes a config - simplify loading namespaces * remove NamespaceMaker, make generic NamespaceConfig * unify Namespace kinds Namespace is not generic on db type anymore, but used the multiplexed database types instead. * fix forking * add `map` method to MakeConnection allows mapping the connection type, when wrapping it in database/mod.rs * move connection time tracking to the proxy module where it's being used * remove generics * use NamespaceName fro share_schema_name * simplify server kind configuration. * remove leftover debug
29 lines
750 B
Rust
29 lines
750 B
Rust
use std::sync::Arc;
|
|
|
|
use libsql_replication::rpc::proxy::ExecResp;
|
|
use tonic::Streaming;
|
|
|
|
use crate::connection::write_proxy::{MakeWriteProxyConn, WriteProxyConnection};
|
|
use crate::connection::{MakeThrottledConnection, TrackedConnection};
|
|
|
|
use super::Result;
|
|
|
|
pub type ReplicaConnection = TrackedConnection<WriteProxyConnection<Streaming<ExecResp>>>;
|
|
type ReplicaConnectionMaker = MakeThrottledConnection<MakeWriteProxyConn>;
|
|
|
|
pub struct ReplicaDatabase {
|
|
pub connection_maker: Arc<ReplicaConnectionMaker>,
|
|
}
|
|
|
|
impl ReplicaDatabase {
|
|
pub fn connection_maker(&self) -> Arc<ReplicaConnectionMaker> {
|
|
self.connection_maker.clone()
|
|
}
|
|
|
|
pub fn destroy(self) {}
|
|
|
|
pub async fn shutdown(self) -> Result<()> {
|
|
Ok(())
|
|
}
|
|
}
|