net

package
v0.2.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*QueryReply) Descriptor

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

func (*QueryReply) GetOpinion

func (m *QueryReply) GetOpinion() []int32

func (*QueryReply) ProtoMessage

func (*QueryReply) ProtoMessage()

func (*QueryReply) Reset

func (m *QueryReply) Reset()

func (*QueryReply) String

func (m *QueryReply) String() string

func (*QueryReply) XXX_DiscardUnknown

func (m *QueryReply) XXX_DiscardUnknown()

func (*QueryReply) XXX_Marshal

func (m *QueryReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryReply) XXX_Merge

func (m *QueryReply) XXX_Merge(src proto.Message)

func (*QueryReply) XXX_Size

func (m *QueryReply) XXX_Size() int

func (*QueryReply) XXX_Unmarshal

func (m *QueryReply) XXX_Unmarshal(b []byte) error

type QueryRequest

type QueryRequest struct {
	Id                   []string `protobuf:"bytes,1,rep,name=id,proto3" json:"id,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*QueryRequest) Descriptor

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

func (*QueryRequest) GetId

func (m *QueryRequest) GetId() []string

func (*QueryRequest) ProtoMessage

func (*QueryRequest) ProtoMessage()

func (*QueryRequest) Reset

func (m *QueryRequest) Reset()

func (*QueryRequest) String

func (m *QueryRequest) String() string

func (*QueryRequest) XXX_DiscardUnknown

func (m *QueryRequest) XXX_DiscardUnknown()

func (*QueryRequest) XXX_Marshal

func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryRequest) XXX_Merge

func (m *QueryRequest) XXX_Merge(src proto.Message)

func (*QueryRequest) XXX_Size

func (m *QueryRequest) XXX_Size() int

func (*QueryRequest) XXX_Unmarshal

func (m *QueryRequest) XXX_Unmarshal(b []byte) error

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)

func (*VoterServer) Run

func (vs *VoterServer) Run() error

func (*VoterServer) Shutdown

func (vs *VoterServer) Shutdown()

Jump to

Keyboard shortcuts

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