client

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_client_client_proto protoreflect.FileDescriptor

Functions

func RegisterClientServer added in v0.2.0

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

Types

type AsyncEmpty added in v0.2.0

type AsyncEmpty struct {
	*gorums.Async
}

AsyncEmpty is a async object for processing replies.

func (*AsyncEmpty) Get added in v0.2.0

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 added in v0.2.0

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 added in v0.2.0

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

Deprecated: Use Batch.ProtoReflect.Descriptor instead.

func (*Batch) GetCommands added in v0.2.0

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

func (*Batch) ProtoMessage added in v0.2.0

func (*Batch) ProtoMessage()

func (*Batch) ProtoReflect added in v0.2.0

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

func (*Batch) Reset added in v0.2.0

func (x *Batch) Reset()

func (*Batch) String added in v0.2.0

func (x *Batch) String() string

type BenchmarkData

type BenchmarkData struct {
	MeasuredThroughput float64         `protobuf:"fixed64,1,opt,name=MeasuredThroughput,proto3" json:"MeasuredThroughput,omitempty"` // ops/sec
	MeasuredLatency    float64         `protobuf:"fixed64,2,opt,name=MeasuredLatency,proto3" json:"MeasuredLatency,omitempty"`       // ms
	LatencyVariance    float64         `protobuf:"fixed64,3,opt,name=LatencyVariance,proto3" json:"LatencyVariance,omitempty"`       // ms^2
	Stats              []*CommandStats `protobuf:"bytes,4,rep,name=Stats,proto3" json:"Stats,omitempty"`
	// contains filtered or unexported fields
}

BenchmarkData contains the throughput (in ops/sec) and latency (in ms) as measured by the client, as well as the time and duration information for each command.

func (*BenchmarkData) Descriptor deprecated

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

Deprecated: Use BenchmarkData.ProtoReflect.Descriptor instead.

func (*BenchmarkData) GetLatencyVariance

func (x *BenchmarkData) GetLatencyVariance() float64

func (*BenchmarkData) GetMeasuredLatency

func (x *BenchmarkData) GetMeasuredLatency() float64

func (*BenchmarkData) GetMeasuredThroughput

func (x *BenchmarkData) GetMeasuredThroughput() float64

func (*BenchmarkData) GetStats

func (x *BenchmarkData) GetStats() []*CommandStats

func (*BenchmarkData) ProtoMessage

func (*BenchmarkData) ProtoMessage()

func (*BenchmarkData) ProtoReflect

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

func (*BenchmarkData) Reset

func (x *BenchmarkData) Reset()

func (*BenchmarkData) String

func (x *BenchmarkData) String() string

type Client

type Client interface {
	ExecCommand(context.Context, *Command, func(*emptypb.Empty, 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 CommandStats

type CommandStats struct {
	StartTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=StartTime,proto3" json:"StartTime,omitempty"`
	Duration  *durationpb.Duration   `protobuf:"bytes,2,opt,name=Duration,proto3" json:"Duration,omitempty"`
	// contains filtered or unexported fields
}

CommandStats contains the start time and duration that elapsed before a command was executed.

func (*CommandStats) Descriptor deprecated

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

Deprecated: Use CommandStats.ProtoReflect.Descriptor instead.

func (*CommandStats) GetDuration

func (x *CommandStats) GetDuration() *durationpb.Duration

func (*CommandStats) GetStartTime

func (x *CommandStats) GetStartTime() *timestamppb.Timestamp

func (*CommandStats) ProtoMessage

func (*CommandStats) ProtoMessage()

func (*CommandStats) ProtoReflect

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

func (*CommandStats) Reset

func (x *CommandStats) Reset()

func (*CommandStats) String

func (x *CommandStats) 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) 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(qspec QuorumSpec, opts ...gorums.ConfigOption) (c *Configuration, err error)

NewConfiguration returns a configuration based on the provided list of nodes. Nodes can be supplied using WithNodeMap or WithNodeList or WithNodeIDs.

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 {

	// 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