Documentation
¶
Index ¶
- Variables
- func ReadQC(ctx *ConfigContext, in *ReadRequest, opts ...gorums.CallOption) *gorums.Responses[*ReadResponse]
- func RegisterStorageServer(srv *gorums.Server, impl StorageServer)
- func WriteMulticast(ctx *ConfigContext, in *WriteRequest, opts ...gorums.CallOption) error
- func WriteQC(ctx *ConfigContext, in *WriteRequest, opts ...gorums.CallOption) *gorums.Responses[*WriteResponse]
- type AsyncReadResponse
- type AsyncWriteResponse
- type ConfigContext
- type Configuration
- type CorrectableReadResponse
- type CorrectableWriteResponse
- type Manager
- type Node
- type NodeContext
- type ReadRequest
- type ReadRequest_builder
- type ReadResponse
- func (x *ReadResponse) ClearTime()
- func (x *ReadResponse) GetOK() bool
- func (x *ReadResponse) GetTime() *timestamppb.Timestamp
- func (x *ReadResponse) GetValue() string
- func (x *ReadResponse) HasTime() bool
- func (*ReadResponse) ProtoMessage()
- func (x *ReadResponse) ProtoReflect() protoreflect.Message
- func (x *ReadResponse) Reset()
- func (x *ReadResponse) SetOK(v bool)
- func (x *ReadResponse) SetTime(v *timestamppb.Timestamp)
- func (x *ReadResponse) SetValue(v string)
- func (x *ReadResponse) String() string
- type ReadResponse_builder
- type StorageServer
- type WriteRequest
- func (x *WriteRequest) ClearTime()
- func (x *WriteRequest) GetKey() string
- func (x *WriteRequest) GetTime() *timestamppb.Timestamp
- func (x *WriteRequest) GetValue() string
- func (x *WriteRequest) HasTime() bool
- func (*WriteRequest) ProtoMessage()
- func (x *WriteRequest) ProtoReflect() protoreflect.Message
- func (x *WriteRequest) Reset()
- func (x *WriteRequest) SetKey(v string)
- func (x *WriteRequest) SetTime(v *timestamppb.Timestamp)
- func (x *WriteRequest) SetValue(v string)
- func (x *WriteRequest) String() string
- type WriteRequest_builder
- type WriteResponse
- type WriteResponse_builder
Constants ¶
This section is empty.
Variables ¶
var File_storage_proto_storage_proto protoreflect.FileDescriptor
Functions ¶
func ReadQC ¶
func ReadQC(ctx *ConfigContext, in *ReadRequest, opts ...gorums.CallOption) *gorums.Responses[*ReadResponse]
ReadQC executes a Read quorum call on a configuration of nodes and returns the most recent value.
func RegisterStorageServer ¶
func RegisterStorageServer(srv *gorums.Server, impl StorageServer)
func WriteMulticast ¶
func WriteMulticast(ctx *ConfigContext, in *WriteRequest, opts ...gorums.CallOption) error
WriteMulticast executes a Write multicast call on a configuration of nodes. It does not wait for any responses.
func WriteQC ¶
func WriteQC(ctx *ConfigContext, in *WriteRequest, opts ...gorums.CallOption) *gorums.Responses[*WriteResponse]
WriteQC executes a Write quorum call on a configuration of nodes and returns true if a majority of nodes were updated.
Types ¶
type AsyncReadResponse ¶
type AsyncReadResponse = *gorums.Async[*ReadResponse]
AsyncReadResponse is a future for async quorum calls returning *ReadResponse.
type AsyncWriteResponse ¶
type AsyncWriteResponse = *gorums.Async[*WriteResponse]
AsyncWriteResponse is a future for async quorum calls returning *WriteResponse.
type ConfigContext ¶
type ConfigContext = gorums.ConfigContext
Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.
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 WithNodes or WithNodeList. A new configuration can also be created from an existing configuration using the Add, Union, Remove, Difference, Extend, and WithoutErrors methods.
type CorrectableReadResponse ¶
type CorrectableReadResponse = *gorums.Correctable[*ReadResponse]
CorrectableReadResponse is a correctable object for quorum calls returning *ReadResponse.
type CorrectableWriteResponse ¶
type CorrectableWriteResponse = *gorums.Correctable[*WriteResponse]
CorrectableWriteResponse is a correctable object for quorum calls returning *WriteResponse.
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 NodeContext ¶
type NodeContext = gorums.NodeContext
Type aliases for important Gorums types to make them more accessible from user code already interacting with the generated code.
type ReadRequest ¶
type ReadRequest struct {
// contains filtered or unexported fields
}
ReadRequest is the request message for Read RPCs and Read quorum calls.
func (*ReadRequest) GetKey ¶
func (x *ReadRequest) GetKey() string
func (*ReadRequest) ProtoMessage ¶
func (*ReadRequest) ProtoMessage()
func (*ReadRequest) ProtoReflect ¶
func (x *ReadRequest) ProtoReflect() protoreflect.Message
func (*ReadRequest) Reset ¶
func (x *ReadRequest) Reset()
func (*ReadRequest) SetKey ¶
func (x *ReadRequest) SetKey(v string)
func (*ReadRequest) String ¶
func (x *ReadRequest) String() string
type ReadRequest_builder ¶
type ReadRequest_builder struct {
Key string
// contains filtered or unexported fields
}
func (ReadRequest_builder) Build ¶
func (b0 ReadRequest_builder) Build() *ReadRequest
type ReadResponse ¶
type ReadResponse struct {
// contains filtered or unexported fields
}
ReadResponse is the response message for Read RPCs and Read quorum calls.
func ReadRPC ¶
func ReadRPC(ctx *NodeContext, in *ReadRequest) (*ReadResponse, error)
ReadRPC executes a Read RPC on a single node and returns the value for the provided key.
func (*ReadResponse) ClearTime ¶
func (x *ReadResponse) ClearTime()
func (*ReadResponse) GetOK ¶
func (x *ReadResponse) GetOK() bool
func (*ReadResponse) GetTime ¶
func (x *ReadResponse) GetTime() *timestamppb.Timestamp
func (*ReadResponse) GetValue ¶
func (x *ReadResponse) GetValue() string
func (*ReadResponse) HasTime ¶
func (x *ReadResponse) HasTime() bool
func (*ReadResponse) ProtoMessage ¶
func (*ReadResponse) ProtoMessage()
func (*ReadResponse) ProtoReflect ¶
func (x *ReadResponse) ProtoReflect() protoreflect.Message
func (*ReadResponse) Reset ¶
func (x *ReadResponse) Reset()
func (*ReadResponse) SetOK ¶
func (x *ReadResponse) SetOK(v bool)
func (*ReadResponse) SetTime ¶
func (x *ReadResponse) SetTime(v *timestamppb.Timestamp)
func (*ReadResponse) SetValue ¶
func (x *ReadResponse) SetValue(v string)
func (*ReadResponse) String ¶
func (x *ReadResponse) String() string
type ReadResponse_builder ¶
type ReadResponse_builder struct {
OK bool
Value string
Time *timestamppb.Timestamp
// contains filtered or unexported fields
}
func (ReadResponse_builder) Build ¶
func (b0 ReadResponse_builder) Build() *ReadResponse
type StorageServer ¶
type StorageServer interface {
ReadRPC(ctx gorums.ServerCtx, request *ReadRequest) (response *ReadResponse, err error)
WriteRPC(ctx gorums.ServerCtx, request *WriteRequest) (response *WriteResponse, err error)
ReadQC(ctx gorums.ServerCtx, request *ReadRequest) (response *ReadResponse, err error)
WriteQC(ctx gorums.ServerCtx, request *WriteRequest) (response *WriteResponse, err error)
WriteMulticast(ctx gorums.ServerCtx, request *WriteRequest)
}
Storage is the server-side API for the Storage Service
type WriteRequest ¶
type WriteRequest struct {
// contains filtered or unexported fields
}
WriteRequest is the request message for Write RPCs, Write quorum calls, and Write multicast calls.
func (*WriteRequest) ClearTime ¶
func (x *WriteRequest) ClearTime()
func (*WriteRequest) GetKey ¶
func (x *WriteRequest) GetKey() string
func (*WriteRequest) GetTime ¶
func (x *WriteRequest) GetTime() *timestamppb.Timestamp
func (*WriteRequest) GetValue ¶
func (x *WriteRequest) GetValue() string
func (*WriteRequest) HasTime ¶
func (x *WriteRequest) HasTime() bool
func (*WriteRequest) ProtoMessage ¶
func (*WriteRequest) ProtoMessage()
func (*WriteRequest) ProtoReflect ¶
func (x *WriteRequest) ProtoReflect() protoreflect.Message
func (*WriteRequest) Reset ¶
func (x *WriteRequest) Reset()
func (*WriteRequest) SetKey ¶
func (x *WriteRequest) SetKey(v string)
func (*WriteRequest) SetTime ¶
func (x *WriteRequest) SetTime(v *timestamppb.Timestamp)
func (*WriteRequest) SetValue ¶
func (x *WriteRequest) SetValue(v string)
func (*WriteRequest) String ¶
func (x *WriteRequest) String() string
type WriteRequest_builder ¶
type WriteRequest_builder struct {
Key string
Value string
Time *timestamppb.Timestamp
// contains filtered or unexported fields
}
func (WriteRequest_builder) Build ¶
func (b0 WriteRequest_builder) Build() *WriteRequest
type WriteResponse ¶
type WriteResponse struct {
// contains filtered or unexported fields
}
WriteResponse is the response message for Write RPCs and Write quorum calls.
func WriteRPC ¶
func WriteRPC(ctx *NodeContext, in *WriteRequest) (*WriteResponse, error)
WriteRPC executes a Write RPC on a single node and returns true if the value was updated.
func (*WriteResponse) GetNew ¶
func (x *WriteResponse) GetNew() bool
func (*WriteResponse) ProtoMessage ¶
func (*WriteResponse) ProtoMessage()
func (*WriteResponse) ProtoReflect ¶
func (x *WriteResponse) ProtoReflect() protoreflect.Message
func (*WriteResponse) Reset ¶
func (x *WriteResponse) Reset()
func (*WriteResponse) SetNew ¶
func (x *WriteResponse) SetNew(v bool)
func (*WriteResponse) String ¶
func (x *WriteResponse) String() string
type WriteResponse_builder ¶
type WriteResponse_builder struct {
New bool
// contains filtered or unexported fields
}
func (WriteResponse_builder) Build ¶
func (b0 WriteResponse_builder) Build() *WriteResponse