dev

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const LevelNotSet = -1

LevelNotSet is the zero value level used to indicate that no level (and thereby no reply) has been set for a correctable quorum call.

Variables

View Source
var Error = func(n1, n2 *Node) bool {
	if n1.lastErr != nil && n2.lastErr == nil {
		return false
	}
	return true
}

Error sorts nodes by their LastErr() status in increasing order. A node with LastErr() != nil is larger than a node with LastErr() == nil.

View Source
var File_zorums_proto protoreflect.FileDescriptor
View Source
var ID = func(n1, n2 *Node) bool {
	return n1.id < n2.id
}

ID sorts nodes by their identifier in increasing order.

View Source
var Latency = func(n1, n2 *Node) bool {
	if n1.latency < 0 {
		return false
	}
	return n1.latency < n2.latency
}

Latency sorts nodes by latency in increasing order. Latencies less then zero (sentinel value) are considered greater than any positive latency.

View Source
var Port = func(n1, n2 *Node) bool {
	p1, _ := strconv.Atoi(n1.Port())
	p2, _ := strconv.Atoi(n2.Port())
	return p1 < p2
}

Port sorts nodes by their port number in increasing order. Warning: This function may be removed in the future.

Functions

func Equal

func Equal(a, b *Configuration) bool

Equal returns a boolean reporting whether a and b represents the same configuration.

func ManagerCreationError

func ManagerCreationError(err error) error

ManagerCreationError returns an error reporting that a Manager could not be created due to err.

func RegisterZorumsServiceServer

func RegisterZorumsServiceServer(s *grpc.Server, srv ZorumsServiceServer)

Types

type ConfigNotFoundError

type ConfigNotFoundError uint32

A ConfigNotFoundError reports that a specified configuration could not be found.

func (ConfigNotFoundError) Error

func (e ConfigNotFoundError) Error() string

type Configuration

type Configuration struct {
	// contains filtered or unexported fields
}

A Configuration represents a static set of nodes on which quorum remote procedure calls may be invoked.

func NewConfig

func NewConfig(addrs []string, qspec QuorumSpec, opts ...ManagerOption) (*Configuration, func(), error)

NewConfig returns a configuration for the given node addresses and quorum spec. The returned func() must be called to close the underlying connections. This is experimental API.

func (*Configuration) Correctable

func (c *Configuration) Correctable(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableResponse

Correctable plain.

func (*Configuration) CorrectableCombo

func (c *Configuration) CorrectableCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *CorrectableMyResponse

CorrectableCombo with all supported options.

func (*Configuration) CorrectableCustomReturnType

func (c *Configuration) CorrectableCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableMyResponse

CorrectableCustomReturnType with custom_return_type option.

func (*Configuration) CorrectableEmpty

func (c *Configuration) CorrectableEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableEmpty

CorrectableEmpty for testing imported message type.

func (*Configuration) CorrectableEmpty2

func (c *Configuration) CorrectableEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) *CorrectableResponse

CorrectableEmpty2 for testing imported message type; with same return type as Correctable: Response.

func (*Configuration) CorrectablePerNodeArg

func (c *Configuration) CorrectablePerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *CorrectableResponse

CorrectablePerNodeArg with per_node_arg option.

func (*Configuration) CorrectableStream

func (c *Configuration) CorrectableStream(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableStreamResponse

CorrectableStream plain.

func (*Configuration) CorrectableStreamCombo

func (c *Configuration) CorrectableStreamCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *CorrectableStreamMyResponse

CorrectableCombo with all supported options.

func (*Configuration) CorrectableStreamCustomReturnType

func (c *Configuration) CorrectableStreamCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableStreamMyResponse

CorrectableCustomReturnType with custom_return_type option.

func (*Configuration) CorrectableStreamEmpty

func (c *Configuration) CorrectableStreamEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) *CorrectableStreamEmpty

CorrectableEmpty for testing imported message type.

func (*Configuration) CorrectableStreamEmpty2

func (c *Configuration) CorrectableStreamEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) *CorrectableStreamResponse

CorrectableEmpty2 for testing imported message type; with same return type as Correctable: Response.

func (*Configuration) CorrectableStreamPerNodeArg

func (c *Configuration) CorrectableStreamPerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *CorrectableStreamResponse

CorrectablePerNodeArg with per_node_arg option.

func (*Configuration) ID

func (c *Configuration) ID() uint32

ID reports the identifier for the configuration.

func (*Configuration) Multicast

func (c *Configuration) Multicast(in *Request) error

Multicast plain. Response type is not needed here.

func (*Configuration) Multicast2

func (c *Configuration) Multicast2(in *Request) error

Multicast2 is testing whether multiple streams work.

func (*Configuration) Multicast3

func (c *Configuration) Multicast3(in *Request) error

Multicast3 is testing imported message type.

func (*Configuration) Multicast4

func (c *Configuration) Multicast4(in *empty.Empty) error

Multicast4 is testing imported message type.

func (*Configuration) MulticastConcurrent

func (c *Configuration) MulticastConcurrent(in *Request) error

MutlicastConcurrent uses a concurrent server-side handler

func (*Configuration) MulticastPerNodeArg

func (c *Configuration) MulticastPerNodeArg(in *Request, f func(*Request, uint32) *Request) error

MulticastPerNodeArg with per_node_arg option. TODO(meling) currently this is not supported, but compiles as if per_node_arg wasn't specified. Need to implement support.

func (*Configuration) NodeIDs

func (c *Configuration) NodeIDs() []uint32

NodeIDs returns a slice containing the local ids of all the nodes in the configuration. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) Nodes

func (c *Configuration) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Configuration.

func (*Configuration) OrderingCombo

func (c *Configuration) OrderingCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request) (resp *MyResponse, err error)

OrderingCombo is a quorum call invoked on each node in configuration c, with the argument returned by the provided function f, and returns the combined result. The per node function f receives a copy of the Request request argument and returns a Request manipulated to be passed to the given nodeID. The function f must be thread-safe.

func (*Configuration) OrderingConcurrent

func (c *Configuration) OrderingConcurrent(ctx context.Context, in *Request) (resp *Response, err error)

OrderingConcurrent is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) OrderingCustomReturnType

func (c *Configuration) OrderingCustomReturnType(ctx context.Context, in *Request) (resp *MyResponse, err error)

OrderingCustomReturnType is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) OrderingFuture

func (c *Configuration) OrderingFuture(ctx context.Context, in *Request) *FutureResponse

OrderingFuture asynchronously invokes a quorum call on configuration c and returns a FutureResponse, which can be used to inspect the quorum call reply and error when available.

func (*Configuration) OrderingFutureCombo

func (c *Configuration) OrderingFutureCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request) *FutureMyResponse

OrderingFutureCombo asynchronously invokes a quorum call on each node in configuration c, with the argument returned by the provided function f and returns the result as a FutureMyResponse, which can be used to inspect the quorum call reply and error when available. The provide per node function f takes the provided Request argument and returns an Response object to be passed to the given nodeID. The per node function f should be thread-safe.

func (*Configuration) OrderingFutureConcurrent

func (c *Configuration) OrderingFutureConcurrent(ctx context.Context, in *Request) *FutureResponse

OrderingFutureConcurrent asynchronously invokes a quorum call on configuration c and returns a FutureResponse, which can be used to inspect the quorum call reply and error when available.

func (*Configuration) OrderingFutureCustomReturnType

func (c *Configuration) OrderingFutureCustomReturnType(ctx context.Context, in *Request) *FutureMyResponse

OrderingFutureCustomReturnType asynchronously invokes a quorum call on configuration c and returns a FutureMyResponse, which can be used to inspect the quorum call reply and error when available.

func (*Configuration) OrderingFuturePerNodeArg

func (c *Configuration) OrderingFuturePerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request) *FutureResponse

OrderingFuturePerNodeArg asynchronously invokes a quorum call on each node in configuration c, with the argument returned by the provided function f and returns the result as a FutureResponse, which can be used to inspect the quorum call reply and error when available. The provide per node function f takes the provided Request argument and returns an Response object to be passed to the given nodeID. The per node function f should be thread-safe.

func (*Configuration) OrderingPerNodeArg

func (c *Configuration) OrderingPerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request) (resp *Response, err error)

OrderingPerNodeArg is a quorum call invoked on each node in configuration c, with the argument returned by the provided function f, and returns the combined result. The per node function f receives a copy of the Request request argument and returns a Request manipulated to be passed to the given nodeID. The function f must be thread-safe.

func (*Configuration) OrderingQC

func (c *Configuration) OrderingQC(ctx context.Context, in *Request) (resp *Response, err error)

OrderingQC is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.

func (*Configuration) QuorumCall

func (c *Configuration) QuorumCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (resp *Response, err error)

QuorumCall plain.

func (*Configuration) QuorumCallCombo

func (c *Configuration) QuorumCallCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) (resp *MyResponse, err error)

QuorumCallCombo with all supported options.

func (*Configuration) QuorumCallCustomReturnType

func (c *Configuration) QuorumCallCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (resp *MyResponse, err error)

QuorumCall with custom_return_type option.

func (*Configuration) QuorumCallEmpty

func (c *Configuration) QuorumCallEmpty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (resp *Response, err error)

QuorumCallEmpty for testing imported message type.

func (*Configuration) QuorumCallEmpty2

func (c *Configuration) QuorumCallEmpty2(ctx context.Context, in *Request, opts ...grpc.CallOption) (resp *empty.Empty, err error)

QuorumCallEmpty2 for testing imported message type.

func (*Configuration) QuorumCallFuture

func (c *Configuration) QuorumCallFuture(ctx context.Context, in *Request, opts ...grpc.CallOption) *FutureResponse

QuorumCallFuture plain.

func (*Configuration) QuorumCallFuture2

func (c *Configuration) QuorumCallFuture2(ctx context.Context, in *Request, opts ...grpc.CallOption) *FutureResponse

QuorumCallFuture2 plain; with same return type: Response.

func (*Configuration) QuorumCallFutureCombo

func (c *Configuration) QuorumCallFutureCombo(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *FutureMyResponse

QuorumCallFutureCombo with all supported options.

func (*Configuration) QuorumCallFutureCustomReturnType

func (c *Configuration) QuorumCallFutureCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) *FutureMyResponse

QuorumCallFutureCustomReturnType with custom_return_type option.

func (*Configuration) QuorumCallFutureEmpty

func (c *Configuration) QuorumCallFutureEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) *FutureEmpty

QuorumCallFutureEmpty for testing imported message type.

func (*Configuration) QuorumCallFutureEmpty2

func (c *Configuration) QuorumCallFutureEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) *FutureResponse

QuorumCallFutureEmpty2 for testing imported message type; with same return type as QuorumCallFuture: Response.

func (*Configuration) QuorumCallFuturePerNodeArg

func (c *Configuration) QuorumCallFuturePerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) *FutureResponse

QuorumCallFuturePerNodeArg with per_node_arg option.

func (*Configuration) QuorumCallPerNodeArg

func (c *Configuration) QuorumCallPerNodeArg(ctx context.Context, in *Request, f func(*Request, uint32) *Request, opts ...grpc.CallOption) (resp *Response, err error)

QuorumCall with per_node_arg option.

func (*Configuration) Size

func (c *Configuration) Size() int

Size returns the number of nodes in the configuration.

func (*Configuration) String

func (c *Configuration) String() string

func (*Configuration) SubError

func (c *Configuration) SubError() <-chan GRPCError

SubError returns a channel for listening to individual node errors. Currently only a single listener is supported.

type CorrectableEmpty

type CorrectableEmpty struct {

	// the actual reply
	*empty.Empty
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableEmpty is a correctable object for processing replies.

func (*CorrectableEmpty) Done

func (c *CorrectableEmpty) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableEmpty) Get

func (c *CorrectableEmpty) Get() (*empty.Empty, int, error)

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableEmpty) Watch

func (c *CorrectableEmpty) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type CorrectableMyResponse

type CorrectableMyResponse struct {

	// the actual reply
	*MyResponse
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableMyResponse is a correctable object for processing replies.

func (*CorrectableMyResponse) Done

func (c *CorrectableMyResponse) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableMyResponse) Get

func (c *CorrectableMyResponse) Get() (*MyResponse, int, error)

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableMyResponse) Watch

func (c *CorrectableMyResponse) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type CorrectableResponse

type CorrectableResponse struct {

	// the actual reply
	*Response
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableResponse is a correctable object for processing replies.

func (*CorrectableResponse) Done

func (c *CorrectableResponse) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableResponse) Get

func (c *CorrectableResponse) Get() (*Response, int, error)

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableResponse) Watch

func (c *CorrectableResponse) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type CorrectableStreamEmpty

type CorrectableStreamEmpty struct {

	// the actual reply
	*empty.Empty
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableStreamEmpty is a correctable object for processing replies.

func (*CorrectableStreamEmpty) Done

func (c *CorrectableStreamEmpty) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableStreamEmpty) Get

func (c *CorrectableStreamEmpty) Get() (*empty.Empty, int, error)

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableStreamEmpty) Watch

func (c *CorrectableStreamEmpty) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type CorrectableStreamMyResponse

type CorrectableStreamMyResponse struct {

	// the actual reply
	*MyResponse
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableStreamMyResponse is a correctable object for processing replies.

func (*CorrectableStreamMyResponse) Done

func (c *CorrectableStreamMyResponse) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableStreamMyResponse) Get

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableStreamMyResponse) Watch

func (c *CorrectableStreamMyResponse) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type CorrectableStreamResponse

type CorrectableStreamResponse struct {

	// the actual reply
	*Response
	NodeIDs []uint32
	// contains filtered or unexported fields
}

CorrectableStreamResponse is a correctable object for processing replies.

func (*CorrectableStreamResponse) Done

func (c *CorrectableStreamResponse) Done() <-chan struct{}

Done returns a channel that will be closed when the correctable quorum call is done. A call is considered done when the quorum function has signaled that a quorum of replies was received or the call returned an error.

func (*CorrectableStreamResponse) Get

Get returns the reply, level and any error associated with the called method. The method does not block until a (possibly intermediate) reply or error is available. Level is set to LevelNotSet if no reply has yet been received. The Done or Watch methods should be used to ensure that a reply is available.

func (*CorrectableStreamResponse) Watch

func (c *CorrectableStreamResponse) Watch(level int) <-chan struct{}

Watch returns a channel that will be closed when a reply or error at or above the specified level is available. If the call is done, the channel is closed regardless of the specified level.

type FutureEmpty

type FutureEmpty struct {
	// the actual reply
	*empty.Empty
	NodeIDs []uint32
	// contains filtered or unexported fields
}

FutureEmpty is a future object for processing replies.

func (*FutureEmpty) Done

func (f *FutureEmpty) Done() bool

Done reports if a reply and/or error is available for the called method.

func (*FutureEmpty) Get

func (f *FutureEmpty) Get() (*empty.Empty, error)

Get returns the reply and any error associated with the called method. The method blocks until a reply or error is available.

type FutureMyResponse

type FutureMyResponse struct {
	// the actual reply
	*MyResponse
	NodeIDs []uint32
	// contains filtered or unexported fields
}

FutureMyResponse is a future object for processing replies.

func (*FutureMyResponse) Done

func (f *FutureMyResponse) Done() bool

Done reports if a reply and/or error is available for the called method.

func (*FutureMyResponse) Get

func (f *FutureMyResponse) Get() (*MyResponse, error)

Get returns the reply and any error associated with the called method. The method blocks until a reply or error is available.

type FutureResponse

type FutureResponse struct {
	// the actual reply
	*Response
	NodeIDs []uint32
	// contains filtered or unexported fields
}

FutureResponse is a future object for processing replies.

func (*FutureResponse) Done

func (f *FutureResponse) Done() bool

Done reports if a reply and/or error is available for the called method.

func (*FutureResponse) Get

func (f *FutureResponse) Get() (*Response, error)

Get returns the reply and any error associated with the called method. The method blocks until a reply or error is available.

type GRPCError

type GRPCError struct {
	NodeID uint32
	Cause  error
}

GRPCError is used to report that a single gRPC call failed.

func (GRPCError) Error

func (e GRPCError) Error() string

type GorumsServer

type GorumsServer struct {
	// contains filtered or unexported fields
}

GorumsServer serves all ordering based RPCs using registered handlers.

func NewGorumsServer

func NewGorumsServer(opts ...ServerOption) *GorumsServer

NewGorumsServer returns a new instance of GorumsServer.

func (*GorumsServer) GracefulStop

func (s *GorumsServer) GracefulStop()

GracefulStop waits for all RPCs to finish before stopping.

func (*GorumsServer) RegisterZorumsServiceServer

func (s *GorumsServer) RegisterZorumsServiceServer(srv ZorumsService)

func (*GorumsServer) Serve

func (s *GorumsServer) Serve(listener net.Listener) error

Serve starts serving on the listener.

func (*GorumsServer) Stop

func (s *GorumsServer) Stop()

Stop stops the server immediately.

type IllegalConfigError

type IllegalConfigError string

An IllegalConfigError reports that a specified configuration could not be created.

func (IllegalConfigError) Error

func (e IllegalConfigError) Error() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages a pool of node configurations on which quorum remote procedure calls can be made.

func NewManager

func NewManager(nodeAddrs []string, opts ...ManagerOption) (*Manager, error)

NewManager attempts to connect to the given set of node addresses and if successful returns a new Manager containing connections to those nodes.

func (*Manager) AddNode

func (m *Manager) AddNode(addr string) error

AddNode attempts to dial to the provide node address. The node is added to the Manager's pool of nodes if a connection was established.

func (*Manager) Close

func (m *Manager) Close()

Close closes all node connections and any client streams.

func (*Manager) Configuration

func (m *Manager) Configuration(id uint32) (config *Configuration, found bool)

Configuration returns the configuration with the given global identifier if present.

func (*Manager) ConfigurationIDs

func (m *Manager) ConfigurationIDs() []uint32

ConfigurationIDs returns the identifier of each available configuration.

func (*Manager) Configurations

func (m *Manager) Configurations() []*Configuration

Configurations returns a slice of each available configuration.

func (*Manager) NewConfiguration

func (m *Manager) NewConfiguration(ids []uint32, qspec QuorumSpec) (*Configuration, error)

NewConfiguration returns a new configuration given quorum specification and a timeout.

func (*Manager) Node

func (m *Manager) Node(id uint32) (node *Node, found bool)

Node returns the node with the given identifier if present.

func (*Manager) NodeIDs

func (m *Manager) NodeIDs() []uint32

NodeIDs returns the identifier of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Nodes

func (m *Manager) Nodes() []*Node

Nodes returns a slice of each available node. IDs are returned in the same order as they were provided in the creation of the Manager.

func (*Manager) Size

func (m *Manager) Size() (nodes, configs int)

Size returns the number of nodes and configurations in the Manager.

type ManagerOption

type ManagerOption func(*managerOptions)

ManagerOption provides a way to set different options on a new Manager.

func WithBackoff

func WithBackoff(backoff backoff.Config) ManagerOption

WithBackoff allows for changing the backoff delays used by Gorums.

func WithDialTimeout

func WithDialTimeout(timeout time.Duration) ManagerOption

WithDialTimeout returns a ManagerOption which is used to set the dial context timeout to be used when initially connecting to each node in its pool.

func WithGrpcDialOptions

func WithGrpcDialOptions(opts ...grpc.DialOption) ManagerOption

WithGrpcDialOptions returns a ManagerOption which sets any gRPC dial options the Manager should use when initially connecting to each node in its pool.

func WithLogger

func WithLogger(logger *log.Logger) ManagerOption

WithLogger returns a ManagerOption which sets an optional error logger for the Manager.

func WithNoConnect

func WithNoConnect() ManagerOption

WithNoConnect returns a ManagerOption which instructs the Manager not to connect to any of its nodes. Mainly used for testing purposes.

func WithSendBufferSize

func WithSendBufferSize(size uint) ManagerOption

WithSendBufferSize allows for changing the size of the send buffer used by Gorums. A larger buffer might achieve higher throughput for asynchronous calltypes, but at the cost of latency.

func WithTracing

func WithTracing() ManagerOption

WithTracing controls whether to trace quorum calls for this Manager instance using the golang.org/x/net/trace package. Tracing is currently only supported for regular quorum calls.

type MultiSorter

type MultiSorter struct {
	// contains filtered or unexported fields
}

MultiSorter implements the Sort interface, sorting the nodes within.

func OrderedBy

func OrderedBy(less ...lessFunc) *MultiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func (*MultiSorter) Len

func (ms *MultiSorter) Len() int

Len is part of sort.Interface.

func (*MultiSorter) Less

func (ms *MultiSorter) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by looping along the less functions until it finds a comparison that is either Less or !Less. Note that it can call the less functions twice per call. We could change the functions to return -1, 0, 1 and reduce the number of calls for greater efficiency: an exercise for the reader.

func (*MultiSorter) Sort

func (ms *MultiSorter) Sort(nodes []*Node)

Sort sorts the argument slice according to the less functions passed to OrderedBy.

func (*MultiSorter) Swap

func (ms *MultiSorter) Swap(i, j int)

Swap is part of sort.Interface.

type MyResponse

type MyResponse struct {
	Value string `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*MyResponse) Descriptor deprecated

func (*MyResponse) Descriptor() ([]byte, []int)

Deprecated: Use MyResponse.ProtoReflect.Descriptor instead.

func (*MyResponse) GetValue

func (x *MyResponse) GetValue() string

func (*MyResponse) ProtoMessage

func (*MyResponse) ProtoMessage()

func (*MyResponse) ProtoReflect

func (x *MyResponse) ProtoReflect() protoreflect.Message

func (*MyResponse) Reset

func (x *MyResponse) Reset()

func (*MyResponse) String

func (x *MyResponse) String() string

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node encapsulates the state of a node on which a remote procedure call can be performed.

func (*Node) Address

func (n *Node) Address() string

Address returns network address of n.

func (*Node) Correctable

func (n *Node) Correctable(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableCombo

func (n *Node) CorrectableCombo(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableCustomReturnType

func (n *Node) CorrectableCustomReturnType(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableEmpty

func (n *Node) CorrectableEmpty(ctx context.Context, in *Request, replyChan chan<- internalEmpty)

func (*Node) CorrectableEmpty2

func (n *Node) CorrectableEmpty2(ctx context.Context, in *empty.Empty, replyChan chan<- internalResponse)

func (*Node) CorrectablePerNodeArg

func (n *Node) CorrectablePerNodeArg(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableStream

func (n *Node) CorrectableStream(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableStreamCombo

func (n *Node) CorrectableStreamCombo(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableStreamCustomReturnType

func (n *Node) CorrectableStreamCustomReturnType(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) CorrectableStreamEmpty

func (n *Node) CorrectableStreamEmpty(ctx context.Context, in *Request, replyChan chan<- internalEmpty)

func (*Node) CorrectableStreamEmpty2

func (n *Node) CorrectableStreamEmpty2(ctx context.Context, in *empty.Empty, replyChan chan<- internalResponse)

func (*Node) CorrectableStreamPerNodeArg

func (n *Node) CorrectableStreamPerNodeArg(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) FullString

func (n *Node) FullString() string

FullString returns a more descriptive string representation of n that includes id, network address and latency information.

func (*Node) ID

func (n *Node) ID() uint32

ID returns the ID of n.

func (*Node) LastErr

func (n *Node) LastErr() error

LastErr returns the last error encountered (if any) when invoking a remote procedure call on this node.

func (*Node) Latency

func (n *Node) Latency() time.Duration

Latency returns the latency of the last successful remote procedure call made to this node.

func (*Node) OrderingUnaryRPC

func (n *Node) OrderingUnaryRPC(ctx context.Context, in *Request, opts ...grpc.CallOption) (resp *Response, err error)

OrderingUnaryRPC is testing that we can create ordered Unary RPCs

func (*Node) OrderingUnaryRPCConcurrent

func (n *Node) OrderingUnaryRPCConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (resp *Response, err error)

OrderingUnaryRPC is testing that we can create ordered Unary RPCs with concurrent handlers

func (*Node) Port

func (n *Node) Port() string

Port returns network port of n.

func (*Node) QuorumCall

func (n *Node) QuorumCall(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallCombo

func (n *Node) QuorumCallCombo(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallCustomReturnType

func (n *Node) QuorumCallCustomReturnType(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallEmpty

func (n *Node) QuorumCallEmpty(ctx context.Context, in *empty.Empty, replyChan chan<- internalResponse)

func (*Node) QuorumCallEmpty2

func (n *Node) QuorumCallEmpty2(ctx context.Context, in *Request, replyChan chan<- internalEmpty)

func (*Node) QuorumCallFuture

func (n *Node) QuorumCallFuture(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallFuture2

func (n *Node) QuorumCallFuture2(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallFutureCombo

func (n *Node) QuorumCallFutureCombo(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallFutureCustomReturnType

func (n *Node) QuorumCallFutureCustomReturnType(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallFutureEmpty

func (n *Node) QuorumCallFutureEmpty(ctx context.Context, in *Request, replyChan chan<- internalEmpty)

func (*Node) QuorumCallFutureEmpty2

func (n *Node) QuorumCallFutureEmpty2(ctx context.Context, in *empty.Empty, replyChan chan<- internalResponse)

func (*Node) QuorumCallFuturePerNodeArg

func (n *Node) QuorumCallFuturePerNodeArg(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) QuorumCallPerNodeArg

func (n *Node) QuorumCallPerNodeArg(ctx context.Context, in *Request, replyChan chan<- internalResponse)

func (*Node) String

func (n *Node) String() string

func (*Node) Unicast

func (n *Node) Unicast(in *Request) error

func (*Node) Unicast2

func (n *Node) Unicast2(in *Request) error

func (*Node) UnicastConcurrent

func (n *Node) UnicastConcurrent(in *Request) error

type NodeNotFoundError

type NodeNotFoundError uint32

A NodeNotFoundError reports that a specified node could not be found.

func (NodeNotFoundError) Error

func (e NodeNotFoundError) Error() string

type QuorumCallError

type QuorumCallError struct {
	Reason     string
	ReplyCount int
	Errors     []GRPCError
}

A QuorumCallError is used to report that a quorum call failed.

func (QuorumCallError) Error

func (e QuorumCallError) Error() string

type QuorumSpec

type QuorumSpec interface {

	// QuorumCallQF is the quorum function for the QuorumCall
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCall method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallQF(in *Request, replies []*Response) (*Response, bool)

	// QuorumCallPerNodeArgQF is the quorum function for the QuorumCallPerNodeArg
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCallPerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallPerNodeArgQF(in *Request, replies []*Response) (*Response, bool)

	// QuorumCallCustomReturnTypeQF is the quorum function for the QuorumCallCustomReturnType
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCallCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, bool)

	// QuorumCallComboQF is the quorum function for the QuorumCallCombo
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCallCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallComboQF(in *Request, replies []*Response) (*MyResponse, bool)

	// QuorumCallEmptyQF is the quorum function for the QuorumCallEmpty
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCallEmpty method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *empty.Empty'.
	QuorumCallEmptyQF(in *empty.Empty, replies []*Response) (*Response, bool)

	// QuorumCallEmpty2QF is the quorum function for the QuorumCallEmpty2
	// quorum call method. The in parameter is the request object
	// supplied to the QuorumCallEmpty2 method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallEmpty2QF(in *Request, replies []*empty.Empty) (*empty.Empty, bool)

	// QuorumCallFutureQF is the quorum function for the QuorumCallFuture
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFuture method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFutureQF(in *Request, replies []*Response) (*Response, bool)

	// QuorumCallFuturePerNodeArgQF is the quorum function for the QuorumCallFuturePerNodeArg
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFuturePerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFuturePerNodeArgQF(in *Request, replies []*Response) (*Response, bool)

	// QuorumCallFutureCustomReturnTypeQF is the quorum function for the QuorumCallFutureCustomReturnType
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFutureCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFutureCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, bool)

	// QuorumCallFutureComboQF is the quorum function for the QuorumCallFutureCombo
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFutureCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFutureComboQF(in *Request, replies []*Response) (*MyResponse, bool)

	// QuorumCallFuture2QF is the quorum function for the QuorumCallFuture2
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFuture2 method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFuture2QF(in *Request, replies []*Response) (*Response, bool)

	// QuorumCallFutureEmptyQF is the quorum function for the QuorumCallFutureEmpty
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFutureEmpty method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	QuorumCallFutureEmptyQF(in *Request, replies []*empty.Empty) (*empty.Empty, bool)

	// QuorumCallFutureEmpty2QF is the quorum function for the QuorumCallFutureEmpty2
	// asynchronous quorum call method. The in parameter is the request object
	// supplied to the QuorumCallFutureEmpty2 method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *empty.Empty'.
	QuorumCallFutureEmpty2QF(in *empty.Empty, replies []*Response) (*Response, bool)

	// CorrectableQF is the quorum function for the Correctable
	// correctable quorum call method. The in parameter is the request object
	// supplied to the Correctable method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableQF(in *Request, replies []*Response) (*Response, int, bool)

	// CorrectablePerNodeArgQF is the quorum function for the CorrectablePerNodeArg
	// correctable quorum call method. The in parameter is the request object
	// supplied to the CorrectablePerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectablePerNodeArgQF(in *Request, replies []*Response) (*Response, int, bool)

	// CorrectableCustomReturnTypeQF is the quorum function for the CorrectableCustomReturnType
	// correctable quorum call method. The in parameter is the request object
	// supplied to the CorrectableCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, int, bool)

	// CorrectableComboQF is the quorum function for the CorrectableCombo
	// correctable quorum call method. The in parameter is the request object
	// supplied to the CorrectableCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableComboQF(in *Request, replies []*Response) (*MyResponse, int, bool)

	// CorrectableEmptyQF is the quorum function for the CorrectableEmpty
	// correctable quorum call method. The in parameter is the request object
	// supplied to the CorrectableEmpty method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableEmptyQF(in *Request, replies []*empty.Empty) (*empty.Empty, int, bool)

	// CorrectableEmpty2QF is the quorum function for the CorrectableEmpty2
	// correctable quorum call method. The in parameter is the request object
	// supplied to the CorrectableEmpty2 method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *empty.Empty'.
	CorrectableEmpty2QF(in *empty.Empty, replies []*Response) (*Response, int, bool)

	// CorrectableStreamQF is the quorum function for the CorrectableStream
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStream method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableStreamQF(in *Request, replies []*Response) (*Response, int, bool)

	// CorrectableStreamPerNodeArgQF is the quorum function for the CorrectableStreamPerNodeArg
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStreamPerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableStreamPerNodeArgQF(in *Request, replies []*Response) (*Response, int, bool)

	// CorrectableStreamCustomReturnTypeQF is the quorum function for the CorrectableStreamCustomReturnType
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStreamCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableStreamCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, int, bool)

	// CorrectableStreamComboQF is the quorum function for the CorrectableStreamCombo
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStreamCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableStreamComboQF(in *Request, replies []*Response) (*MyResponse, int, bool)

	// CorrectableStreamEmptyQF is the quorum function for the CorrectableStreamEmpty
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStreamEmpty method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	CorrectableStreamEmptyQF(in *Request, replies []*empty.Empty) (*empty.Empty, int, bool)

	// CorrectableStreamEmpty2QF is the quorum function for the CorrectableStreamEmpty2
	// correctable stream quorum call method. The in parameter is the request object
	// supplied to the CorrectableStreamEmpty2 method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *empty.Empty'.
	CorrectableStreamEmpty2QF(in *empty.Empty, replies []*Response) (*Response, int, bool)

	// OrderingQCQF is the quorum function for the OrderingQC
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingQC method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingQCQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingPerNodeArgQF is the quorum function for the OrderingPerNodeArg
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingPerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingPerNodeArgQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingCustomReturnTypeQF is the quorum function for the OrderingCustomReturnType
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, bool)

	// OrderingComboQF is the quorum function for the OrderingCombo
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingComboQF(in *Request, replies []*Response) (*MyResponse, bool)

	// OrderingConcurrentQF is the quorum function for the OrderingConcurrent
	// ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingConcurrent method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingConcurrentQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingFutureQF is the quorum function for the OrderingFuture
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingFuture method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingFutureQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingFuturePerNodeArgQF is the quorum function for the OrderingFuturePerNodeArg
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingFuturePerNodeArg method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingFuturePerNodeArgQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingFutureCustomReturnTypeQF is the quorum function for the OrderingFutureCustomReturnType
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingFutureCustomReturnType method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingFutureCustomReturnTypeQF(in *Request, replies []*Response) (*MyResponse, bool)

	// OrderingFutureConcurrentQF is the quorum function for the OrderingFutureConcurrent
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingFutureConcurrent method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingFutureConcurrentQF(in *Request, replies []*Response) (*Response, bool)

	// OrderingFutureComboQF is the quorum function for the OrderingFutureCombo
	// asynchronous ordered quorum call method. The in parameter is the request object
	// supplied to the OrderingFutureCombo method at call time, and may or may not
	// be used by the quorum function. If the in parameter is not needed
	// you should implement your quorum function with '_ *Request'.
	OrderingFutureComboQF(in *Request, replies []*Response) (*MyResponse, bool)
}

QuorumSpec is the interface of quorum functions for ZorumsService.

type Request

type Request struct {
	Value string `protobuf:"bytes,1,opt,name=Value,proto3" json:"Value,omitempty"`
	// contains filtered or unexported fields
}

func (*Request) Descriptor deprecated

func (*Request) Descriptor() ([]byte, []int)

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetValue

func (x *Request) GetValue() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

func (x *Request) ProtoReflect() protoreflect.Message

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Result int64 `protobuf:"varint,1,opt,name=Result,proto3" json:"Result,omitempty"`
	// contains filtered or unexported fields
}

func (*Response) Descriptor deprecated

func (*Response) Descriptor() ([]byte, []int)

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetResult

func (x *Response) GetResult() int64

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

func (x *Response) ProtoReflect() protoreflect.Message

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type ServerOption

type ServerOption func(*serverOptions)

ServerOption is used to change settings for the GorumsServer

func WithGRPCServerOptions

func WithGRPCServerOptions(opts ...grpc.ServerOption) ServerOption

func WithServerBufferSize

func WithServerBufferSize(size uint) ServerOption

WithServerBufferSize sets the buffer size for the server. A larger buffer may result in higher throughput at the cost of higher latency.

type UnimplementedZorumsServiceServer

type UnimplementedZorumsServiceServer struct {
}

UnimplementedZorumsServiceServer must be embedded to have forward compatible implementations.

func (*UnimplementedZorumsServiceServer) Correctable

func (*UnimplementedZorumsServiceServer) CorrectableCombo

func (*UnimplementedZorumsServiceServer) CorrectableCustomReturnType

func (*UnimplementedZorumsServiceServer) CorrectableCustomReturnType(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) CorrectableEmpty

func (*UnimplementedZorumsServiceServer) CorrectableEmpty2

func (*UnimplementedZorumsServiceServer) CorrectablePerNodeArg

func (*UnimplementedZorumsServiceServer) CorrectablePerNodeArg(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) CorrectableStream

func (*UnimplementedZorumsServiceServer) CorrectableStreamCombo

func (*UnimplementedZorumsServiceServer) CorrectableStreamCustomReturnType

func (*UnimplementedZorumsServiceServer) CorrectableStreamEmpty

func (*UnimplementedZorumsServiceServer) CorrectableStreamEmpty2

func (*UnimplementedZorumsServiceServer) CorrectableStreamPerNodeArg

func (*UnimplementedZorumsServiceServer) GRPCCall

func (*UnimplementedZorumsServiceServer) Multicast

func (*UnimplementedZorumsServiceServer) Multicast2

func (*UnimplementedZorumsServiceServer) Multicast3

func (*UnimplementedZorumsServiceServer) Multicast4

func (*UnimplementedZorumsServiceServer) MulticastConcurrent

func (*UnimplementedZorumsServiceServer) MulticastPerNodeArg

func (*UnimplementedZorumsServiceServer) OrderingCombo

func (*UnimplementedZorumsServiceServer) OrderingConcurrent

func (*UnimplementedZorumsServiceServer) OrderingCustomReturnType

func (*UnimplementedZorumsServiceServer) OrderingCustomReturnType(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) OrderingFuture

func (*UnimplementedZorumsServiceServer) OrderingFutureCombo

func (*UnimplementedZorumsServiceServer) OrderingFutureConcurrent

func (*UnimplementedZorumsServiceServer) OrderingFutureConcurrent(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) OrderingFutureCustomReturnType

func (*UnimplementedZorumsServiceServer) OrderingFutureCustomReturnType(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) OrderingFuturePerNodeArg

func (*UnimplementedZorumsServiceServer) OrderingFuturePerNodeArg(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) OrderingPerNodeArg

func (*UnimplementedZorumsServiceServer) OrderingQC

func (*UnimplementedZorumsServiceServer) OrderingUnaryRPC

func (*UnimplementedZorumsServiceServer) OrderingUnaryRPCConcurrent

func (*UnimplementedZorumsServiceServer) OrderingUnaryRPCConcurrent(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCall

func (*UnimplementedZorumsServiceServer) QuorumCallCombo

func (*UnimplementedZorumsServiceServer) QuorumCallCustomReturnType

func (*UnimplementedZorumsServiceServer) QuorumCallCustomReturnType(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCallEmpty

func (*UnimplementedZorumsServiceServer) QuorumCallEmpty2

func (*UnimplementedZorumsServiceServer) QuorumCallFuture

func (*UnimplementedZorumsServiceServer) QuorumCallFuture2

func (*UnimplementedZorumsServiceServer) QuorumCallFutureCombo

func (*UnimplementedZorumsServiceServer) QuorumCallFutureCombo(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCallFutureCustomReturnType

func (*UnimplementedZorumsServiceServer) QuorumCallFutureCustomReturnType(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCallFutureEmpty

func (*UnimplementedZorumsServiceServer) QuorumCallFutureEmpty2

func (*UnimplementedZorumsServiceServer) QuorumCallFutureEmpty2(context.Context, *empty.Empty) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCallFuturePerNodeArg

func (*UnimplementedZorumsServiceServer) QuorumCallFuturePerNodeArg(context.Context, *Request) (*Response, error)

func (*UnimplementedZorumsServiceServer) QuorumCallPerNodeArg

func (*UnimplementedZorumsServiceServer) Unicast

func (*UnimplementedZorumsServiceServer) Unicast2

func (*UnimplementedZorumsServiceServer) UnicastConcurrent

type ZorumsService

type ZorumsService interface {
	Multicast(*Request)
	MulticastPerNodeArg(*Request)
	Multicast2(*Request)
	Multicast3(*Request)
	Multicast4(*empty.Empty)
	MulticastConcurrent(*Request)
	OrderingQC(*Request) *Response
	OrderingPerNodeArg(*Request) *Response
	OrderingCustomReturnType(*Request) *Response
	OrderingCombo(*Request) *Response
	OrderingConcurrent(*Request) *Response
	OrderingUnaryRPC(*Request) *Response
	OrderingUnaryRPCConcurrent(*Request) *Response
	OrderingFuture(*Request) *Response
	OrderingFuturePerNodeArg(*Request) *Response
	OrderingFutureCustomReturnType(*Request) *Response
	OrderingFutureConcurrent(*Request) *Response
	OrderingFutureCombo(*Request) *Response
	Unicast(*Request)
	Unicast2(*Request)
	UnicastConcurrent(*Request)
}

ZorumsService is the server-side API for the ZorumsService Service

type ZorumsServiceClient

type ZorumsServiceClient interface {
	// GRPCCall plain gRPC call; testing that Gorums can ignore these, but that
	// they are added to the _grpc.pb.go generated file.
	GRPCCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCall plain.
	QuorumCall(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCall with per_node_arg option.
	QuorumCallPerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCall with custom_return_type option.
	QuorumCallCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallCombo with all supported options.
	QuorumCallCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallEmpty for testing imported message type.
	QuorumCallEmpty(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallEmpty2 for testing imported message type.
	QuorumCallEmpty2(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	// Multicast plain. Response type is not needed here.
	Multicast(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// MulticastPerNodeArg with per_node_arg option.
	// TODO(meling) currently this is not supported, but compiles as if
	// per_node_arg wasn't specified. Need to implement support.
	MulticastPerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// Multicast2 is testing whether multiple streams work.
	Multicast2(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// Multicast3 is testing imported message type.
	Multicast3(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	// Multicast4 is testing imported message type.
	Multicast4(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*empty.Empty, error)
	// MutlicastConcurrent uses a concurrent server-side handler
	MulticastConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFuture plain.
	QuorumCallFuture(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFuturePerNodeArg with per_node_arg option.
	QuorumCallFuturePerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFutureCustomReturnType with custom_return_type option.
	QuorumCallFutureCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFutureCombo with all supported options.
	QuorumCallFutureCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFuture2 plain; with same return type: Response.
	QuorumCallFuture2(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// QuorumCallFutureEmpty for testing imported message type.
	QuorumCallFutureEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	// QuorumCallFutureEmpty2 for testing imported message type; with same return
	// type as QuorumCallFuture: Response.
	QuorumCallFutureEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Response, error)
	// Correctable plain.
	Correctable(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// CorrectablePerNodeArg with per_node_arg option.
	CorrectablePerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// CorrectableCustomReturnType with custom_return_type option.
	CorrectableCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// CorrectableCombo with all supported options.
	CorrectableCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// CorrectableEmpty for testing imported message type.
	CorrectableEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	// CorrectableEmpty2 for testing imported message type; with same return
	// type as Correctable: Response.
	CorrectableEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Response, error)
	// CorrectableStream plain.
	CorrectableStream(ctx context.Context, in *Request, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamClient, error)
	// CorrectablePerNodeArg with per_node_arg option.
	CorrectableStreamPerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamPerNodeArgClient, error)
	// CorrectableCustomReturnType with custom_return_type option.
	CorrectableStreamCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamCustomReturnTypeClient, error)
	// CorrectableCombo with all supported options.
	CorrectableStreamCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamComboClient, error)
	// CorrectableEmpty for testing imported message type.
	CorrectableStreamEmpty(ctx context.Context, in *Request, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamEmptyClient, error)
	// CorrectableEmpty2 for testing imported message type; with same return
	// type as Correctable: Response.
	CorrectableStreamEmpty2(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (ZorumsService_CorrectableStreamEmpty2Client, error)
	OrderingQC(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingPerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// OrderingUnaryRPC is testing that we can create ordered Unary RPCs
	OrderingUnaryRPC(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	// OrderingUnaryRPC is testing that we can create ordered Unary RPCs with
	// concurrent handlers
	OrderingUnaryRPCConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingFuture(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingFuturePerNodeArg(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingFutureCustomReturnType(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingFutureConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	OrderingFutureCombo(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Unicast(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
	Unicast2(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
	UnicastConcurrent(ctx context.Context, in *Request, opts ...grpc.CallOption) (*empty.Empty, error)
}

ZorumsServiceClient is the client API for ZorumsService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

type ZorumsServiceServer

type ZorumsServiceServer interface {
	// GRPCCall plain gRPC call; testing that Gorums can ignore these, but that
	// they are added to the _grpc.pb.go generated file.
	GRPCCall(context.Context, *Request) (*Response, error)
	// QuorumCall plain.
	QuorumCall(context.Context, *Request) (*Response, error)
	// QuorumCall with per_node_arg option.
	QuorumCallPerNodeArg(context.Context, *Request) (*Response, error)
	// QuorumCall with custom_return_type option.
	QuorumCallCustomReturnType(context.Context, *Request) (*Response, error)
	// QuorumCallCombo with all supported options.
	QuorumCallCombo(context.Context, *Request) (*Response, error)
	// QuorumCallEmpty for testing imported message type.
	QuorumCallEmpty(context.Context, *empty.Empty) (*Response, error)
	// QuorumCallEmpty2 for testing imported message type.
	QuorumCallEmpty2(context.Context, *Request) (*empty.Empty, error)
	// Multicast plain. Response type is not needed here.
	Multicast(context.Context, *Request) (*Response, error)
	// MulticastPerNodeArg with per_node_arg option.
	// TODO(meling) currently this is not supported, but compiles as if
	// per_node_arg wasn't specified. Need to implement support.
	MulticastPerNodeArg(context.Context, *Request) (*Response, error)
	// Multicast2 is testing whether multiple streams work.
	Multicast2(context.Context, *Request) (*Response, error)
	// Multicast3 is testing imported message type.
	Multicast3(context.Context, *Request) (*empty.Empty, error)
	// Multicast4 is testing imported message type.
	Multicast4(context.Context, *empty.Empty) (*empty.Empty, error)
	// MutlicastConcurrent uses a concurrent server-side handler
	MulticastConcurrent(context.Context, *Request) (*Response, error)
	// QuorumCallFuture plain.
	QuorumCallFuture(context.Context, *Request) (*Response, error)
	// QuorumCallFuturePerNodeArg with per_node_arg option.
	QuorumCallFuturePerNodeArg(context.Context, *Request) (*Response, error)
	// QuorumCallFutureCustomReturnType with custom_return_type option.
	QuorumCallFutureCustomReturnType(context.Context, *Request) (*Response, error)
	// QuorumCallFutureCombo with all supported options.
	QuorumCallFutureCombo(context.Context, *Request) (*Response, error)
	// QuorumCallFuture2 plain; with same return type: Response.
	QuorumCallFuture2(context.Context, *Request) (*Response, error)
	// QuorumCallFutureEmpty for testing imported message type.
	QuorumCallFutureEmpty(context.Context, *Request) (*empty.Empty, error)
	// QuorumCallFutureEmpty2 for testing imported message type; with same return
	// type as QuorumCallFuture: Response.
	QuorumCallFutureEmpty2(context.Context, *empty.Empty) (*Response, error)
	// Correctable plain.
	Correctable(context.Context, *Request) (*Response, error)
	// CorrectablePerNodeArg with per_node_arg option.
	CorrectablePerNodeArg(context.Context, *Request) (*Response, error)
	// CorrectableCustomReturnType with custom_return_type option.
	CorrectableCustomReturnType(context.Context, *Request) (*Response, error)
	// CorrectableCombo with all supported options.
	CorrectableCombo(context.Context, *Request) (*Response, error)
	// CorrectableEmpty for testing imported message type.
	CorrectableEmpty(context.Context, *Request) (*empty.Empty, error)
	// CorrectableEmpty2 for testing imported message type; with same return
	// type as Correctable: Response.
	CorrectableEmpty2(context.Context, *empty.Empty) (*Response, error)
	// CorrectableStream plain.
	CorrectableStream(*Request, ZorumsService_CorrectableStreamServer) error
	// CorrectablePerNodeArg with per_node_arg option.
	CorrectableStreamPerNodeArg(*Request, ZorumsService_CorrectableStreamPerNodeArgServer) error
	// CorrectableCustomReturnType with custom_return_type option.
	CorrectableStreamCustomReturnType(*Request, ZorumsService_CorrectableStreamCustomReturnTypeServer) error
	// CorrectableCombo with all supported options.
	CorrectableStreamCombo(*Request, ZorumsService_CorrectableStreamComboServer) error
	// CorrectableEmpty for testing imported message type.
	CorrectableStreamEmpty(*Request, ZorumsService_CorrectableStreamEmptyServer) error
	// CorrectableEmpty2 for testing imported message type; with same return
	// type as Correctable: Response.
	CorrectableStreamEmpty2(*empty.Empty, ZorumsService_CorrectableStreamEmpty2Server) error
	OrderingQC(context.Context, *Request) (*Response, error)
	OrderingPerNodeArg(context.Context, *Request) (*Response, error)
	OrderingCustomReturnType(context.Context, *Request) (*Response, error)
	OrderingCombo(context.Context, *Request) (*Response, error)
	OrderingConcurrent(context.Context, *Request) (*Response, error)
	// OrderingUnaryRPC is testing that we can create ordered Unary RPCs
	OrderingUnaryRPC(context.Context, *Request) (*Response, error)
	// OrderingUnaryRPC is testing that we can create ordered Unary RPCs with
	// concurrent handlers
	OrderingUnaryRPCConcurrent(context.Context, *Request) (*Response, error)
	OrderingFuture(context.Context, *Request) (*Response, error)
	OrderingFuturePerNodeArg(context.Context, *Request) (*Response, error)
	OrderingFutureCustomReturnType(context.Context, *Request) (*Response, error)
	OrderingFutureConcurrent(context.Context, *Request) (*Response, error)
	OrderingFutureCombo(context.Context, *Request) (*Response, error)
	Unicast(context.Context, *Request) (*Response, error)
	Unicast2(context.Context, *Request) (*empty.Empty, error)
	UnicastConcurrent(context.Context, *Request) (*empty.Empty, error)
	// contains filtered or unexported methods
}

ZorumsServiceServer is the server API for ZorumsService service. All implementations must embed UnimplementedZorumsServiceServer for forward compatibility

type ZorumsService_CorrectableStreamClient

type ZorumsService_CorrectableStreamClient interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamComboClient

type ZorumsService_CorrectableStreamComboClient interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamComboServer

type ZorumsService_CorrectableStreamComboServer interface {
	Send(*Response) error
	grpc.ServerStream
}

type ZorumsService_CorrectableStreamCustomReturnTypeClient

type ZorumsService_CorrectableStreamCustomReturnTypeClient interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamCustomReturnTypeServer

type ZorumsService_CorrectableStreamCustomReturnTypeServer interface {
	Send(*Response) error
	grpc.ServerStream
}

type ZorumsService_CorrectableStreamEmpty2Client

type ZorumsService_CorrectableStreamEmpty2Client interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamEmpty2Server

type ZorumsService_CorrectableStreamEmpty2Server interface {
	Send(*Response) error
	grpc.ServerStream
}

type ZorumsService_CorrectableStreamEmptyClient

type ZorumsService_CorrectableStreamEmptyClient interface {
	Recv() (*empty.Empty, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamEmptyServer

type ZorumsService_CorrectableStreamEmptyServer interface {
	Send(*empty.Empty) error
	grpc.ServerStream
}

type ZorumsService_CorrectableStreamPerNodeArgClient

type ZorumsService_CorrectableStreamPerNodeArgClient interface {
	Recv() (*Response, error)
	grpc.ClientStream
}

type ZorumsService_CorrectableStreamPerNodeArgServer

type ZorumsService_CorrectableStreamPerNodeArgServer interface {
	Send(*Response) error
	grpc.ServerStream
}

type ZorumsService_CorrectableStreamServer

type ZorumsService_CorrectableStreamServer interface {
	Send(*Response) error
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

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