service

package
v0.0.0-...-6a09fb9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package service is a generated protocol buffer package.

It is generated from these files:

service.proto

It has these top-level messages:

WhisperMessage
WhisperAck
NodeMessage
NodeRequestReply
NodeRequestMessage
NodeInformMessage

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterInformServiceServer

func RegisterInformServiceServer(s *grpc.Server, srv InformServiceServer)

func RegisterNameServer

func RegisterNameServer(s *grpc.Server, srv NameServer)

func RegisterWhisperServer

func RegisterWhisperServer(s *grpc.Server, srv WhisperServer)

Types

type InformServiceClient

type InformServiceClient interface {
	InformNode(ctx context.Context, in *NodeInformMessage, opts ...grpc.CallOption) (*NodeInformMessage, error)
	RequestNode(ctx context.Context, in *NodeRequestMessage, opts ...grpc.CallOption) (*NodeRequestReply, error)
}

func NewInformServiceClient

func NewInformServiceClient(cc *grpc.ClientConn) InformServiceClient

type InformServiceServer

type InformServiceServer interface {
	InformNode(context.Context, *NodeInformMessage) (*NodeInformMessage, error)
	RequestNode(context.Context, *NodeRequestMessage) (*NodeRequestReply, error)
}

type NameClient

type NameClient interface {
	SayName(ctx context.Context, in *NodeMessage, opts ...grpc.CallOption) (*NodeMessage, error)
}

func NewNameClient

func NewNameClient(cc *grpc.ClientConn) NameClient

type NameServer

type NameServer interface {
	SayName(context.Context, *NodeMessage) (*NodeMessage, error)
}

type Node

type Node struct {
	Host string
	Port int
	Name string
	Pool Pool
}

Node defines the structure of a node

type NodeInformMessage

type NodeInformMessage struct {
	Informer *NodeMessage   `protobuf:"bytes,1,opt,name=informer" json:"informer,omitempty"`
	Pool     []*NodeMessage `protobuf:"bytes,2,rep,name=pool" json:"pool,omitempty"`
}

func (*NodeInformMessage) Descriptor

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

func (*NodeInformMessage) GetInformer

func (m *NodeInformMessage) GetInformer() *NodeMessage

func (*NodeInformMessage) GetPool

func (m *NodeInformMessage) GetPool() []*NodeMessage

func (*NodeInformMessage) ProtoMessage

func (*NodeInformMessage) ProtoMessage()

func (*NodeInformMessage) Reset

func (m *NodeInformMessage) Reset()

func (*NodeInformMessage) String

func (m *NodeInformMessage) String() string

type NodeMessage

type NodeMessage struct {
	Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
	Host string `protobuf:"bytes,2,opt,name=host" json:"host,omitempty"`
	Port int32  `protobuf:"varint,3,opt,name=port" json:"port,omitempty"`
}

func (*NodeMessage) Descriptor

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

func (*NodeMessage) GetHost

func (m *NodeMessage) GetHost() string

func (*NodeMessage) GetName

func (m *NodeMessage) GetName() string

func (*NodeMessage) GetPort

func (m *NodeMessage) GetPort() int32

func (*NodeMessage) ProtoMessage

func (*NodeMessage) ProtoMessage()

func (*NodeMessage) Reset

func (m *NodeMessage) Reset()

func (*NodeMessage) String

func (m *NodeMessage) String() string

type NodeRequestMessage

type NodeRequestMessage struct {
	Informer *NodeMessage `protobuf:"bytes,1,opt,name=informer" json:"informer,omitempty"`
	Request  string       `protobuf:"bytes,2,opt,name=request" json:"request,omitempty"`
	Exclude  []string     `protobuf:"bytes,3,rep,name=exclude" json:"exclude,omitempty"`
}

func (*NodeRequestMessage) Descriptor

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

func (*NodeRequestMessage) GetExclude

func (m *NodeRequestMessage) GetExclude() []string

func (*NodeRequestMessage) GetInformer

func (m *NodeRequestMessage) GetInformer() *NodeMessage

func (*NodeRequestMessage) GetRequest

func (m *NodeRequestMessage) GetRequest() string

func (*NodeRequestMessage) ProtoMessage

func (*NodeRequestMessage) ProtoMessage()

func (*NodeRequestMessage) Reset

func (m *NodeRequestMessage) Reset()

func (*NodeRequestMessage) String

func (m *NodeRequestMessage) String() string

type NodeRequestReply

type NodeRequestReply struct {
	Found    bool         `protobuf:"varint,1,opt,name=found" json:"found,omitempty"`
	Contents *NodeMessage `protobuf:"bytes,2,opt,name=contents" json:"contents,omitempty"`
}

func (*NodeRequestReply) Descriptor

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

func (*NodeRequestReply) GetContents

func (m *NodeRequestReply) GetContents() *NodeMessage

func (*NodeRequestReply) GetFound

func (m *NodeRequestReply) GetFound() bool

func (*NodeRequestReply) ProtoMessage

func (*NodeRequestReply) ProtoMessage()

func (*NodeRequestReply) Reset

func (m *NodeRequestReply) Reset()

func (*NodeRequestReply) String

func (m *NodeRequestReply) String() string

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

Pool defines a pool of Nodes

type ResponseMessage

type ResponseMessage struct {
	Status    string
	Responder string
	Body      string
}

ResponseMessage defines the HTTP API Response structure

type Server

type Server struct {
	Srv  *http.Server
	Host string
	Port int
	Name string
	Me   *Node
	// contains filtered or unexported fields
}

Server defines the http API Server

func (*Server) AddNodeToPool

func (s *Server) AddNodeToPool(node *NodeMessage) error

AddNodeToPool checks for a nodes existence in its pool and adds if it doesn't

func (*Server) AskPeersForNode

func (s *Server) AskPeersForNode(name string, exclude []string) error

AskPeersForNode asks the peers for a node

func (*Server) BuildInformPool

func (s *Server) BuildInformPool(name string, port int) *NodeInformMessage

BuildInformPool builds the pool in a format for gRPC

func (*Server) CheckPoolForNode

func (s *Server) CheckPoolForNode(node *NodeMessage) bool

CheckPoolForNode checks my pool for a nodes name and port

func (*Server) CheckPoolForNodeByName

func (s *Server) CheckPoolForNodeByName(name string) (*NodeMessage, bool)

CheckPoolForNodeByName checks my pool for nodes by name

func (*Server) InformNode

func (s *Server) InformNode(ctx context.Context, in *NodeInformMessage) (*NodeInformMessage, error)

InformNode informs the target node of who it is, and retrieves the others identity

func (*Server) InformPoolOfNodes

func (s *Server) InformPoolOfNodes() error

InformPoolOfNodes informs the entire pool of changes to its pool

func (*Server) MessageToNode

func (s *Server) MessageToNode(inNode *NodeMessage) *Node

MessageToNode converts NodeMessage{} to Node{}

func (*Server) NewListener

func (s *Server) NewListener() cmux.CMux

NewListener generates a new listener object and returns a mux of it

func (*Server) NewServer

func (s *Server) NewServer(r *mux.Router) *http.Server

NewServer generates a new server object for http connections

func (*Server) NodeToMessage

func (s *Server) NodeToMessage(inNode *Node) *NodeMessage

NodeToMessage converts Node{} to NodeMessage{}

func (*Server) RequestNode

func (s *Server) RequestNode(ctx context.Context, in *NodeRequestMessage) (*NodeRequestReply, error)

RequestNode responds to a request to check our pool for a specific node

func (*Server) SayName

func (s *Server) SayName(ctx context.Context, in *NodeMessage) (*NodeMessage, error)

SayName generates a response to a Name request

func (*Server) SendWhisper

func (s *Server) SendWhisper(ctx context.Context, in *WhisperMessage) (*WhisperAck, error)

SendWhisper receives and processes a sent whisper and may respond with a receipt

func (*Server) Start

func (s *Server) Start(nodePool string) error

Start is the external entrypoint to boot up and listen

type WhisperAck

type WhisperAck struct {
	Response bool `protobuf:"varint,1,opt,name=response" json:"response,omitempty"`
}

func (*WhisperAck) Descriptor

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

func (*WhisperAck) GetResponse

func (m *WhisperAck) GetResponse() bool

func (*WhisperAck) ProtoMessage

func (*WhisperAck) ProtoMessage()

func (*WhisperAck) Reset

func (m *WhisperAck) Reset()

func (*WhisperAck) String

func (m *WhisperAck) String() string

type WhisperClient

type WhisperClient interface {
	SendWhisper(ctx context.Context, in *WhisperMessage, opts ...grpc.CallOption) (*WhisperAck, error)
}

func NewWhisperClient

func NewWhisperClient(cc *grpc.ClientConn) WhisperClient

type WhisperMessage

type WhisperMessage struct {
	Source string `protobuf:"bytes,1,opt,name=source" json:"source,omitempty"`
	Body   string `protobuf:"bytes,2,opt,name=body" json:"body,omitempty"`
}

func (*WhisperMessage) Descriptor

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

func (*WhisperMessage) GetBody

func (m *WhisperMessage) GetBody() string

func (*WhisperMessage) GetSource

func (m *WhisperMessage) GetSource() string

func (*WhisperMessage) ProtoMessage

func (*WhisperMessage) ProtoMessage()

func (*WhisperMessage) Reset

func (m *WhisperMessage) Reset()

func (*WhisperMessage) String

func (m *WhisperMessage) String() string

type WhisperServer

type WhisperServer interface {
	SendWhisper(context.Context, *WhisperMessage) (*WhisperAck, error)
}

Jump to

Keyboard shortcuts

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