clientpb

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_internal_proto_clientpb_client_proto protoreflect.FileDescriptor

Functions

func RegisterClientServer

func RegisterClientServer(srv *gorums.Server, impl Client)

Types

type AsyncEmpty

type AsyncEmpty struct {
	*gorums.Async
}

AsyncEmpty is a async object for processing replies.

func (*AsyncEmpty) Get

func (f *AsyncEmpty) Get() (*emptypb.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 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) Descriptor() ([]byte, []int)

Deprecated: Use Batch.ProtoReflect.Descriptor instead.

func (*Batch) GetCommands

func (x *Batch) GetCommands() []*Command

func (*Batch) ProtoMessage

func (*Batch) ProtoMessage()

func (*Batch) ProtoReflect

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

func (*Batch) Reset

func (x *Batch) Reset()

func (*Batch) String

func (x *Batch) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Command.ProtoReflect.Descriptor instead.

func (*Command) GetClientID

func (x *Command) GetClientID() uint32

func (*Command) GetData

func (x *Command) GetData() []byte

func (*Command) GetSequenceNumber

func (x *Command) GetSequenceNumber() uint64

func (*Command) ProtoMessage

func (*Command) ProtoMessage()

func (*Command) ProtoReflect

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

func (*Command) Reset

func (x *Command) Reset()

func (*Command) String

func (x *Command) String() string

type Configuration

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

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

func (Configuration) And

And returns a NodeListOption that can be used to create a new configuration combining c and d.

func (Configuration) Except

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.

type Manager

type Manager struct {
	*gorums.Manager
}

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.

func (*Manager) Nodes

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

Nodes returns a slice of available nodes on this manager. IDs are returned in the order they were added at creation of the manager.

type Node

type Node struct {
	*gorums.Node
}

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.

Jump to

Keyboard shortcuts

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