@@ -84,6 +84,7 @@ use bao_tree::{
84
84
} ;
85
85
use bytes:: Bytes ;
86
86
use delete_set:: { BaoFilePart , ProtectHandle } ;
87
+ use entity_manager:: { EntityManager , Options as EntityManagerOptions } ;
87
88
use entry_state:: { DataLocation , OutboardLocation } ;
88
89
use gc:: run_gc;
89
90
use import:: { ImportEntry , ImportSource } ;
@@ -94,7 +95,6 @@ use nested_enum_utils::enum_conversions;
94
95
use range_collections:: range_set:: RangeSetRange ;
95
96
use tokio:: task:: { Id , JoinError , JoinSet } ;
96
97
use tracing:: { error, instrument, trace} ;
97
- use entity_manager:: { EntityManager , Options as EntityManagerOptions } ;
98
98
99
99
use crate :: {
100
100
api:: {
@@ -201,6 +201,30 @@ impl TaskContext {
201
201
}
202
202
}
203
203
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
+
204
228
#[ derive( Debug ) ]
205
229
struct Actor {
206
230
// Context that can be cheaply shared with tasks.
@@ -215,6 +239,8 @@ struct Actor {
215
239
running : HashSet < Id > ,
216
240
// handles
217
241
handles : HashMap < Hash , Slot > ,
242
+
243
+ handles2 : EntityManager < EmParams > ,
218
244
// temp tags
219
245
temp_tags : TempTags ,
220
246
// our private tokio runtime. It has to live somewhere.
@@ -494,6 +520,10 @@ impl Actor {
494
520
trace ! ( "{cmd:?}" ) ;
495
521
self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
496
522
}
523
+ Command :: DeleteBlobs ( cmd) => {
524
+ trace ! ( "{cmd:?}" ) ;
525
+ self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
526
+ }
497
527
Command :: ListBlobs ( cmd) => {
498
528
trace ! ( "{cmd:?}" ) ;
499
529
let ( tx, rx) = tokio:: sync:: oneshot:: channel ( ) ;
@@ -511,10 +541,6 @@ impl Actor {
511
541
self . spawn ( list_blobs ( snapshot, cmd) ) ;
512
542
}
513
543
}
514
- Command :: DeleteBlobs ( cmd) => {
515
- trace ! ( "{cmd:?}" ) ;
516
- self . db ( ) . send ( cmd. into ( ) ) . await . ok ( ) ;
517
- }
518
544
Command :: Batch ( cmd) => {
519
545
trace ! ( "{cmd:?}" ) ;
520
546
let ( id, scope) = self . temp_tags . create_scope ( ) ;
@@ -670,12 +696,13 @@ impl Actor {
670
696
} ) ;
671
697
rt. spawn ( db_actor. run ( ) ) ;
672
698
Ok ( Self {
673
- context : slot_context,
699
+ context : slot_context. clone ( ) ,
674
700
cmd_rx,
675
701
fs_cmd_rx : fs_commands_rx,
676
702
tasks : JoinSet :: new ( ) ,
677
703
running : HashSet :: new ( ) ,
678
704
handles : Default :: default ( ) ,
705
+ handles2 : EntityManager :: new ( slot_context, EntityManagerOptions :: default ( ) ) ,
679
706
temp_tags : Default :: default ( ) ,
680
707
_rt : rt,
681
708
} )
0 commit comments