@@ -84,6 +84,7 @@ use bao_tree::{
8484} ;
8585use bytes:: Bytes ;
8686use delete_set:: { BaoFilePart , ProtectHandle } ;
87+ use entity_manager:: { EntityManager , Options as EntityManagerOptions } ;
8788use entry_state:: { DataLocation , OutboardLocation } ;
8889use gc:: run_gc;
8990use import:: { ImportEntry , ImportSource } ;
@@ -94,7 +95,6 @@ use nested_enum_utils::enum_conversions;
9495use range_collections:: range_set:: RangeSetRange ;
9596use tokio:: task:: { Id , JoinError , JoinSet } ;
9697use tracing:: { error, instrument, trace} ;
97- use entity_manager:: { EntityManager , Options as EntityManagerOptions } ;
9898
9999use crate :: {
100100 api:: {
@@ -201,6 +201,30 @@ impl TaskContext {
201201 }
202202}
203203
204+ #[ derive( Debug , Clone , Default ) ]
205+ struct EntityState ;
206+
207+ impl entity_manager:: Reset for EntityState {
208+ fn reset ( & mut self ) { }
209+ }
210+
211+ #[ derive( Debug ) ]
212+ struct EmParams ;
213+
214+ impl entity_manager:: Params for EmParams {
215+ type EntityId = Hash ;
216+
217+ type GlobalState = Arc < TaskContext > ;
218+
219+ type EntityState = EntityState ;
220+
221+ async fn on_shutdown (
222+ state : entity_manager:: ActiveEntityState < Self > ,
223+ cause : entity_manager:: ShutdownCause ,
224+ ) {
225+ }
226+ }
227+
204228#[ derive( Debug ) ]
205229struct Actor {
206230 // Context that can be cheaply shared with tasks.
@@ -215,6 +239,8 @@ struct Actor {
215239 running : HashSet < Id > ,
216240 // handles
217241 handles : HashMap < Hash , Slot > ,
242+
243+ handles2 : EntityManager < EmParams > ,
218244 // temp tags
219245 temp_tags : TempTags ,
220246 // our private tokio runtime. It has to live somewhere.
@@ -494,6 +520,10 @@ impl Actor {
494520 trace ! ( "{cmd:?}" ) ;
495521 self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
496522 }
523+ Command :: DeleteBlobs ( cmd) => {
524+ trace ! ( "{cmd:?}" ) ;
525+ self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
526+ }
497527 Command :: ListBlobs ( cmd) => {
498528 trace ! ( "{cmd:?}" ) ;
499529 let ( tx, rx) = tokio:: sync:: oneshot:: channel ( ) ;
@@ -511,10 +541,6 @@ impl Actor {
511541 self . spawn ( list_blobs ( snapshot, cmd) ) ;
512542 }
513543 }
514- Command :: DeleteBlobs ( cmd) => {
515- trace ! ( "{cmd:?}" ) ;
516- self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
517- }
518544 Command :: Batch ( cmd) => {
519545 trace ! ( "{cmd:?}" ) ;
520546 let ( id, scope) = self . temp_tags . create_scope ( ) ;
@@ -670,12 +696,13 @@ impl Actor {
670696 } ) ;
671697 rt. spawn ( db_actor. run ( ) ) ;
672698 Ok ( Self {
673- context : slot_context,
699+ context : slot_context. clone ( ) ,
674700 cmd_rx,
675701 fs_cmd_rx : fs_commands_rx,
676702 tasks : JoinSet :: new ( ) ,
677703 running : HashSet :: new ( ) ,
678704 handles : Default :: default ( ) ,
705+ handles2 : EntityManager :: new ( slot_context, EntityManagerOptions :: default ( ) ) ,
679706 temp_tags : Default :: default ( ) ,
680707 _rt : rt,
681708 } )
0 commit comments