package octez-smart-rollup-node-lib

  1. Overview
  2. Docs
On This Page
  1. Lock files
Legend:
Library
Module
Module type
Parameter
Class
Class type

A map addressed by (protocol agnostic) DAC reveal hashes.

Lock files

val lock : ?when_locked:[ `Fail | `Block ] -> string -> Lwt_unix.file_descr Tezos_base.TzPervasives.tzresult Lwt.t

lock ?when_lock path acquires a lock on the file path and returns the opened file descriptor (for unlocking). If there is already a lock on path, this function call is blocking until the previous lock is released. If there is already a lock on path, the call will block if when_lock is `Block (the default), and will fail if when_lock = `Fail.

val unlock : Lwt_unix.file_descr -> unit Lwt.t

unlock fd releases the lock on the opened file descriptor fd. If there is no lock or if it is already released, this function does nothing.

val with_lockfile : ?when_locked:[ `Fail | `Block ] -> string -> (unit -> 'a Tezos_base.TzPervasives.tzresult Lwt.t) -> 'a Tezos_base.TzPervasives.tzresult Lwt.t

with_lockfile ?when_lock path f executes the function f by taking a lock on the file path. If there is already a lock on path, the execution of f is blocking until the previous lock is released. See lock for a description of the when_lock parameter.

OCaml

Innovation. Community. Security.