Documentation
¶
Overview ¶
Copyright (c) 2021 - for information on the respective copyright owner see the NOTICE file and/or the repository https://github.com/carbynestack/ephemeral.
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is used to communicate with Discovery service. It is a wrapper around the gRPC client. To send events one writes to the Out channel, reading is done by consuming messages from the In channel. Errors are forwarded to the errCh specified in the config. Thus it must be monitored.
func NewClient ¶
func NewClient(conf *TransportClientConfig) (*Client, error)
NewClient returns a new transport client.
func (*Client) Connect ¶
func (c *Client) Connect() (*grpc.ClientConn, error)
Connect dials the server and returns a connection.
func (*Client) Run ¶
func (c *Client) Run(client pb.DiscoveryClient)
Run starts forwarding of the events. It blocks until the gRPC channel is closed or an error occurs.
type TransportClient ¶
type TransportClient interface { GetIn() chan *pb.Event GetOut() chan *pb.Event Connect() (*grpc.ClientConn, error) Run(client pb.DiscoveryClient) Stop() error }
TransportClient is an interface for the underlying transport connection, e.g. GRPC.
type TransportClientConfig ¶
type TransportClientConfig struct {
// In, Out is the external interface for the libraries that would like to use this client. Events received from "In" are forwarded to the server. The responses are sent back to "Out"
In, Out chan *pb.Event
// ErrCh is the sink for all errors from the client.
ErrCh chan error
// Host, Port - the server endpoint to connect to.
Host, Port string
// EventScope defines the scope of events the client subscribes to. "all" - events from all games are current games, "ConnID" - events associated with this connection ID.
EventScope string
// ConnID is the ID of the connection. In case of pure discovery clients, it is equal the gameID.
ConnID string
// Timeout is the gRPC dial timeout.
Timeout time.Duration
Logger *zap.SugaredLogger
Context context.Context
}
TransportClientConfig preserves config params of the client.
type TransportConn ¶
type TransportConn interface {
Close() error
}
TransportConn is an interface for the underlying gRPC transport connection.