network

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_network_proto protoreflect.FileDescriptor

Functions

func RegisterNetworkServer

func RegisterNetworkServer(s *grpc.Server, srv NetworkServer)

Types

type AdvertHash

type AdvertHash struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

Actual messages go here

func (*AdvertHash) Descriptor deprecated

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

Deprecated: Use AdvertHash.ProtoReflect.Descriptor instead.

func (*AdvertHash) GetHash

func (x *AdvertHash) GetHash() []byte

func (*AdvertHash) ProtoMessage

func (*AdvertHash) ProtoMessage()

func (*AdvertHash) ProtoReflect

func (x *AdvertHash) ProtoReflect() protoreflect.Message

func (*AdvertHash) Reset

func (x *AdvertHash) Reset()

func (*AdvertHash) String

func (x *AdvertHash) String() string

type Document

type Document struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Time int64  `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"`
	Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*Document) Descriptor deprecated

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

Deprecated: Use Document.ProtoReflect.Descriptor instead.

func (*Document) GetHash

func (x *Document) GetHash() []byte

func (*Document) GetTime

func (x *Document) GetTime() int64

func (*Document) GetType

func (x *Document) GetType() string

func (*Document) ProtoMessage

func (*Document) ProtoMessage()

func (*Document) ProtoReflect

func (x *Document) ProtoReflect() protoreflect.Message

func (*Document) Reset

func (x *Document) Reset()

func (*Document) String

func (x *Document) String() string

type DocumentContents

type DocumentContents struct {
	Hash     []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Contents []byte `protobuf:"bytes,10,opt,name=contents,proto3" json:"contents,omitempty"`
	// contains filtered or unexported fields
}

func (*DocumentContents) Descriptor deprecated

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

Deprecated: Use DocumentContents.ProtoReflect.Descriptor instead.

func (*DocumentContents) GetContents

func (x *DocumentContents) GetContents() []byte

func (*DocumentContents) GetHash

func (x *DocumentContents) GetHash() []byte

func (*DocumentContents) ProtoMessage

func (*DocumentContents) ProtoMessage()

func (*DocumentContents) ProtoReflect

func (x *DocumentContents) ProtoReflect() protoreflect.Message

func (*DocumentContents) Reset

func (x *DocumentContents) Reset()

func (*DocumentContents) String

func (x *DocumentContents) String() string

type DocumentContentsQuery

type DocumentContentsQuery struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

Message to ask for a peer for a specific document

func (*DocumentContentsQuery) Descriptor deprecated

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

Deprecated: Use DocumentContentsQuery.ProtoReflect.Descriptor instead.

func (*DocumentContentsQuery) GetHash

func (x *DocumentContentsQuery) GetHash() []byte

func (*DocumentContentsQuery) ProtoMessage

func (*DocumentContentsQuery) ProtoMessage()

func (*DocumentContentsQuery) ProtoReflect

func (x *DocumentContentsQuery) ProtoReflect() protoreflect.Message

func (*DocumentContentsQuery) Reset

func (x *DocumentContentsQuery) Reset()

func (*DocumentContentsQuery) String

func (x *DocumentContentsQuery) String() string

type HashList

type HashList struct {
	Hashes []*Document `protobuf:"bytes,1,rep,name=hashes,proto3" json:"hashes,omitempty"`
	// contains filtered or unexported fields
}

Message to inform a peer of our hash list

func (*HashList) Descriptor deprecated

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

Deprecated: Use HashList.ProtoReflect.Descriptor instead.

func (*HashList) GetHashes

func (x *HashList) GetHashes() []*Document

func (*HashList) ProtoMessage

func (*HashList) ProtoMessage()

func (*HashList) ProtoReflect

func (x *HashList) ProtoReflect() protoreflect.Message

func (*HashList) Reset

func (x *HashList) Reset()

func (*HashList) String

func (x *HashList) String() string

type HashListQuery

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

Message to ask for a peer's hash list

func (*HashListQuery) Descriptor deprecated

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

Deprecated: Use HashListQuery.ProtoReflect.Descriptor instead.

func (*HashListQuery) ProtoMessage

func (*HashListQuery) ProtoMessage()

func (*HashListQuery) ProtoReflect

func (x *HashListQuery) ProtoReflect() protoreflect.Message

func (*HashListQuery) Reset

func (x *HashListQuery) Reset()

func (*HashListQuery) String

func (x *HashListQuery) String() string
type Header struct {
	Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	// contains filtered or unexported fields
}

Metadata types

func (*Header) Descriptor deprecated

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

Deprecated: Use Header.ProtoReflect.Descriptor instead.

func (*Header) GetVersion

func (x *Header) GetVersion() uint32

func (*Header) ProtoMessage

func (*Header) ProtoMessage()

func (*Header) ProtoReflect

func (x *Header) ProtoReflect() protoreflect.Message

func (*Header) Reset

func (x *Header) Reset()

func (*Header) String

func (x *Header) String() string

type NetworkClient

type NetworkClient interface {
	Connect(ctx context.Context, opts ...grpc.CallOption) (Network_ConnectClient, error)
}

NetworkClient is the client API for Network service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewNetworkClient

func NewNetworkClient(cc grpc.ClientConnInterface) NetworkClient

type NetworkMessage

type NetworkMessage struct {
	Header                *Header                `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	AdvertHash            *AdvertHash            `protobuf:"bytes,100,opt,name=advertHash,proto3" json:"advertHash,omitempty"`
	HashListQuery         *HashListQuery         `protobuf:"bytes,101,opt,name=hashListQuery,proto3" json:"hashListQuery,omitempty"`
	HashList              *HashList              `protobuf:"bytes,102,opt,name=hashList,proto3" json:"hashList,omitempty"`
	DocumentContentsQuery *DocumentContentsQuery `protobuf:"bytes,103,opt,name=documentContentsQuery,proto3" json:"documentContentsQuery,omitempty"`
	DocumentContents      *DocumentContents      `protobuf:"bytes,104,opt,name=documentContents,proto3" json:"documentContents,omitempty"`
	// contains filtered or unexported fields
}

We multiplex all of our messages over a single super-message type, because we're using streams. If we did not do that, we'd need to open a stream per operation, which would make the number of required streams explode (since we're building a full mesh network).

func (*NetworkMessage) Descriptor deprecated

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

Deprecated: Use NetworkMessage.ProtoReflect.Descriptor instead.

func (*NetworkMessage) GetAdvertHash

func (x *NetworkMessage) GetAdvertHash() *AdvertHash

func (*NetworkMessage) GetDocumentContents

func (x *NetworkMessage) GetDocumentContents() *DocumentContents

func (*NetworkMessage) GetDocumentContentsQuery

func (x *NetworkMessage) GetDocumentContentsQuery() *DocumentContentsQuery

func (*NetworkMessage) GetHashList

func (x *NetworkMessage) GetHashList() *HashList

func (*NetworkMessage) GetHashListQuery

func (x *NetworkMessage) GetHashListQuery() *HashListQuery

func (*NetworkMessage) GetHeader

func (x *NetworkMessage) GetHeader() *Header

func (*NetworkMessage) ProtoMessage

func (*NetworkMessage) ProtoMessage()

func (*NetworkMessage) ProtoReflect

func (x *NetworkMessage) ProtoReflect() protoreflect.Message

func (*NetworkMessage) Reset

func (x *NetworkMessage) Reset()

func (*NetworkMessage) String

func (x *NetworkMessage) String() string

type NetworkServer

type NetworkServer interface {
	Connect(Network_ConnectServer) error
}

NetworkServer is the server API for Network service.

type Network_ConnectClient

type Network_ConnectClient interface {
	Send(*NetworkMessage) error
	Recv() (*NetworkMessage, error)
	grpc.ClientStream
}

type Network_ConnectServer

type Network_ConnectServer interface {
	Send(*NetworkMessage) error
	Recv() (*NetworkMessage, error)
	grpc.ServerStream
}

type UnimplementedNetworkServer

type UnimplementedNetworkServer struct {
}

UnimplementedNetworkServer can be embedded to have forward compatible implementations.

func (*UnimplementedNetworkServer) Connect

Jump to

Keyboard shortcuts

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