2016-09-08 21:13:10 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
2017-11-14 03:36:14 +04:00
|
|
|
(* Copyright (c) 2014 - 2017. *)
|
2016-09-08 21:13:10 +04:00
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2016-12-03 16:05:02 +04:00
|
|
|
type ('a, 'b) lwt_format =
|
|
|
|
('a, Format.formatter, unit, 'b Lwt.t) format4
|
|
|
|
|
2017-11-07 20:38:11 +04:00
|
|
|
class type logger_sig = object
|
|
|
|
method error : ('a, 'b) lwt_format -> 'a
|
|
|
|
method warning : ('a, unit) lwt_format -> 'a
|
|
|
|
method message : ('a, unit) lwt_format -> 'a
|
|
|
|
method answer : ('a, unit) lwt_format -> 'a
|
|
|
|
method log : string -> ('a, unit) lwt_format -> 'a
|
|
|
|
end
|
|
|
|
|
|
|
|
val default_log : base_dir:string -> string -> string -> unit Lwt.t
|
|
|
|
|
|
|
|
class logger : (string -> string -> unit Lwt.t) -> logger_sig
|
|
|
|
|
|
|
|
class type wallet = object
|
|
|
|
method load : string -> default:'a -> 'a Data_encoding.encoding -> 'a tzresult Lwt.t
|
|
|
|
method write : string -> 'a -> 'a Data_encoding.encoding -> unit tzresult Lwt.t
|
|
|
|
end
|
|
|
|
|
|
|
|
class type block = object
|
|
|
|
method block : Node_rpc_services.Blocks.block
|
|
|
|
end
|
|
|
|
|
|
|
|
class type logging_wallet = object
|
|
|
|
inherit logger_sig
|
|
|
|
inherit wallet
|
|
|
|
end
|
|
|
|
|
|
|
|
class type logging_rpcs = object
|
|
|
|
inherit logger_sig
|
|
|
|
inherit Client_rpcs.rpc_sig
|
|
|
|
end
|
|
|
|
|
|
|
|
class type full_context = object
|
|
|
|
inherit logger_sig
|
|
|
|
inherit wallet
|
|
|
|
inherit Client_rpcs.rpc_sig
|
|
|
|
inherit block
|
|
|
|
end
|
|
|
|
(** The [full_context] allows the client {!command} handlers to work in
|
|
|
|
>>>>>>> 3ab6ecd4... Client library refactor
|
2017-03-08 21:47:01 +04:00
|
|
|
various modes (command line, batch mode, web client, etc.) by
|
|
|
|
abstracting some basic operations such as logging and reading
|
|
|
|
configuration options. It is passed as parameter to the command
|
|
|
|
handler when running a command, and must be transmitted to all
|
|
|
|
basic operations, also making client commands reantrant. *)
|
2016-12-03 16:05:02 +04:00
|
|
|
|
2017-03-15 04:17:20 +04:00
|
|
|
val make_context :
|
2017-11-07 20:38:11 +04:00
|
|
|
?base_dir:string ->
|
|
|
|
?block:Node_rpc_services.Blocks.block ->
|
2017-04-05 01:35:41 +04:00
|
|
|
?rpc_config:Client_rpcs.config ->
|
2017-11-07 20:38:11 +04:00
|
|
|
(string -> string -> unit Lwt.t) -> full_context
|
2017-03-15 04:17:20 +04:00
|
|
|
(** [make_context ?config log_fun] builds a context whose logging
|
|
|
|
callbacks call [log_fun section msg], and whose [error] function
|
|
|
|
fails with [Failure] and the given message. If not passed,
|
|
|
|
[config] is {!default_cfg}. *)
|
2016-12-03 16:05:02 +04:00
|
|
|
|
2017-11-07 20:38:11 +04:00
|
|
|
val ignore_context : full_context
|
2017-03-08 21:47:01 +04:00
|
|
|
(** [ignore_context] is a context whose logging callbacks do nothing,
|
|
|
|
and whose [error] function calls [Lwt.fail_with]. *)
|
2016-12-03 16:05:02 +04:00
|
|
|
|
2017-11-07 20:38:11 +04:00
|
|
|
type command = (full_context, unit) Cli_entries.command
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
exception Version_not_found
|
|
|
|
|
|
|
|
val register: Protocol_hash.t -> command list -> unit
|
|
|
|
val commands_for_version: Protocol_hash.t -> command list
|
|
|
|
val get_versions: unit -> (Protocol_hash.t * (command list)) list
|
2017-11-07 17:23:01 +04:00
|
|
|
|
|
|
|
(** Have a command execute ignoring warnings.
|
|
|
|
This switch should be used when data will be overwritten. *)
|
2017-11-07 20:38:11 +04:00
|
|
|
val force_switch : (bool, full_context) Cli_entries.arg
|
|
|
|
|
|
|
|
val default_base_dir : string
|
|
|
|
val default_block : Node_rpc_services.Blocks.block
|