exchange

package
v0.0.0-...-e121adf Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeProtocol

type ExchangeProtocol struct {
	Id   string // my id
	Addr string // my addr

	Peers            map[string]string     // all peers' id and address
	SkipSubjectPeers map[string]*IgnoreSet // skip sending reports about a subject to certain peers

	Clients map[string]pb.HealthServiceClient // clients to all peers
	// contains filtered or unexported fields
}

func NewExchangeProtocol

func NewExchangeProtocol(config *dt.HealthServerConfig) *ExchangeProtocol

func (*ExchangeProtocol) Interested

func (self *ExchangeProtocol) Interested(peer string, subject string) bool

func (*ExchangeProtocol) Ping

func (self *ExchangeProtocol) Ping(peer string) (*pb.PingReply, error)

func (*ExchangeProtocol) PingAll

func (self *ExchangeProtocol) PingAll() (map[string]*pb.PingReply, error)

func (*ExchangeProtocol) Propagate

func (self *ExchangeProtocol) Propagate(report *pb.Report) error

func (*ExchangeProtocol) PropagateAll

func (self *ExchangeProtocol) PropagateAll(request *pb.LearnReportRequest) error

func (*ExchangeProtocol) PropagatePeer

func (self *ExchangeProtocol) PropagatePeer(peer string, addr string, ignoreset *IgnoreSet, request *pb.LearnReportRequest) (bool, error, time.Duration)

Propagate something to a peer. This something could be a normal report or a subscription/unsubscription request. In the former case, we should check if the receiver peer is interested in knowing the report. If not, we should stop propagating the report to the receiver in the future until it becomes interested in the report again.

func (*ExchangeProtocol) Subscribe

func (self *ExchangeProtocol) Subscribe(subject string) error

func (*ExchangeProtocol) Uninterested

func (self *ExchangeProtocol) Uninterested(peer string, subject string) bool

func (*ExchangeProtocol) Unsubscribe

func (self *ExchangeProtocol) Unsubscribe(subject string) error

type IgnoreSet

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

func NewIgnoreSet

func NewIgnoreSet() *IgnoreSet

func (*IgnoreSet) Remove

func (self *IgnoreSet) Remove(subject string, peer string)

func (*IgnoreSet) Set

func (self *IgnoreSet) Set(peer string)

func (*IgnoreSet) Test

func (self *IgnoreSet) Test(peer string) bool

Jump to

Keyboard shortcuts

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