package octez-libs
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=aa2f5bc99cc4ca2217c52a1af2a2cdfd3b383208cb859ca2e79ca0903396ca1d
sha512=d68bb3eb615e3dcccc845fddfc9901c95b3c6dc8e105e39522ce97637b1308a7fa7aa1d271351d5933febd7476b2819e1694f31198f1f0919681f1f9cc97cb3a
doc/octez-libs.rpc/Tezos_rpc/Directory/index.html
Module Tezos_rpc.DirectorySource
include module type of struct include Resto_directory.Make(Tezos_rpc__.RPC_encoding) end
type step = Resto_directory.Make(Tezos_rpc__.RPC_encoding).step = | Static of string(*A literal chunk
*)| Dynamic of Resto.Arg.descr(*A chunk which describes a argument to a service
*)| DynamicTail of Resto.Arg.descr(*The remainder of the chunks are to be interpreted as a list of arguments
*)
The different chunks of a path
E.g., /archive/<year>/<months>/ has a Static "archive" step followed by a Dynamic _ step followed by a Dynamic _ step. Each Dynamic _ step has an Resto.Arg payload describing the chunk.
type conflict = Resto_directory.Make(Tezos_rpc__.RPC_encoding).conflict = | CService of Resto.meth(*A collision with a service that has been already defined for the given method at the certain path.
*)| CDir(*An incompatibility with the directory at a certain path.
*)| CBuilder(*A collision with the builder part of another dynamic directory of a certain path.
*)| CDynDescr of string * string(*A collision between the descriptions of two given dynamic directories.
*)| CTail(*A collision with another dynamic tail directory of a certain path.
*)| CTypes of Resto.Arg.descr * Resto.Arg.descr(*A typing incompatibility with an URI parameter of a certain type when another parameter type was expected.
*)| CType of Resto.Arg.descr * string list(*A typing impompatibility with an URI parameter with the given subdirectories.
*)
Possible kind of conflictual error that can occur while registering services into a directory or while merging directories.
type ('query, 'input, 'output, 'error) types =
('query, 'input, 'output, 'error)
Resto_directory.Make(Tezos_rpc__.RPC_encoding).types =
{query : 'query Resto.Query.t;input : 'input Service.input;output : 'output Data_encoding.t;error : 'error Data_encoding.t;
}type registered_service =
Resto_directory.Make(Tezos_rpc__.RPC_encoding).registered_service =
| Service : {types : ('q, 'i, 'o, 'e) types;handler : 'q -> 'i -> ('o, 'e) Resto_directory.Answer.t Lwt.t;
} -> registered_service
Dispatch tree
type lookup_error = [ | `Not_found| `Method_not_allowed of Resto.meth list| `Cannot_parse_path of string list * Resto.Arg.descr * string
]string_of_step step converts the given steps into a string.
string_of_conflict_kind conflict_kind converts the given conflict_kind into a string.
string_of_conflict conflict converts the given conflict into a string.
val lookup :
'prefix directory ->
'prefix ->
Resto.meth ->
string list ->
(registered_service, [> lookup_error ]) result Lwt.tlookup d m p is Ok (Service _) if there is a service s registered in d and both the method of s is m and the path of s matches p. It is Error _ otherwise.
If it is Ok (Service _) then the returned value corresponds to the registered service.
val lookup_uri_desc :
'prefix directory ->
'prefix ->
Resto.meth ->
string list ->
(string, [> lookup_error ]) result Lwt.tlookup_uri_desc d p is Ok u where u is a formated URI description, if there is a service s registered in d and the path of s matches p. It is Error _ otherwise.
For instance, given the following path p: "/entries-by-date/2022/01/10" where "2022", "01", and "10" are expected to be paramaters in the path of s, the function will evaluate in "/entries-by-date/<year>/<month>/<day>".
val allowed_methods :
'prefix directory ->
'prefix ->
string list ->
(Resto.meth list, [> lookup_error ]) result Lwt.tallowed_methods d p is the set of methods m such that lookup d m p is Ok _. In other words, it is the set of methods m such that a service has been registered in d for a path that matches p.
val transparent_lookup :
'prefix directory ->
('meth, 'prefix, 'params, 'query, 'input, 'output, 'error) Service.t ->
'params ->
'query ->
'input ->
[> ('output, 'error) Resto_directory.Answer.t ] Lwt.tprefix p d is a directory of services which includes a service registered on the path p / q for each service registered on the path q in d.
val merge :
?strategy:[ `Raise | `Pick_left | `Pick_right ] ->
'a directory ->
'a directory ->
'a directorymerge ~strategy d1 d2 is a directory which includes all the services of d1 and d2.
It is possible to merge both static and dynamic trees.
- In case of static trees, the resulting merge will occur in a eager way at function call.
- In case of dynamic trees and because of their nature, the resulting merging directory can't however be computed directly: We don't know the subtree of such a tree before resolving it whith a proper argument
keyand thus don't have a way to merge it directly at function call. In such a case, the merging computation will be delayed at resolving time. This may not be a problem in most cases. But merging directories containing a lot of nested dynamic directories should still be avoided as it may impact queries performances.
As a few elements that constitutes a directory tree are not mergeable, it may be possible to come upon a collision case during a merge. Unmergeable elements are:
- Services
- Dynamic directories description.
If one or more of these elements from d1 collides with one or more element from d2, the function will make a choice depending on the given merging strategy:
`Raisewill raise aConflictexception. This is the default choice.`Pick_leftwill pick the element fromd1to be part of the resulting directory.`Pick_rightwill pick the element fromd2to be part of the resulting directory.
val register_dynamic_directory :
?descr:string ->
'prefix directory ->
('prefix, 'a) Resto.Path.path ->
('a -> 'a directory Lwt.t) ->
'prefix directoryRegistring dynamic subtree.
val register_dynamic_directory1 :
?descr:string ->
'prefix directory ->
('prefix, unit * 'a) Resto.Path.path ->
('a -> (unit * 'a) directory Lwt.t) ->
'prefix directoryRegistring dynamic subtree. (Curryfied variant)
val register_describe_directory_service :
'prefix directory ->
('prefix, 'prefix, 'error) Service.description_service ->
'prefix directoryRegistring a description service.
val describe_directory :
recurse:bool ->
?arg:'a ->
'a directory ->
(Data_encoding.json_schema * Data_encoding.Binary_schema.t)
Resto.Description.directory
Lwt.tval register :
'prefix directory ->
([< Resto.meth ],
'prefix,
'p,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('p -> 'q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryRegistering handler in service tree.
val register_chunked :
'prefix directory ->
([< Resto.meth ],
'prefix,
'p,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('p -> 'q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register :
'prefix directory ->
([< Resto.meth ],
'prefix,
'p,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('p -> 'q -> 'i -> 'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval gen_register :
'prefix directory ->
('meth,
'prefix,
'params,
'query,
'input,
'output,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('params -> 'query -> 'input -> [< 'output Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval lwt_register :
'prefix directory ->
([< Resto.meth ],
'prefix,
'p,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('p -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directoryRegistering handler in service tree. Curryfied variant.
val register0 :
unit directory ->
('m, unit, unit, 'q, 'i, 'o, Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
unit directoryval register0_chunked :
unit directory ->
('m, unit, unit, 'q, 'i, 'o, Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
unit directoryval register1 :
'prefix directory ->
('m,
'prefix,
unit * 'a,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval register2 :
'prefix directory ->
('m,
'prefix,
(unit * 'a) * 'b,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'q -> 'i -> 'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval register3 :
'prefix directory ->
('m,
'prefix,
((unit * 'a) * 'b) * 'c,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'q ->
'i ->
'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval register4 :
'prefix directory ->
('m,
'prefix,
(((unit * 'a) * 'b) * 'c) * 'd,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'd ->
'q ->
'i ->
'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval register5 :
'prefix directory ->
('m,
'prefix,
((((unit * 'a) * 'b) * 'c) * 'd) * 'e,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'd ->
'e ->
'q ->
'i ->
'o Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register0 :
unit directory ->
('m, unit, unit, 'q, 'i, 'o, Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('q -> 'i -> 'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
unit directoryval opt_register1 :
'prefix directory ->
('m,
'prefix,
unit * 'a,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'q -> 'i -> 'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register2 :
'prefix directory ->
('m,
'prefix,
(unit * 'a) * 'b,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'q ->
'i ->
'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register3 :
'prefix directory ->
('m,
'prefix,
((unit * 'a) * 'b) * 'c,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'q ->
'i ->
'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register4 :
'prefix directory ->
('m,
'prefix,
(((unit * 'a) * 'b) * 'c) * 'd,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'd ->
'q ->
'i ->
'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval opt_register5 :
'prefix directory ->
('m,
'prefix,
((((unit * 'a) * 'b) * 'c) * 'd) * 'e,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'd ->
'e ->
'q ->
'i ->
'o option Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'prefix directoryval gen_register0 :
unit directory ->
('m, unit, unit, 'q, 'i, 'o, Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('q -> 'i -> [< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
unit directoryval gen_register1 :
'prefix directory ->
('m,
'prefix,
unit * 'a,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'q -> 'i -> [< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval gen_register2 :
'prefix directory ->
('m,
'prefix,
(unit * 'a) * 'b,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'q -> 'i -> [< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval gen_register3 :
'prefix directory ->
('m,
'prefix,
((unit * 'a) * 'b) * 'c,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'c -> 'q -> 'i -> [< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval gen_register4 :
'prefix directory ->
('m,
'prefix,
(((unit * 'a) * 'b) * 'c) * 'd,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'c -> 'd -> 'q -> 'i -> [< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval gen_register5 :
'prefix directory ->
('m,
'prefix,
((((unit * 'a) * 'b) * 'c) * 'd) * 'e,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a ->
'b ->
'c ->
'd ->
'e ->
'q ->
'i ->
[< 'o Tezos_rpc__.RPC_answer.t ] Lwt.t) ->
'prefix directoryval lwt_register0 :
unit directory ->
('m, unit, unit, 'q, 'i, 'o, Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('q -> 'i -> 'o Lwt.t) ->
unit directoryval lwt_register1 :
'prefix directory ->
('m,
'prefix,
unit * 'a,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directoryval lwt_register2 :
'prefix directory ->
('m,
'prefix,
(unit * 'a) * 'b,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directoryval lwt_register3 :
'prefix directory ->
('m,
'prefix,
((unit * 'a) * 'b) * 'c,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'c -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directoryval lwt_register4 :
'prefix directory ->
('m,
'prefix,
(((unit * 'a) * 'b) * 'c) * 'd,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'c -> 'd -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directoryval lwt_register5 :
'prefix directory ->
('m,
'prefix,
((((unit * 'a) * 'b) * 'c) * 'd) * 'e,
'q,
'i,
'o,
Tezos_error_monad.Error_monad.error list)
Resto.MakeService(Tezos_rpc__.RPC_encoding).t ->
('a -> 'b -> 'c -> 'd -> 'e -> 'q -> 'i -> 'o Lwt.t) ->
'prefix directory