net

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0, BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

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

func (vs *VoterServer) Run() error

Run starts the voting server.

func (*VoterServer) Shutdown

func (vs *VoterServer) Shutdown()

Shutdown shutdowns the voting server.

Jump to

Keyboard shortcuts

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