Octez_riscv_nds_common.NdsType-erased NDS handle.
Wraps any concrete backend satisfying Intf.NORMAL into a single existential type so that callers can work with NDS generically. Backend-specific invalid-argument errors are normalised to Nds_errors.invalid_argument_error via a converter supplied at wrap time.
val wrap :
(module Intf.NORMAL
with type Registry.invalid_argument_error = 'e
and type Registry.t = 'a) ->
'a ->
('e -> Nds_errors.invalid_argument_error) ->
twrap impl value to_error packages a concrete NDS backend impl and its state value into an opaque t handle, together with a to_error function that normalises backend-specific errors to the canonical Nds_errors.invalid_argument_error closed enum.
Each function below unpacks the existential, delegates to the wrapped backend, and normalises the backend error via the stored to_error converter.
val size : t -> (int64, Nds_errors.invalid_argument_error) Stdlib.resultsize t returns the number of databases in the registry.
val resize :
t ->
int64 ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultresize t n adjusts the registry to contain exactly n databases.
val copy_database :
t ->
src:int64 ->
dst:int64 ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultcopy_database t ~src ~dst duplicates database src to dst.
val move_database :
t ->
src:int64 ->
dst:int64 ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultmove_database t ~src ~dst moves database src to dst.
val clear :
t ->
int64 ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultclear t db_index removes all entries from database db_index.
val registry_hash :
t ->
(bytes, Nds_errors.invalid_argument_error) Stdlib.resultregistry_hash t returns the Merkle root hash of the registry.
val exists :
t ->
db_index:int64 ->
key:bytes ->
(bool, Nds_errors.invalid_argument_error) Stdlib.resultexists t ~db_index ~key checks whether key exists in database db_index.
val read :
t ->
db_index:int64 ->
key:bytes ->
offset:int64 ->
len:int64 ->
(bytes, Nds_errors.invalid_argument_error) Stdlib.resultread t ~db_index ~key ~offset ~len reads bytes from database db_index.
val write :
t ->
db_index:int64 ->
key:bytes ->
offset:int64 ->
value:bytes ->
(int64, Nds_errors.invalid_argument_error) Stdlib.resultwrite t ~db_index ~key ~offset ~value writes value starting at offset into the value associated with key in database db_index. Returns the number of bytes written (i.e. Bytes.length value).
val set :
t ->
db_index:int64 ->
key:bytes ->
value:bytes ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultset t ~db_index ~key ~value replaces the value of key in database db_index.
val delete :
t ->
db_index:int64 ->
key:bytes ->
(unit, Nds_errors.invalid_argument_error) Stdlib.resultdelete t ~db_index ~key removes key from database db_index.
val value_length :
t ->
db_index:int64 ->
key:bytes ->
(int64, Nds_errors.invalid_argument_error) Stdlib.resultvalue_length t ~db_index ~key returns the length of the value for key in database db_index.
val hash :
t ->
db_index:int64 ->
(bytes, Nds_errors.invalid_argument_error) Stdlib.resulthash t ~db_index returns the Merkle root hash of database db_index.