Module Normal.Registry

include Octez_riscv_nds_common.Intf.REGISTRY with type invalid_argument_error = Octez_riscv_nds_disk_api.Octez_riscv_durable_storage_on_disk_api.invalid_argument_error
type t

Backend-specific invalid-argument error type for registry operations.

val hash : t -> (bytes, invalid_argument_error) Stdlib.result

hash registry computes the Merkle root hash of registry, derived from the root hashes of all its databases.

val size : t -> (int64, invalid_argument_error) Stdlib.result

size registry returns the number of databases currently held in registry.

val resize : t -> int64 -> (unit, invalid_argument_error) Stdlib.result

resize registry n adjusts registry to contain exactly n databases. The size can only change by one at a time; call this function in a loop for larger adjustments. Growing appends a new empty database; shrinking drops the last database. Returns an error if |current_size - n| > 1.

val copy_database : t -> src:int64 -> dst:int64 -> (unit, invalid_argument_error) Stdlib.result

copy_database registry ~src ~dst duplicates all contents of the database at index src into index dst, completely replacing the previous contents of dst. The source database is unchanged. Copying to the same index is a no-op. Returns an error if src or dst is out of bounds.

val move_database : t -> src:int64 -> dst:int64 -> (unit, invalid_argument_error) Stdlib.result

move_database registry ~src ~dst transfers the database at index src to index dst, completely replacing the previous contents of dst. The source is replaced with a fresh empty database. Moving to the same index is a no-op. Returns an error if src or dst is out of bounds.

val clear : t -> int64 -> (unit, invalid_argument_error) Stdlib.result

clear registry db_index replaces the database at db_index with a fresh empty database. Returns an error if db_index is out of bounds.

val create : Repo.t -> t

create repo creates a new, empty registry backed by repo.

val commit : t -> bytes

commit registry persists the current state and returns a commit identifier that can be used with checkout.

val checkout : Repo.t -> bytes -> t

checkout repo commit_id restores the registry to the state recorded at commit_id.