package MlFront_Thunk

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

Module ThunkIoDisk.MakeSource

Parameters

Signature

include sig ... end
Sourcetype file_object = private {
  1. file_origin : string;
  2. is_local_file : bool;
  3. open_for_writing : unit -> [ `Error of string | `IsDirectory of directory_object | `Node of Int64.t ] M.t;
  4. open_for_reading : unit -> [ `Error of string | `IsDirectory of directory_object | `Node of Int64.t ] M.t;
  5. read_some : Int64.t -> [ `Bytes of bytes * int * int | `Eof | `Error of string ] M.t;
  6. write_all : Int64.t -> string -> int -> int -> [ `Error of string | `WroteBytes ] M.t;
  7. close : Int64.t -> unit M.t;
  8. read_all : unit -> [ `Content of string | `Error of string | `ExceededSizeLimit of int64 ] M.t;
  9. prepare_as_copy_destination : unit -> [ `Error of string | `Ready ] M.t;
  10. delete_file : unit -> [ `Deleted | `Error of string ] M.t;
  11. checksum_file : strip_carriage_returns:bool -> algo:[ `Sha1 | `Sha256 ] -> unit -> [ `Checksum of string * Int64.t | `Error of string ] M.t;
}
Sourceand directory_object = private {
  1. dir_origin : string;
  2. create_directory : unit -> [ `Created | `Error of string ] M.t;
  3. delete_directory : unit -> [ `Deleted | `Error of string ] M.t;
  4. zip_directory : ?intermediate:unit -> staging_dir:directory_object -> unit -> [ `Error of string | `ZipFile of file_object ] M.t;
  5. spawn_in_directory : command:MlFront_Core.FilePath.t -> args:string list -> envmods:MlFront_Core.EnvMods.t -> stdout:file_object -> stderr:file_object -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t;
  6. interactive_shell_in_directory : ?promptname:string -> envmods:MlFront_Core.EnvMods.t -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t;
}
Sourceval generic_file : origin:string -> is_local_file:bool -> open_for_writing: (unit -> [ `Error of string | `IsDirectory of directory_object | `Node of Int64.t ] M.t) -> open_for_reading: (unit -> [ `Error of string | `IsDirectory of directory_object | `Node of Int64.t ] M.t) -> read_some: (Int64.t -> [ `Bytes of bytes * int * int | `Eof | `Error of string ] M.t) -> write_all: (Int64.t -> string -> int -> int -> [ `Error of string | `WroteBytes ] M.t) -> close:(Int64.t -> unit M.t) -> read_all: (unit -> [ `Content of string | `Error of string | `ExceededSizeLimit of int64 ] M.t) -> prepare_as_copy_destination:(unit -> [ `Error of string | `Ready ] M.t) -> delete_file:(unit -> [ `Deleted | `Error of string ] M.t) -> checksum_file: (strip_carriage_returns:bool -> algo:[ `Sha1 | `Sha256 ] -> unit -> [ `Checksum of string * Int64.t | `Error of string ] M.t) -> unit -> file_object
Sourceval generic_dir : origin:string -> create_directory:(unit -> [ `Created | `Error of string ] M.t) -> delete_directory:(unit -> [ `Deleted | `Error of string ] M.t) -> zip_directory: (?intermediate:unit -> staging_dir:directory_object -> unit -> [ `Error of string | `ZipFile of file_object ] M.t) -> spawn_in_directory: (command:MlFront_Core.FilePath.t -> args:string list -> envmods:MlFront_Core.EnvMods.t -> stdout:file_object -> stderr:file_object -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t) -> interactive_shell_in_directory: (?promptname:string -> envmods:MlFront_Core.EnvMods.t -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t) -> unit -> directory_object
Sourceval inmemory_file : origin:MlFront_Core.FilePath.t -> string -> file_object
Sourceval inmemory_dir : origin:MlFront_Core.FilePath.t -> unit -> directory_object
Sourceval file_origin : file_object -> string
Sourceval directory_origin : directory_object -> string
Sourceval read_all : file_object -> [ `Content of string | `Error of string | `ExceededSizeLimit of int64 ] M.t
Sourceval copy : src:file_object -> dest:file_object -> unit -> [ `Copied | `DestinationIsDirectory of directory_object | `Error of string | `SourceIsDirectory of directory_object ] M.t
Sourceval copy_or_fail : src:file_object -> dest:file_object -> on_error:(string -> 'a M.t) -> 'a M.t -> 'a M.t
Sourceval copy_but_error_if_dest_is_dir : src:file_object -> dest:file_object -> unit -> [ `Copied | `Error of string | `SourceIsDirectory of directory_object ] M.t
Sourceval checksum_file : ?strip_carriage_returns:unit -> algo:[ `Sha1 | `Sha256 ] -> file_object -> [ `Checksum of string * Int64.t | `Error of string ] M.t
Sourceval replace_all_bytes : file_object -> bytes -> int -> int -> [ `Error of string | `IsDirectory of directory_object | `WroteBytes ] M.t
Sourceval replace_all_string : file_object -> string -> int -> int -> [ `Error of string | `IsDirectory of directory_object | `WroteBytes ] M.t
Sourceval delete_file : file_object -> [ `Deleted | `Error of string ] M.t
Sourceval is_local_file : file_object -> bool
Sourceval create_directory : directory_object -> [ `Created | `Error of string ] M.t
Sourceval delete_directory : directory_object -> [ `Deleted | `Error of string ] M.t
Sourceval spawn_in_directory : command:MlFront_Core.FilePath.t -> args:string list -> cwd:directory_object -> envmods:MlFront_Core.EnvMods.t -> stdout:file_object -> stderr:file_object -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t
Sourceval interactive_shell_in_directory : ?promptname:string -> envmods:MlFront_Core.EnvMods.t -> cwd:directory_object -> unit -> [ `Error of string | `Exited of int | `Signaled of int | `Stopped of int ] M.t
Sourceval copy_file_or_dir_to_file_and_sha256_or_fail : ?intermediate:unit -> src:file_object -> dest:file_object -> staging_dir:directory_object -> on_error:(string -> 'b M.t) -> (string -> int64 -> 'b M.t) -> 'b M.t
Sourceval memory_limit : int64

memory_limit.

16 MiB is the maximum on 32-bit OCaml platforms for a single string. However, js_of_ocaml uses maximum JavaScript string size which is undocumented but at least 2^51.

We'll use 2^31 - 1 as limit for now as that is the memory bound for 32-bit signed C integers.

Sourceval disk_dir : MlFront_Core.FilePath.t -> directory_object
Sourceval disk_file : MlFront_Core.FilePath.t -> file_object

disk_file origin creates a new file object that reads from the disk from the file origin. The file is read synchronously, so use a different file object implementation for asynchronous reads.