Skip to content

Commit

Permalink
storage: route empty prefixed keys to main store (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
erwanor committed Nov 6, 2023
1 parent de93498 commit bbfa06b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/storage/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,16 @@ impl Storage {
});

for (config, root_hash) in substore_roots {
main_store_changes
.unwritten_changes
.insert(config.prefix.clone(), Some(root_hash.0.to_vec()));
// TODO(erwan): this is a temporary hack that we need to remove before shipping.
// the root hash of each substore is stored in the main store, under the prefix key.
// however, the current (incomplete) routing logic still allows empty keys on substores e.g:
// - `prefix_a/key_1` corresponds to the key `/key_1` in substore `prefix_a`
// - `prefix_a` corresponds to the key "" in substore `prefix_a`
// instead, it should correspond to the key `prefix_a` in the main store
main_store_changes.unwritten_changes.insert(
format!("prefix_root_hash_{}", config.prefix),
Some(root_hash.0.to_vec()),
);
}

/* commit main substore */
Expand Down

0 comments on commit bbfa06b

Please sign in to comment.