protocol

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetadata

func NewMetadata(host host.Host, messageID string, gossip bool) *pb.Metadata

NewMetadata helper method - generate message data shared between all node's p2p protocols messageId: unique for requests, copied from request for responses

func SendProtoMessage

func SendProtoMessage(host host.Host, id peer.ID, p protocol.ID, data proto.Message) bool

SendProtoMessage helper method - writes a protobuf go data object to a network stream data: reference of protobuf go data object to send (not the object itself) s: network stream to write the data to

Types

type BallotProtocol

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

BallotProtocol type

func (*BallotProtocol) SubmitRequest

func (sp *BallotProtocol) SubmitRequest(peerID peer.ID, subjectHash *subject.Hash, ch chan<- []string) bool

SubmitRequest ... TODO: use callback instead of channel

type IdentityProtocol

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

IdentityProtocol type

func (*IdentityProtocol) SubmitRequest

func (sp *IdentityProtocol) SubmitRequest(peerID peer.ID, subjectHash *subject.Hash, ch chan<- []string) bool

SubmitRequest ... TODO: use callback instead of channel

type Protocol

type Protocol interface {
	SubmitRequest(peerID peer.ID, subjectHash *subject.Hash, ch chan<- []string) bool
	// contains filtered or unexported methods
}

func NewBallotProtocol

func NewBallotProtocol(context *context.Context) Protocol

NewBallotProtocol ...

func NewIdentityProtocol

func NewIdentityProtocol(context *context.Context) Protocol

NewIdentityProtocol ...

func NewProtocol

func NewProtocol(t ProtocolType, context *context.Context) Protocol

NewProtocol .

func NewSubjectProtocol

func NewSubjectProtocol(context *context.Context) Protocol

NewSubjectProtocol ...

type ProtocolType

type ProtocolType int
const (
	BallotProtocolType ProtocolType = 1 << iota
	IdentityProtocolType
	SubjectProtocolType
)

type SubjectProtocol

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

SubjectProtocol type

func (*SubjectProtocol) SubmitRequest

func (sp *SubjectProtocol) SubmitRequest(peerID peer.ID, subjectHash *subject.Hash, ch chan<- []string) bool

SubmitRequest ... TODO: use callback instead of channel

Jump to

Keyboard shortcuts

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