@@ -70,6 +70,9 @@ use crate::Result;
7070pub struct EagerRepo {
7171 pub ( crate ) dag : Mutex < Dag > ,
7272 pub ( crate ) store : EagerRepoStore ,
73+ // Additional store for the Augmented Trees, since they are addressed by
74+ // the same sha1 hashes, making it impossible to store in the primary store
75+ pub ( crate ) secondary_tree_store : EagerRepoStore ,
7376 metalog : RwLock < MetaLog > ,
7477 pub ( crate ) dir : PathBuf ,
7578 pub ( crate ) mut_store : Mutex < MutationStore > ,
@@ -232,12 +235,15 @@ impl EagerRepo {
232235 let store_dir = hg_dir. join ( "store" ) ;
233236 let dag = Dag :: open ( store_dir. join ( "segments" ) . join ( "v1" ) ) ?;
234237 let store = EagerRepoStore :: open ( & store_dir. join ( "hgcommits" ) . join ( "v1" ) ) ?;
238+ let secondary_tree_store =
239+ EagerRepoStore :: open ( & store_dir. join ( "augmentedtrees" ) . join ( "v1" ) ) ?;
235240 let metalog = MetaLog :: open ( store_dir. join ( "metalog" ) , None ) ?;
236241 let mut_store = MutationStore :: open ( store_dir. join ( "mutation" ) ) ?;
237242
238243 let repo = Self {
239244 dag : Mutex :: new ( dag) ,
240245 store,
246+ secondary_tree_store,
241247 metalog : RwLock :: new ( metalog) ,
242248 dir : dir. to_path_buf ( ) ,
243249 mut_store : Mutex :: new ( mut_store) ,
@@ -328,6 +334,7 @@ impl EagerRepo {
328334 /// Write pending changes to disk.
329335 pub async fn flush ( & self ) -> Result < ( ) > {
330336 self . store . flush ( ) ?;
337+ self . secondary_tree_store . flush ( ) ?;
331338 let master_heads = {
332339 let books = self . get_bookmarks_map ( ) ?;
333340 let mut heads = Vec :: new ( ) ;
@@ -362,6 +369,17 @@ impl EagerRepo {
362369 self . store . get_sha1_blob ( id)
363370 }
364371
372+ /// Insert SHA1 blob to zstore for augmented trees.
373+ /// These blobs are not content addressed
374+ pub fn add_augmented_tree_blob ( & self , id : Id20 , data : & [ u8 ] ) -> Result < ( ) > {
375+ self . secondary_tree_store . add_arbitrary_blob ( id, data)
376+ }
377+
378+ /// Read SHA1 blob from zstore for augmented trees.
379+ pub fn get_augmented_tree_blob ( & self , id : Id20 ) -> Result < Option < Bytes > > {
380+ self . secondary_tree_store . get_sha1_blob ( id)
381+ }
382+
365383 /// Insert a commit. Return the commit hash.
366384 pub async fn add_commit ( & self , parents : & [ Id20 ] , raw_text : & [ u8 ] ) -> Result < Id20 > {
367385 let parents: Vec < Vertex > = parents
0 commit comments