Documentation
¶
Index ¶
- Variables
- func Correctable(ctx *gorums.ConfigContext, in *Request, opts ...gorums.CallOption) *gorums.Responses[*Response]
- func CorrectableStream(ctx *gorums.ConfigContext, in *Request, opts ...gorums.CallOption) *gorums.Responses[*Response]
- func RegisterCorrectableTestServer(srv *gorums.Server, impl CorrectableTestServer)
- type AsyncResponse
- type Configuration
- type CorrectableResponse
- type CorrectableTestServer
- type Manager
- type Node
- type Request
- type Request_builder
- type Response
- type Response_builder
Constants ¶
This section is empty.
Variables ¶
var File_correctable_correctable_proto protoreflect.FileDescriptor
Functions ¶
func Correctable ¶
func Correctable(ctx *gorums.ConfigContext, in *Request, opts ...gorums.CallOption) *gorums.Responses[*Response]
Correctable is a quorum call invoked on all nodes in the configuration, with the same argument in. Use terminal methods like Majority(), First(), or Threshold(n) to retrieve the aggregated result.
Example:
resp, err := Correctable(ctx, in).Majority()
func CorrectableStream ¶
func CorrectableStream(ctx *gorums.ConfigContext, in *Request, opts ...gorums.CallOption) *gorums.Responses[*Response]
CorrectableStream is a streaming quorum call where the server can send multiple responses. The response iterator continues until the context is canceled.
Example:
corr := CorrectableStream(ctx, in).Correctable(2) <-corr.Watch(2) resp, level, err := corr.Get()
func RegisterCorrectableTestServer ¶
func RegisterCorrectableTestServer(srv *gorums.Server, impl CorrectableTestServer)
Types ¶
type AsyncResponse ¶
AsyncResponse is a future for async quorum calls returning *Response.
type Configuration ¶
type Configuration = gorums.Configuration
Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.
func NewConfig ¶
func NewConfig(opts ...gorums.Option) (Configuration, error)
NewConfig returns a new Configuration based on the provided [gorums.Option]s. It accepts exactly one gorums.NodeListOption and multiple [gorums.ManagerOption]s. You may use this function to create the initial configuration for a new manager.
Example:
cfg, err := NewConfig(
gorums.WithNodeList([]string{"localhost:8080", "localhost:8081", "localhost:8082"}),
gorums.WithDialOptions(grpc.WithTransportCredentials(insecure.NewCredentials())),
)
This is a convenience function for creating a configuration without explicitly creating a manager first. However, the manager can be accessed using the [Configuration.Manager] method. This method should only be used once since it creates a new manager; if a manager already exists, use NewConfiguration instead, and provide the existing manager as the first argument.
func NewConfiguration ¶
func NewConfiguration(mgr *Manager, opt gorums.NodeListOption) (Configuration, error)
NewConfiguration returns a configuration based on the provided list of nodes. 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 CorrectableResponse ¶
type CorrectableResponse = *gorums.Correctable[*Response]
CorrectableResponse is a correctable object for quorum calls returning *Response.
type CorrectableTestServer ¶
type CorrectableTestServer interface {
Correctable(ctx gorums.ServerCtx, request *Request) (response *Response, err error)
CorrectableStream(ctx gorums.ServerCtx, request *Request, send func(response *Response) error) error
}
CorrectableTest is the server-side API for the CorrectableTest Service
type Manager ¶
Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.
func NewManager ¶
func NewManager(opts ...gorums.ManagerOption) *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.
type Node ¶
Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶
func (x *Request) ProtoReflect() protoreflect.Message
type Request_builder ¶
type Request_builder struct {
// contains filtered or unexported fields
}
func (Request_builder) Build ¶
func (b0 Request_builder) Build() *Request
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type Response_builder ¶
type Response_builder struct {
Level int32
// contains filtered or unexported fields
}
func (Response_builder) Build ¶
func (b0 Response_builder) Build() *Response