package octez-smart-rollup-node-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Snapshot archives creation and extraction

type reader

The type of snapshot archive readers.

type writer

The type of snapshot archive writers.

val stdlib_reader : reader

A reader for uncompressed files or snapshot archives.

val stdlib_writer : writer

A writer for uncompressed files or snapshot archives.

val gzip_reader : reader

A reader for compressed files or snapshot archives.

val gzip_writer : writer

A writer for compressed files or snapshot archives.

type snapshot_version =
  1. | V0

Versioning of snapshot format. Only one version for now.

type snapshot_metadata = {
  1. history_mode : Configuration.history_mode;
  2. address : Octez_smart_rollup.Address.t;
  3. head_level : int32;
  4. last_commitment : Octez_smart_rollup.Commitment.Hash.t;
}

Snapshot metadata for version 0. This information is written as a header of the archive snapshot file.

val create : reader -> writer -> snapshot_metadata -> dir:string -> include_file:(relative_path:string -> bool) -> dest:string -> unit

create reader writer metadata ~dir ~include_file ~dest creates a snapshot archive with the header metadata and the hierarchy of files in directory dir for which include_file returns true. The archive is produced in file dest.

extract reader writer check_metadata ~snapshot_file ~dest extracts the snapshot archive snapshot_file in the directory dest. Existing files in dest with the same names are overwritten. The metadata header read from the snapshot is checked with check_metadata before beginning extraction, and returned.

val compress : snapshot_file:string -> string

compress ~snapshot_file compresses the snapshot archive snapshot_file of the form "path/to/snapshot.uncompressed" to a new file "path/to/snapshot" whose path is returned. snapshot_file is removed upon successful compression.

val read_metadata : reader -> snapshot_file:string -> snapshot_metadata

read_metadata reader ~snapshot_file reads the metadata from the snapshot file without extracting it.

val copy_file : src:string -> dst:string -> unit

copy_file ~src ~dst copies the file src to dst.

val copy_dir : ?perm:int -> string -> string -> unit

copy_dir ?perm src dst copies the content of directory src in the directory dst (created with perm, 0o755 by default).

OCaml

Innovation. Community. Security.