Documentation ¶
Index ¶
- Variables
- func RegisterVoterQueryServer(s grpc.ServiceRegistrar, srv VoterQueryServer)
- type OpinionRetriever
- type QueryReply
- type QueryRequest
- func (*QueryRequest) Descriptor() ([]byte, []int)deprecated
- func (x *QueryRequest) GetConflictIDs() []string
- func (x *QueryRequest) GetTimestampIDs() []string
- func (*QueryRequest) ProtoMessage()
- func (x *QueryRequest) ProtoReflect() protoreflect.Message
- func (x *QueryRequest) Reset()
- func (x *QueryRequest) String() string
- type UnimplementedVoterQueryServer
- type UnsafeVoterQueryServer
- type VoterQueryClient
- type VoterQueryServer
- type VoterServer
Constants ¶
This section is empty.
Variables ¶
var File_packages_vote_net_query_proto protoreflect.FileDescriptor
Functions ¶
func RegisterVoterQueryServer ¶
func RegisterVoterQueryServer(s grpc.ServiceRegistrar, srv VoterQueryServer)
Types ¶
type OpinionRetriever ¶
type OpinionRetriever func(id string, objectType vote.ObjectType) opinion.Opinion
OpinionRetriever retrieves the opinion for the given ID and object type. If there's no opinion, the function should return Unknown.
type QueryReply ¶
type QueryReply struct { Opinion []int32 `protobuf:"varint,1,rep,packed,name=opinion,proto3" json:"opinion,omitempty"` // contains filtered or unexported fields }
func (*QueryReply) Descriptor
deprecated
func (*QueryReply) Descriptor() ([]byte, []int)
Deprecated: Use QueryReply.ProtoReflect.Descriptor instead.
func (*QueryReply) GetOpinion ¶
func (x *QueryReply) GetOpinion() []int32
func (*QueryReply) ProtoMessage ¶
func (*QueryReply) ProtoMessage()
func (*QueryReply) ProtoReflect ¶ added in v0.2.3
func (x *QueryReply) ProtoReflect() protoreflect.Message
func (*QueryReply) Reset ¶
func (x *QueryReply) Reset()
func (*QueryReply) String ¶
func (x *QueryReply) String() string
type QueryRequest ¶
type QueryRequest struct { ConflictIDs []string `protobuf:"bytes,1,rep,name=conflictIDs,proto3" json:"conflictIDs,omitempty"` TimestampIDs []string `protobuf:"bytes,2,rep,name=timestampIDs,proto3" json:"timestampIDs,omitempty"` // contains filtered or unexported fields }
func (*QueryRequest) Descriptor
deprecated
func (*QueryRequest) Descriptor() ([]byte, []int)
Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.
func (*QueryRequest) GetConflictIDs ¶ added in v0.3.2
func (x *QueryRequest) GetConflictIDs() []string
func (*QueryRequest) GetTimestampIDs ¶ added in v0.3.2
func (x *QueryRequest) GetTimestampIDs() []string
func (*QueryRequest) ProtoMessage ¶
func (*QueryRequest) ProtoMessage()
func (*QueryRequest) ProtoReflect ¶ added in v0.2.3
func (x *QueryRequest) ProtoReflect() protoreflect.Message
func (*QueryRequest) Reset ¶
func (x *QueryRequest) Reset()
func (*QueryRequest) String ¶
func (x *QueryRequest) String() string
type UnimplementedVoterQueryServer ¶
type UnimplementedVoterQueryServer struct { }
UnimplementedVoterQueryServer must be embedded to have forward compatible implementations.
func (UnimplementedVoterQueryServer) Opinion ¶
func (UnimplementedVoterQueryServer) Opinion(context.Context, *QueryRequest) (*QueryReply, error)
type UnsafeVoterQueryServer ¶ added in v0.3.2
type UnsafeVoterQueryServer interface {
// contains filtered or unexported methods
}
UnsafeVoterQueryServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to VoterQueryServer will result in compilation errors.
type VoterQueryClient ¶
type VoterQueryClient interface {
Opinion(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryReply, error)
}
VoterQueryClient is the client API for VoterQuery service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewVoterQueryClient ¶
func NewVoterQueryClient(cc grpc.ClientConnInterface) VoterQueryClient
type VoterQueryServer ¶
type VoterQueryServer interface { Opinion(context.Context, *QueryRequest) (*QueryReply, error) // contains filtered or unexported methods }
VoterQueryServer is the server API for VoterQuery service. All implementations must embed UnimplementedVoterQueryServer for forward compatibility
type VoterServer ¶
type VoterServer struct { UnimplementedVoterQueryServer // contains filtered or unexported fields }
VoterServer is a server which responds to opinion queries.
func New ¶
func New(voter vote.Voter, opnRetriever OpinionRetriever, bindAddr string, netRxEvent, netTxEvent, queryReceivedEvent *events.Event) *VoterServer
New creates a new VoterServer.
func (*VoterServer) Opinion ¶
func (vs *VoterServer) Opinion(ctx context.Context, req *QueryRequest) (*QueryReply, error)
Opinion replies the query request with an opinion and triggers the events.
func (*VoterServer) Shutdown ¶
func (vs *VoterServer) Shutdown()
Shutdown shutdowns the voting server.