package mirage-block-combinators

  1. Overview
  2. Docs

Fast Fold over the bytes of a block device

This functor use seek operations to perform fast folds over block devices.

Parameters

module A : SEEKABLE

Signature

val mapped_s : f:('a -> int64 -> Cstruct.t -> 'a Lwt.t) -> 'a -> A.t -> ('a, A.error) Stdlib.result Lwt.t

Folds f across data blocks read sequentially from a block device. In contrast to fold_s, Fold.mapped_s will use knowledge about the underlying disk structure and will skip blocks which it knows contain only zeroes. Note it may still read blocks containing zeroes. The function f receives an accumulator, the sector number and a data buffer.

val unmapped_s : f:('a -> int64 -> int64 -> 'a Lwt.t) -> 'a -> A.t -> ('a, A.error) Stdlib.result Lwt.t

Folds f acc ofs len across offsets of unmapped data blocks read sequentially from the block device. Fold.unmapped_s will use knowledge about the underlying disk structure and will only fold across those blocks which are guaranteed to be zero i.e. those which are unmapped somehow.

OCaml

Innovation. Community. Security.