Module Grpc_discovery.Listening_config

The server side of the discovery specifies where to serve, and how to advertize that information so clients can find you.

The intended usage for this library is to add arg to you command line parameters, and resolve the t using sockaddr in the body of your server command. Also, you should call advertize after starting to serve, to save the discovery information to a file that clients will load.

module Specification : sig ... end
type t = {
  1. specification : Specification.t;
  2. discovery_file : Fpath_base.Fpath.t Base.option;
}
include Ppx_compare_lib.Equal.S with type t := t
val equal : t Base__Ppx_compare_lib.equal
val sexp_of_t : t -> Sexplib0.Sexp.t
val arg : t Base.Or_error.t Cmdlang.Command.Arg.t
val sockaddr : t -> Eio.Net.Sockaddr.stream
val advertize : t -> env:< fs : [> Eio.Fs.dir_ty ] Eio.Path.t.. > -> sw:Eio.Switch.t -> listening_socket:[> 'tag Eio.Net.listening_socket_ty ] Eio.Resource.t -> Base.unit

To be run on the server after starting to listen for connections. If a discovery file is created it is attempted to be removed when the supplied switch is released.

val to_args : t -> Base.string Base.list

Returns the arguments that a server needs to be supplied to rebuild t via arg. This is used by tests and by Grpc_test_helpers.Config.grpc_discovery to create the right invocations for servers whose cli uses arg.