@@ -30,7 +30,6 @@ use crate::{
3030 } ,
3131 endpoints:: { Endpoint , HandleGetContext } ,
3232 errors:: { AtomicError , AtomicResult } ,
33- plugins:: { plugins, wasm} ,
3433 resources:: PropVals ,
3534 storelike:: { Query , QueryResult , ResourceResponse , Storelike } ,
3635 values:: SortableValue ,
@@ -74,7 +73,7 @@ pub struct Db {
7473 /// Try not to use this directly, but use the Trees.
7574 db : sled:: Db ,
7675 default_agent : Arc < Mutex < Option < crate :: agents:: Agent > > > ,
77- /// Stores all resources. The Key is the Subject as a `string.as_bytes()`, the value a [PropVals]. Propvals must be serialized using [bincode] .
76+ /// Stores all resources. The Key is the Subject as a `string.as_bytes()`, the value a [PropVals]. Propvals must be serialized using messagepack .
7877 resources : sled:: Tree ,
7978 /// [Tree::ValPropSub]
8079 reference_index : sled:: Tree ,
@@ -109,9 +108,8 @@ impl Db {
109108 let query_index = db. open_tree ( Tree :: QueryMembers ) ?;
110109 let prop_val_sub_index = db. open_tree ( Tree :: PropValSub ) ?;
111110 let watched_queries = db. open_tree ( Tree :: WatchedQueries ) ?;
112- let class_extenders = plugins:: default_class_extenders ( ) ;
113111
114- let mut store = Db {
112+ let store = Db {
115113 path : path. into ( ) ,
116114 db,
117115 default_agent : Arc :: new ( Mutex :: new ( None ) ) ,
@@ -121,14 +119,11 @@ impl Db {
121119 prop_val_sub_index,
122120 server_url,
123121 watched_queries,
124- endpoints : plugins :: default_endpoints ( ) ,
125- class_extenders,
122+ endpoints : vec ! [ ] ,
123+ class_extenders : vec ! [ ] ,
126124 on_commit : None ,
127125 } ;
128126
129- let extenders = wasm:: load_wasm_class_extenders ( path, & store) . await ;
130- store. class_extenders . extend ( extenders) ;
131-
132127 migrate_maybe ( & store) . map ( |e| format ! ( "Error during migration of database: {:?}" , e) ) ?;
133128 crate :: populate:: populate_base_models ( & store)
134129 . await
@@ -152,6 +147,20 @@ impl Db {
152147 Ok ( store)
153148 }
154149
150+ pub fn add_class_extender ( & mut self , class_extender : ClassExtender ) -> AtomicResult < ( ) > {
151+ self . class_extenders . push ( class_extender) ;
152+ Ok ( ( ) )
153+ }
154+
155+ pub fn add_endpoint ( & mut self , endpoint : Endpoint ) -> AtomicResult < ( ) > {
156+ self . endpoints . push ( endpoint) ;
157+ Ok ( ( ) )
158+ }
159+
160+ pub fn get_endpoints ( & self ) -> & Vec < Endpoint > {
161+ & self . endpoints
162+ }
163+
155164 #[ instrument( skip( self ) ) ]
156165 fn add_atom_to_index (
157166 & self ,
0 commit comments