correctable

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_correctable_correctable_proto protoreflect.FileDescriptor

Functions

func RegisterCorrectableTestServer

func RegisterCorrectableTestServer(srv *gorums.Server, impl CorrectableTest)

Types

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

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

func (*Configuration) Correctable

Correctable asynchronously invokes a correctable quorum call on each node in configuration c and returns a CorrectableCorrectableResponse, which can be used to inspect any replies or errors when available.

func (*Configuration) CorrectableStream

CorrectableStream asynchronously invokes a correctable quorum call on each node in configuration c and returns a CorrectableStreamCorrectableResponse, which can be used to inspect any replies or errors when available. This method supports server-side preliminary replies (correctable stream).

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) 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 CorrectableCorrectableResponse

type CorrectableCorrectableResponse struct {
	*gorums.Correctable
}

CorrectableCorrectableResponse is a correctable object for processing replies.

func (*CorrectableCorrectableResponse) 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.

type CorrectableRequest

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

func (*CorrectableRequest) Descriptor deprecated

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

Deprecated: Use CorrectableRequest.ProtoReflect.Descriptor instead.

func (*CorrectableRequest) ProtoMessage

func (*CorrectableRequest) ProtoMessage()

func (*CorrectableRequest) ProtoReflect

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

func (*CorrectableRequest) Reset

func (x *CorrectableRequest) Reset()

func (*CorrectableRequest) String

func (x *CorrectableRequest) String() string

type CorrectableResponse

type CorrectableResponse struct {
	Level int32 `protobuf:"varint,1,opt,name=Level,proto3" json:"Level,omitempty"`
	// contains filtered or unexported fields
}

func (*CorrectableResponse) Descriptor deprecated

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

Deprecated: Use CorrectableResponse.ProtoReflect.Descriptor instead.

func (*CorrectableResponse) GetLevel

func (x *CorrectableResponse) GetLevel() int32

func (*CorrectableResponse) ProtoMessage

func (*CorrectableResponse) ProtoMessage()

func (*CorrectableResponse) ProtoReflect

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

func (*CorrectableResponse) Reset

func (x *CorrectableResponse) Reset()

func (*CorrectableResponse) String

func (x *CorrectableResponse) String() string

type CorrectableStreamCorrectableResponse

type CorrectableStreamCorrectableResponse struct {
	*gorums.Correctable
}

CorrectableStreamCorrectableResponse is a correctable object for processing replies.

func (*CorrectableStreamCorrectableResponse) 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.

type CorrectableTest

type CorrectableTest interface {
	Correctable(ctx gorums.ServerCtx, request *CorrectableRequest) (response *CorrectableResponse, err error)
	CorrectableStream(ctx gorums.ServerCtx, request *CorrectableRequest, send func(response *CorrectableResponse) error) error
}

CorrectableTest is the server-side API for the CorrectableTest 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.

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.RawNode
}

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

type QuorumSpec

type QuorumSpec interface {
	gorums.ConfigOption

	// 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 '_ *CorrectableRequest'.
	CorrectableQF(in *CorrectableRequest, replies map[uint32]*CorrectableResponse) (*CorrectableResponse, 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 '_ *CorrectableRequest'.
	CorrectableStreamQF(in *CorrectableRequest, replies map[uint32]*CorrectableResponse) (*CorrectableResponse, int, bool)
}

QuorumSpec is the interface of quorum functions for CorrectableTest.

Jump to

Keyboard shortcuts

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