Documentation ¶
Index ¶
- type AggregatedSendResult
- type ChannelDeMultiplexer
- func (m *ChannelDeMultiplexer) AddChannel(predicate common.MessageAcceptor) <-chan interface{}
- func (m *ChannelDeMultiplexer) AddChannelWithMAC(predicate common.MessageAcceptor, mac []byte) <-chan interface{}
- func (m *ChannelDeMultiplexer) Close()
- func (m *ChannelDeMultiplexer) DeMultiplex(msg interface{})
- func (m *ChannelDeMultiplexer) Unregister(mac []byte)
- type ReceivedMessageImpl
- func (m *ReceivedMessageImpl) Ack(err error)
- func (m *ReceivedMessageImpl) GetConnectionInfo() *protos.ConnectionInfo
- func (m *ReceivedMessageImpl) GetRKSyncMessage() *protos.SignedRKSyncMessage
- func (m *ReceivedMessageImpl) GetSourceEnvelope() *protos.Envelope
- func (m *ReceivedMessageImpl) Respond(msg *protos.RKSyncMessage)
- type SendResult
- type Server
- func (s *Server) Accept(acceptor common.MessageAcceptor) <-chan protos.ReceivedMessage
- func (s *Server) CloseConn(peer *common.NetworkMember)
- func (s *Server) GetPKIid() common.PKIidType
- func (s *Server) Handshake(peer *common.NetworkMember) (common.PeerIdentityType, error)
- func (s *Server) Ping(context.Context, *types.Empty) (*types.Empty, error)
- func (s *Server) PresumedDead() <-chan common.PKIidType
- func (s *Server) Probe(remotePeer *common.NetworkMember) error
- func (s *Server) Send(msg *protos.SignedRKSyncMessage, peers ...*common.NetworkMember)
- func (s *Server) SendWithAck(msg *protos.SignedRKSyncMessage, timeout time.Duration, minAck int, ...) AggregatedSendResult
- func (s *Server) Stop()
- func (s *Server) SyncStream(stream protos.RKSync_SyncStreamServer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggregatedSendResult ¶
type AggregatedSendResult []SendResult
AggregatedSendResult represents a slice of SendResults
func (AggregatedSendResult) AckCount ¶
func (ar AggregatedSendResult) AckCount() int
AckCount returns the number of successful acknowledgements
func (AggregatedSendResult) NackCount ¶
func (ar AggregatedSendResult) NackCount() int
NackCount returns the number of unsuccessful acknowledgements
func (AggregatedSendResult) String ¶
func (ar AggregatedSendResult) String() string
String returns a JSONed string representation of the AggregatedSendResult
type ChannelDeMultiplexer ¶
type ChannelDeMultiplexer struct {
// contains filtered or unexported fields
}
ChannelDeMultiplexer is a struct that can receive channel registrations
func NewChannelDemultiplexer ¶
func NewChannelDemultiplexer() *ChannelDeMultiplexer
NewChannelDemultiplexer creates a new ChannelDeMultiplexer
func (*ChannelDeMultiplexer) AddChannel ¶
func (m *ChannelDeMultiplexer) AddChannel(predicate common.MessageAcceptor) <-chan interface{}
AddChannel registers a channel with a certain predicate
func (*ChannelDeMultiplexer) AddChannelWithMAC ¶
func (m *ChannelDeMultiplexer) AddChannelWithMAC(predicate common.MessageAcceptor, mac []byte) <-chan interface{}
AddChannelWithMAC registers a channel with a certain predicate and a byte slice
func (*ChannelDeMultiplexer) Close ¶
func (m *ChannelDeMultiplexer) Close()
Close closes this channel, which makes all channels registered before to close as well
func (*ChannelDeMultiplexer) DeMultiplex ¶
func (m *ChannelDeMultiplexer) DeMultiplex(msg interface{})
DeMultiplex broadcasts the message to all channels that were returned by AddChannel calls and that hold the respected predicates.
func (*ChannelDeMultiplexer) Unregister ¶
func (m *ChannelDeMultiplexer) Unregister(mac []byte)
Unregister closes a channel with a certain predicate
type ReceivedMessageImpl ¶
type ReceivedMessageImpl struct { *protos.SignedRKSyncMessage // contains filtered or unexported fields }
ReceivedMessageImpl is an implementation of ReceiveMessage
func (*ReceivedMessageImpl) Ack ¶
func (m *ReceivedMessageImpl) Ack(err error)
Ack returns to the sender an acknowledgement for the message
func (*ReceivedMessageImpl) GetConnectionInfo ¶
func (m *ReceivedMessageImpl) GetConnectionInfo() *protos.ConnectionInfo
GetConnectionInfo returns information about the remote peer
func (*ReceivedMessageImpl) GetRKSyncMessage ¶
func (m *ReceivedMessageImpl) GetRKSyncMessage() *protos.SignedRKSyncMessage
GetRKSyncMessage returns the inner RKSyncMessage
func (*ReceivedMessageImpl) GetSourceEnvelope ¶
func (m *ReceivedMessageImpl) GetSourceEnvelope() *protos.Envelope
GetSourceEnvelope returns the Envelope the ReceiveMessage was constructed with
func (*ReceivedMessageImpl) Respond ¶
func (m *ReceivedMessageImpl) Respond(msg *protos.RKSyncMessage)
Respond sends a msg to the source that sent the ReceiveMessage
type SendResult ¶
type SendResult struct { common.NetworkMember // contains filtered or unexported fields }
SendResult defines a result of a send to a remote peer
func (SendResult) Error ¶
func (sr SendResult) Error() string
Error returns the error of the SendResult, or an empty string if an error hasn't occurred
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is an object that enables to communicate with other peers
func NewServer ¶
func NewServer(s *grpc.Server, idMapper identity.Identity, selfIdentity common.PeerIdentityType, secureDialOpts func() []grpc.DialOption) *Server
NewServer creates a new Server instance that binds itself to the given gRPC server
func (*Server) Accept ¶
func (s *Server) Accept(acceptor common.MessageAcceptor) <-chan protos.ReceivedMessage
Accept returns a dedicated read-only channel for messages sent by other nodes that match a certain predicate.
func (*Server) CloseConn ¶
func (s *Server) CloseConn(peer *common.NetworkMember)
CloseConn closes a connection to a certain endpoint
func (*Server) Handshake ¶
func (s *Server) Handshake(peer *common.NetworkMember) (common.PeerIdentityType, error)
Handshake authenticates a remote peer and returns (its identity, nil) on success and (nil, error)
func (*Server) PresumedDead ¶
PresumedDead returns a read-only channel for node endpoints that are suspected to be offline
func (*Server) Probe ¶
func (s *Server) Probe(remotePeer *common.NetworkMember) error
Probe probes a remote node and returns nil if its responsive, and an error if it's not
func (*Server) Send ¶
func (s *Server) Send(msg *protos.SignedRKSyncMessage, peers ...*common.NetworkMember)
Send sends a message to remote peers
func (*Server) SendWithAck ¶
func (s *Server) SendWithAck(msg *protos.SignedRKSyncMessage, timeout time.Duration, minAck int, peers ...*common.NetworkMember) AggregatedSendResult
SendWithAck sends a message to remote peers, waiting for acknowledgement from minAck of them, or until a certain timeout expires
func (*Server) SyncStream ¶
func (s *Server) SyncStream(stream protos.RKSync_SyncStreamServer) error
SyncStream is the gRPC stream used for sending and receiving messages