@@ -85,6 +85,13 @@ pub type Durability = dyn spacetimedb_durability::Durability<TxData = Txdata>;
8585/// configured or the database is in follower state.
8686pub type DiskSizeFn = Arc < dyn Fn ( ) -> io:: Result < SizeOnDisk > + Send + Sync > ;
8787
88+ #[ derive( Clone , Copy , Debug ) ]
89+ pub struct Database {
90+ pub id : u64 ,
91+ pub database_identity : Identity ,
92+ pub owner_identity : Identity ,
93+ }
94+
8895/// Persistence services for a database.
8996pub struct Persistence {
9097 /// The [Durability] to use, for persisting transactions.
@@ -182,7 +189,7 @@ impl Persistence {
182189/// This is an `async_trait` to allow it to be used as a trait object.
183190#[ async_trait]
184191pub trait PersistenceProvider : Send + Sync {
185- async fn persistence ( & self , database_identity : Identity , replica_id : u64 ) -> anyhow:: Result < Persistence > ;
192+ async fn persistence ( & self , database : & Database , replica_id : u64 ) -> anyhow:: Result < Persistence > ;
186193}
187194
188195/// The standard [PersistenceProvider] for non-replicated databases.
@@ -215,7 +222,8 @@ impl LocalPersistenceProvider {
215222
216223#[ async_trait]
217224impl PersistenceProvider for LocalPersistenceProvider {
218- async fn persistence ( & self , database_identity : Identity , replica_id : u64 ) -> anyhow:: Result < Persistence > {
225+ async fn persistence ( & self , database : & Database , replica_id : u64 ) -> anyhow:: Result < Persistence > {
226+ let database_identity = database. database_identity ;
219227 let replica_dir = self . data_dir . replica ( replica_id) ;
220228 let snapshot_dir = replica_dir. snapshots ( ) ;
221229 let runtime = Handle :: tokio_current ( ) ;
0 commit comments