text
stringlengths
0
601k
let pp f { major ; minor ; additional_info } = Format . fprintf f " % i . % i % s " major minor ( string_of_additional_info additional_info )
let to_string x = Format . asprintf " % a " pp x
let current = { major = 12 ; minor = 0 ; additional_info = Dev }
let current_string = to_string current
module Version_error = struct type t = { payload : Csexp . t option ; message : string } let payload t = t . payload let message t = t . message let create ? payload ~ message ( ) = { payload ; message } exception E of t let to_response_error { payload ; message } = Response . Error . create ~ kind : Invalid_request ? ...
module Staged = struct type ( ' req , ' resp ) request = { encode_req : ' req -> Call . t ; decode_resp : Csexp . t -> ( ' resp , Response . Error . t ) result } type ' payload notification = { encode : ' payload -> Call . t } end
module Make ( Fiber : Fiber ) = struct module Handler = struct type ' state t = { menu : Menu . t ; handle_request : Menu . t -> ' state -> Types . Request . t -> Response . t Fiber . t ; handle_notification : Menu . t -> ' state -> Call . t -> ( unit , Response . Error . t ) result Fiber . t ; prepare_request : ' req ...
module type S = sig type data module Lang : sig val register : Syntax . t -> data -> unit module Instance : sig type t = { syntax : Syntax . t ; data : data ; version : Syntax . Version . t } end val get_exn : string -> Instance . t end val load_exn : Path . t -> f ( : Lang . Instance . t -> ' a Decoder . t ) -> ' a va...
module Make ( Data : sig type t struct module Lang = struct type t = { syntax : Syntax . t ; data : Data . t } module Instance = struct type t = { syntax : Syntax . t ; data : Data . t ; version : Syntax . Version . t } end let langs = Table . create ( module String ) 32 let register syntax data = let name = Syntax . n...
let no_more_lang = let open Decoder in let + ( _ : _ list ) = multi_field " lang " ( let + loc = loc and + _ = repeat raw in User_error . raise ~ loc [ Pp . text " The ( lang . . ) line cannot appear more than once . " ] ) in ( )
module Versioned_direct_stream_writer = struct module Direct_stream_writer = Pipe_rpc . Direct_stream_writer type ' input t = | T : { convert : ( ' input -> ' output ) ; writer : ' output Direct_stream_writer . t } -> ' input t let create ~ convert ~ writer = T { convert ; writer } let write ( T { convert ; writer } ) ...
let failed_conversion x = Error . create " type conversion failure " x [ % sexp_of : [ ` Msg | ` Query | ` Response | ` Error | ` State | ` Update ] * [ ` Rpc of string ] * [ ` Version of int ] * exn ]
let multiple_registrations x = Error . create " multiple rpc registrations " x [ % sexp_of : [ ` Rpc of string ] * [ ` Version of int ] ]
let unknown_version x = Error . create " unknown rpc version " x [ % sexp_of : string * int ]
module Callee_converts = struct module Rpc = struct module Simple = struct type ( ' query , ' response ) adapter = { adapt : ' state . ( ' state -> ' query -> ' response Deferred . t ) -> ' state Implementation . t } type ( ' query , ' response ) t = { name : string ; adapters : ( ' query , ' response ) adapter Int . M...
module Menu = struct module Model = struct let name = " __Versioned_rpc . Menu " type query = unit type response = Description . t list end include Callee_converts . Rpc . Make ( Model ) let rpc_name = Model . name module V1 = struct module T = struct let version = 1 type query = unit [ @@ deriving bin_io ] type respon...
module Connection_with_menu = struct type t = { connection : Connection . t ; menu : Menu . t } [ @@ deriving fields ] let create connection = let open Deferred . Or_error . Monad_infix in Menu . request connection >>| fun menu -> { connection ; menu } let create_directly connection menu = { connection ; menu } end
module Caller_converts = struct let most_recent_common_version ~ rpc_name ~ caller_versions ~ callee_versions ~ callee_menu = match Set . max_elt ( Set . inter callee_versions caller_versions ) with | Some version -> Ok version | None -> error_s [ % message " caller and callee share no common versions for rpc " ( rpc_n...
module Both_convert = struct module Plain = struct module type S = sig type caller_query type callee_query type caller_response type callee_response val dispatch_multi : Connection_with_menu . t -> caller_query -> caller_response Or_error . t Deferred . t val implement_multi : ? log_not_previously_seen_version ( : name...
let from_just op msg = match op with | Some x -> x | None -> failwith @@ msg " ^: Expected Some . Got None . "
module Serialization ( S : sig type t val t : t Irmin . Type . t end ) = struct open S let pp = Irmin . Type . pp_json ~ minify : false t let of_string s = let decoder = Jsonm . decoder ( ` String s ) in let res = try Irmin . Type . decode_json t decoder with Invalid_argument s -> ( failwith @@ sprintf " AO_Value . of_...
module MakeVersionedDS ( Config : CONFIG ) ( OM : MERGEABLE ) ( AO_value : Irmin . Contents . Conv with type t = OM . t ) = struct module S = Irmin_git . AO ( Git_unix . FS ) ( AO_value ) include AO_value type adt = OM . t let create config = let level = Irmin . Private . Conf . key ~ doc " : The Zlib compression level...
module Make ( Config : CONFIG ) = struct module IWarehouse : IRMIN_DATA_STRUCTURE with type adt = Tpcc . Warehouse . t = struct module OM = Tpcc . Warehouse module AO_value : Irmin . Contents . Conv with type t = OM . t = struct type adt = OM . t type t = OM . t let t = let open Irmin . Type in let open Tpcc . Warehous...
type _ witnesses = . .
type _ migration = . .
type _ migration += Undefined : _ migration
type ' a migration_info = { mutable next_version : ' a migration ; mutable previous_version : ' a migration ; }
module type Ast = sig module Parsetree : sig type structure type signature type toplevel_phrase type core_type type expression type pattern type case type type_declaration type type_extension type extension_constructor end module Config : sig val ast_impl_magic_number : string val ast_intf_magic_number : string end end
type ' a _types = ' a constraint ' a = < structure : _ ; signature : _ ; toplevel_phrase : _ ; core_type : _ ; expression : _ ; pattern : _ ; case : _ ; type_declaration : _ ; type_extension : _ ; extension_constructor : _ ; > ; ;
type ' a get_structure = ' x constraint ' a _types = < structure : ' x ; . . >
type ' a get_signature = ' x constraint ' a _types = < signature : ' x ; . . >
type ' a get_toplevel_phrase = ' x constraint ' a _types = < toplevel_phrase : ' x ; . . >
type ' a get_core_type = ' x constraint ' a _types = < core_type : ' x ; . . >
type ' a get_expression = ' x constraint ' a _types = < expression : ' x ; . . >
type ' a get_pattern = ' x constraint ' a _types = < pattern : ' x ; . . >
type ' a get_case = ' x constraint ' a _types = < case : ' x ; . . >
type ' a get_type_declaration = ' x constraint ' a _types = < type_declaration : ' x ; . . >
type ' a get_type_extension = ' x constraint ' a _types = < type_extension : ' x ; . . >
type ' a get_extension_constructor = ' x constraint ' a _types = < extension_constructor : ' x ; . . >
module type OCaml_version = sig module Ast : Ast val version : int val string_version : string type types = < structure : Ast . Parsetree . structure ; signature : Ast . Parsetree . signature ; toplevel_phrase : Ast . Parsetree . toplevel_phrase ; core_type : Ast . Parsetree . core_type ; expression : Ast . Parsetree ....
module Make_witness ( Ast : Ast ) = struct type types = < structure : Ast . Parsetree . structure ; signature : Ast . Parsetree . signature ; toplevel_phrase : Ast . Parsetree . toplevel_phrase ; core_type : Ast . Parsetree . core_type ; expression : Ast . Parsetree . expression ; pattern : Ast . Parsetree . pattern ; ...
type ' types ocaml_version = ( module OCaml_version with type Ast . Parsetree . structure = ' types get_structure and type Ast . Parsetree . signature = ' types get_signature and type Ast . Parsetree . toplevel_phrase = ' types get_toplevel_phrase and type Ast . Parsetree . core_type = ' types get_core_type and type As...
type ( ' from , ' to_ ) migration_functions = { copy_structure : ' from get_structure -> ' to_ get_structure ; copy_signature : ' from get_signature -> ' to_ get_signature ; copy_toplevel_phrase : ' from get_toplevel_phrase -> ' to_ get_toplevel_phrase ; copy_core_type : ' from get_core_type -> ' to_ get_core_type ; co...
let id x = x
let migration_identity : ( ' a , ' a ) migration_functions = { copy_structure = id ; copy_signature = id ; copy_toplevel_phrase = id ; copy_core_type = id ; copy_expression = id ; copy_pattern = id ; copy_case = id ; copy_type_declaration = id ; copy_type_extension = id ; copy_extension_constructor = id ; }
let compose f g x = f ( g x )
let migration_compose ( ab : ( ' a , ' b ) migration_functions ) ( bc : ( ' b , ' c ) migration_functions ) : ( ' a , ' c ) migration_functions = { copy_structure = compose bc . copy_structure ab . copy_structure ; copy_signature = compose bc . copy_signature ab . copy_signature ; copy_toplevel_phrase = compose bc . co...
type _ migration += Migration : ' from ocaml_version * ( ' from , ' to_ ) migration_functions * ' to_ ocaml_version -> ' from migration
module type Migrate_module = sig module From : Ast module To : Ast val copy_structure : From . Parsetree . structure -> To . Parsetree . structure val copy_signature : From . Parsetree . signature -> To . Parsetree . signature val copy_toplevel_phrase : From . Parsetree . toplevel_phrase -> To . Parsetree . toplevel_ph...
module Migration_functions ( A : OCaml_version ) ( B : OCaml_version ) ( A_to_B : Migrate_module with module From = A . Ast and module To = B . Ast ) = struct let migration_functions : ( A . types , B . types ) migration_functions = let open A_to_B in { copy_structure ; copy_signature ; copy_toplevel_phrase ; copy_core...
module Register_migration ( A : OCaml_version ) ( B : OCaml_version ) ( A_to_B : Migrate_module with module From = A . Ast and module To = B . Ast ) ( B_to_A : Migrate_module with module From = B . Ast and module To = A . Ast ) = struct let ( ) = ( let is_undefined : type a . a migration -> bool = function | Undefined ...
type ' from immediate_migration = | No_migration : ' from immediate_migration | Immediate_migration : ( ' from , ' to_ ) migration_functions * ' to_ ocaml_version -> ' from immediate_migration
let immediate_migration ( type structure ) ( type signature ) ( type toplevel_phrase ) ( type core_type ) ( type expression ) ( type pattern ) ( type case ) ( type type_declaration ) ( type type_extension ) ( type extension_constructor ) ( ( module A ) : < structure : structure ; signature : signature ; toplevel_phrase...
let migrate ( type structure1 ) ( type structure2 ) ( type signature1 ) ( type signature2 ) ( type toplevel_phrase1 ) ( type toplevel_phrase2 ) ( type core_type1 ) ( type core_type2 ) ( type expression1 ) ( type expression2 ) ( type pattern1 ) ( type pattern2 ) ( type case1 ) ( type case2 ) ( type type_declaration1 ) (...
module Convert ( A : OCaml_version ) ( B : OCaml_version ) = struct let { copy_structure ; copy_signature ; copy_toplevel_phrase ; copy_core_type ; copy_expression ; copy_pattern ; copy_case ; copy_type_declaration ; copy_type_extension ; copy_extension_constructor ; } : ( A . types , B . types ) migration_functions = ...
module OCaml_402 = struct module Ast = Astlib . Ast_402 include Make_witness ( Astlib . Ast_402 ) let version = 402 let string_version = " 4 . 02 " end
let ocaml_402 : OCaml_402 . types ocaml_version = ( module OCaml_402 )
module OCaml_403 = struct module Ast = Astlib . Ast_403 include Make_witness ( Astlib . Ast_403 ) let version = 403 let string_version = " 4 . 03 " end
let ocaml_403 : OCaml_403 . types ocaml_version = ( module OCaml_403 )
module OCaml_404 = struct module Ast = Astlib . Ast_404 include Make_witness ( Astlib . Ast_404 ) let version = 404 let string_version = " 4 . 04 " end
let ocaml_404 : OCaml_404 . types ocaml_version = ( module OCaml_404 )
module OCaml_405 = struct module Ast = Astlib . Ast_405 include Make_witness ( Astlib . Ast_405 ) let version = 405 let string_version = " 4 . 05 " end
let ocaml_405 : OCaml_405 . types ocaml_version = ( module OCaml_405 )
module OCaml_406 = struct module Ast = Astlib . Ast_406 include Make_witness ( Astlib . Ast_406 ) let version = 406 let string_version = " 4 . 06 " end
let ocaml_406 : OCaml_406 . types ocaml_version = ( module OCaml_406 )
module OCaml_407 = struct module Ast = Astlib . Ast_407 include Make_witness ( Astlib . Ast_407 ) let version = 407 let string_version = " 4 . 07 " end
let ocaml_407 : OCaml_407 . types ocaml_version = ( module OCaml_407 )
module OCaml_408 = struct module Ast = Astlib . Ast_408 include Make_witness ( Astlib . Ast_408 ) let version = 408 let string_version = " 4 . 08 " end
let ocaml_408 : OCaml_408 . types ocaml_version = ( module OCaml_408 )
module OCaml_409 = struct module Ast = Astlib . Ast_409 include Make_witness ( Astlib . Ast_409 ) let version = 409 let string_version = " 4 . 09 " end
let ocaml_409 : OCaml_409 . types ocaml_version = ( module OCaml_409 )
module OCaml_410 = struct module Ast = Astlib . Ast_410 include Make_witness ( Astlib . Ast_410 ) let version = 410 let string_version = " 4 . 10 " end
let ocaml_410 : OCaml_410 . types ocaml_version = ( module OCaml_410 )
module OCaml_411 = struct module Ast = Astlib . Ast_411 include Make_witness ( Astlib . Ast_411 ) let version = 411 let string_version = " 4 . 11 " end
let ocaml_411 : OCaml_411 . types ocaml_version = ( module OCaml_411 )
module OCaml_412 = struct module Ast = Astlib . Ast_412 include Make_witness ( Astlib . Ast_412 ) let version = 412 let string_version = " 4 . 12 " end
let ocaml_412 : OCaml_412 . types ocaml_version = ( module OCaml_412 )
module OCaml_413 = struct module Ast = Astlib . Ast_413 include Make_witness ( Astlib . Ast_413 ) let version = 413 let string_version = " 4 . 13 " end
let ocaml_413 : OCaml_413 . types ocaml_version = ( module OCaml_413 )
module OCaml_414 = struct module Ast = Astlib . Ast_414 include Make_witness ( Astlib . Ast_414 ) let version = 414 let string_version = " 4 . 14 " end
let ocaml_414 : OCaml_414 . types ocaml_version = ( module OCaml_414 )
let all_versions : ( module OCaml_version ) list = [ ] ( Astlib . Migrate_402_403 ) ( Astlib . Migrate_403_402 ) ( Astlib . Migrate_403_404 ) ( Astlib . Migrate_404_403 ) ( Astlib . Migrate_404_405 ) ( Astlib . Migrate_405_404 ) ( Astlib . Migrate_405_406 ) ( Astlib . Migrate_406_405 ) ( Astlib . Migrate_406_407 ) ( As...
module Find_version = struct type t = Impl of ( module OCaml_version ) | Intf of ( module OCaml_version ) | Unknown let from_magic magic = let rec loop = function | [ ] -> Unknown | ( module Version : OCaml_version ) :: tail -> if Version . Ast . Config . ast_impl_magic_number = magic then Impl ( module Version ) else ...
let coinbase : t = ' \ x01 '
let secret_box_byteswr : t = ' \ x02 '
let fee_transfer_single : t = ' \ x03 '
let frontier_hash : t = ' \ x04 '
let ledger_hash : t = ' \ x05 '
let lite_precomputed : t = ' \ x06 '
let proof : t = ' \ x0A '
let random_oracle_base : t = ' \ x0B '
let receipt_chain_hash : t = ' \ x0C '
let epoch_seed : t = ' \ x0D '
let staged_ledger_hash_aux_hash : t = ' \ x0E '
let staged_ledger_hash_pending_coinbase_aux : t = ' \ x0F '
let state_hash : t = ' \ x10 '
let state_body_hash : t = ' \ x11 '
let transaction_hash : t = ' \ x12 '
let user_command : t = ' \ x13 '
let user_command_memo : t = ' \ x14 '