Documentation ¶
Index ¶
- Variables
- func RegisterClientServer(srv *gorums.Server, impl Client)
- type AsyncEmpty
- type Batch
- type Client
- type Command
- func (*Command) Descriptor() ([]byte, []int)deprecated
- func (x *Command) GetClientID() uint32
- func (x *Command) GetData() []byte
- func (x *Command) GetSequenceNumber() uint64
- func (*Command) ProtoMessage()
- func (x *Command) ProtoReflect() protoreflect.Message
- func (x *Command) Reset()
- func (x *Command) String() string
- type Configuration
- type Manager
- type Node
- type QuorumSpec
Constants ¶
This section is empty.
Variables ¶
var File_internal_proto_clientpb_client_proto protoreflect.FileDescriptor
Functions ¶
func RegisterClientServer ¶
Types ¶
type AsyncEmpty ¶
AsyncEmpty is a async object for processing replies.
type Batch ¶
type Batch struct { Commands []*Command `protobuf:"bytes,1,rep,name=Commands,proto3" json:"Commands,omitempty"` // contains filtered or unexported fields }
Batch is a list of commands to be executed
func (*Batch) Descriptor
deprecated
func (*Batch) GetCommands ¶
func (*Batch) ProtoMessage ¶
func (*Batch) ProtoMessage()
func (*Batch) ProtoReflect ¶
func (x *Batch) ProtoReflect() protoreflect.Message
type Client ¶
type Client interface {
ExecCommand(ctx gorums.ServerCtx, request *Command) (response *emptypb.Empty, err error)
}
Client is the server-side API for the Client Service
type Command ¶
type Command struct { ClientID uint32 `protobuf:"varint,1,opt,name=ClientID,proto3" json:"ClientID,omitempty"` SequenceNumber uint64 `protobuf:"varint,2,opt,name=SequenceNumber,proto3" json:"SequenceNumber,omitempty"` Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"` // contains filtered or unexported fields }
Command is the request that is sent to the HotStuff replicas with the data to be executed.
func (*Command) Descriptor
deprecated
func (*Command) GetClientID ¶
func (*Command) GetSequenceNumber ¶
func (*Command) ProtoMessage ¶
func (*Command) ProtoMessage()
func (*Command) ProtoReflect ¶
func (x *Command) ProtoReflect() protoreflect.Message
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 ¶
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 ¶
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 ¶
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) ExecCommand ¶
func (c *Configuration) ExecCommand(ctx context.Context, in *Command) *AsyncEmpty
ExecCommand sends a command to all replicas and waits for valid signatures from f+1 replicas
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.
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 // ExecCommandQF is the quorum function for the ExecCommand // asynchronous quorum call method. The in parameter is the request object // supplied to the ExecCommand 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 '_ *Command'. ExecCommandQF(in *Command, replies map[uint32]*emptypb.Empty) (*emptypb.Empty, bool) }
QuorumSpec is the interface of quorum functions for Client.