package granary

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

Module Mirage_backend.MakeSource

Parameters

module B : Mirage_block.S

Signature

Sourcetype t

Adapter state: wraps B.t with page-granularity access.

Sourceval connect : ?page_size:int -> B.t -> t Lwt.t

connect ?page_size dev reads get_info from dev to determine sector size and capacity, then creates an adapter with logical n_pages = 0. page_size defaults to 4096 (#95). Raises Failure if page_size is not a multiple of the device's sector_size.

Sourceval n_pages : t -> int64
Sourceval page_size : t -> int

This adapter's page size in bytes (#95).

Sourceval read_page : t -> page_id:int64 -> Cstruct.t -> (unit, string) result Lwt.t
Sourceval write_page : t -> page_id:int64 -> Cstruct.t -> (unit, string) result Lwt.t
Sourceval sync : t -> unit -> (unit, string) result Lwt.t
Sourceval resize : t -> n_pages:int64 -> (unit, string) result Lwt.t

resize t ~n_pages validates n_pages <= capacity and updates the logical count. The physical device is not modified.

Sourceval close : t -> unit Lwt.t