Documentation
¶
Overview ¶
Package sync provides Client and Server APIs that ensures robust network connectivity between all peers in the DKG. It supports cluster_definition verification, soft shutdown and reconnect on connection loss.
Index ¶
Constants ¶
const ( MsgSize = 128 InvalidSig = "Invalid Signature" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(ctx context.Context, tcpNode host.Host, server p2p.Peer, hashSig []byte, onFailure func()) Client
NewClient starts a goroutine that establishes a long lived connection to a p2p server and returns a new Client instance. TODO(dhruv): call onFailure on permanent failure.
func (*Client) AwaitConnected ¶
AwaitConnected blocks until the connection with the server has been established or returns an error.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(ctx context.Context, tcpNode host.Host, peers []p2p.Peer, defHash []byte, onFailure func()) *Server
NewServer registers a Stream Handler and returns a new Server instance.
func (*Server) AwaitAllConnected ¶
AwaitAllConnected blocks until all peers have established a connection with this server or returns an error.
func (*Server) AwaitAllShutdown ¶
AwaitAllShutdown blocks until all peers have successfully shutdown or returns an error. It may only be called after AwaitAllConnected.