rpc

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 25, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

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) GetPKIid

func (s *Server) GetPKIid() common.PKIidType

GetPKIid returns this instance's PKI id

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) Ping

func (s *Server) Ping(context.Context, *types.Empty) (*types.Empty, error)

Ping is used to probe a remote peer's aliveness

func (*Server) PresumedDead

func (s *Server) PresumedDead() <-chan common.PKIidType

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) Stop

func (s *Server) Stop()

Stop stop the server

func (*Server) SyncStream

func (s *Server) SyncStream(stream protos.RKSync_SyncStreamServer) error

SyncStream is the gRPC stream used for sending and receiving messages

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL