Documentation ¶
Index ¶
- Variables
- func RegisterGorumsTestServer(srv *gorums.Server, impl GorumsTest)
- type AsyncResponse
- type Configuration
- func (c Configuration) And(d *Configuration) gorums.NodeListOption
- func (c Configuration) Except(rm *Configuration) gorums.NodeListOption
- func (c *Configuration) Nodes() []*Node
- func (c *Configuration) QC(ctx context.Context, in *Request) (resp *Response, err error)
- func (c *Configuration) QCAsync(ctx context.Context, in *Request) *AsyncResponse
- type GorumsTest
- type Manager
- type Node
- type QuorumSpec
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var File_ordering_order_proto protoreflect.FileDescriptor
Functions ¶
func RegisterGorumsTestServer ¶ added in v0.4.0
func RegisterGorumsTestServer(srv *gorums.Server, impl GorumsTest)
Types ¶
type AsyncResponse ¶ added in v0.4.0
AsyncResponse is a async object for processing replies.
func (*AsyncResponse) Get ¶ added in v0.4.0
func (f *AsyncResponse) 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 Configuration ¶
type Configuration struct { gorums.RawConfiguration // contains filtered or unexported fields }
A Configuration represents a static set of nodes on which quorum remote procedure calls may be invoked.
func ConfigurationFromRaw ¶ added in v0.7.0
func ConfigurationFromRaw(rawCfg gorums.RawConfiguration, qspec QuorumSpec) *Configuration
ConfigurationFromRaw returns a new Configuration from the given raw configuration and QuorumSpec.
This function may for example be used to "clone" a configuration but install a different QuorumSpec:
cfg1, err := mgr.NewConfiguration(qspec1, opts...) cfg2 := ConfigurationFromRaw(cfg1.RawConfig, qspec2)
func (Configuration) And ¶ added in v0.4.0
func (c Configuration) And(d *Configuration) gorums.NodeListOption
And returns a NodeListOption that can be used to create a new configuration combining c and d.
func (Configuration) Except ¶ added in v0.4.0
func (c Configuration) Except(rm *Configuration) gorums.NodeListOption
Except returns a NodeListOption that can be used to create a new configuration from c without the nodes in rm.
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 Manager.
NOTE: mutating the returned slice is not supported.
func (*Configuration) QC ¶
QC is a quorum call invoked on all nodes in configuration c, with the same argument in, and returns a combined result.
func (*Configuration) QCAsync ¶ added in v0.4.0
func (c *Configuration) QCAsync(ctx context.Context, in *Request) *AsyncResponse
QCAsync asynchronously invokes a quorum call on configuration c and returns a AsyncResponse, which can be used to inspect the quorum call reply and error when available.
type GorumsTest ¶
type GorumsTest interface { QC(ctx gorums.ServerCtx, request *Request) (response *Response, err error) QCAsync(ctx gorums.ServerCtx, request *Request) (response *Response, err error) UnaryRPC(ctx gorums.ServerCtx, request *Request) (response *Response, err error) }
GorumsTest is the server-side API for the GorumsTest Service
type Manager ¶
type Manager struct {
*gorums.RawManager
}
Manager maintains a connection pool of nodes on which quorum calls can be performed.
func NewManager ¶
func NewManager(opts ...gorums.ManagerOption) (mgr *Manager)
NewManager returns a new Manager for managing connection to nodes added to the manager. This function accepts manager options used to configure various aspects of the manager.
func (*Manager) NewConfiguration ¶
func (m *Manager) NewConfiguration(opts ...gorums.ConfigOption) (c *Configuration, err error)
NewConfiguration returns a configuration based on the provided list of nodes (required) and an optional quorum specification. The QuorumSpec is necessary for call types that must process replies. For configurations only used for unicast or multicast call types, a QuorumSpec is not needed. The QuorumSpec interface is also a ConfigOption. Nodes can be supplied using WithNodeMap or WithNodeList, or WithNodeIDs. A new configuration can also be created from an existing configuration, using the And, WithNewNodes, Except, and WithoutNodes methods.
type Node ¶
Node encapsulates the state of a node on which a remote procedure call can be performed.
type QuorumSpec ¶
type QuorumSpec interface { gorums.ConfigOption // QCQF is the quorum function for the QC // quorum call method. The in parameter is the request object // supplied to the QC 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'. QCQF(in *Request, replies map[uint32]*Response) (*Response, bool) // QCAsyncQF is the quorum function for the QCAsync // asynchronous quorum call method. The in parameter is the request object // supplied to the QCAsync 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'. QCAsyncQF(in *Request, replies map[uint32]*Response) (*Response, bool) }
QuorumSpec is the interface of quorum functions for GorumsTest.
type Request ¶
type Request struct { Num uint64 `protobuf:"varint,1,opt,name=Num,proto3" json:"Num,omitempty"` // contains filtered or unexported fields }
func (*Request) Descriptor
deprecated
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { InOrder bool `protobuf:"varint,1,opt,name=InOrder,proto3" json:"InOrder,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) GetInOrder ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message