net

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2020 License: Apache-2.0, BSD-2-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_query_proto protoreflect.FileDescriptor

Functions

func RegisterVoterQueryServer

func RegisterVoterQueryServer(s *grpc.Server, srv VoterQueryServer)

Types

type OpinionRetriever

type OpinionRetriever func(id string) vote.Opinion

OpinionRetriever retrieves the opinion for the given ID. 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 {
	Id []string `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryRequest) Descriptor deprecated

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

Deprecated: Use QueryRequest.ProtoReflect.Descriptor instead.

func (*QueryRequest) GetId

func (x *QueryRequest) GetId() []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 can be embedded to have forward compatible implementations.

func (*UnimplementedVoterQueryServer) Opinion

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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewVoterQueryClient

func NewVoterQueryClient(cc grpc.ClientConnInterface) VoterQueryClient

type VoterQueryServer

type VoterQueryServer interface {
	Opinion(context.Context, *QueryRequest) (*QueryReply, error)
}

VoterQueryServer is the server API for VoterQuery service.

type VoterServer

type VoterServer struct {
	// 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