contact

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Error = errs.Class("contact")

Error is the default error class for contact package

Functions

This section is empty.

Types

type Chore

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

Chore is the contact chore for nodes announcing themselves to their trusted satellites

architecture: Chore

func NewChore

func NewChore(log *zap.Logger, interval time.Duration, trust *trust.Pool, dialer rpc.Dialer, service *Service) *Chore

NewChore creates a new contact chore

func (*Chore) Close

func (chore *Chore) Close() error

Close stops all the cycles in the contact chore.

func (*Chore) Pause added in v0.25.0

func (chore *Chore) Pause(ctx context.Context)

Pause stops all the cycles in the contact chore.

func (*Chore) Run

func (chore *Chore) Run(ctx context.Context) (err error)

Run the contact chore on a regular interval with jitter

func (*Chore) Trigger added in v0.34.1

func (chore *Chore) Trigger(ctx context.Context)

Trigger ensures that each cycle is done at least once. If the cycle is currently running it waits for the previous to complete and then runs.

func (*Chore) TriggerWait added in v0.25.0

func (chore *Chore) TriggerWait(ctx context.Context)

TriggerWait ensures that each cycle is done at least once and waits for completion. If the cycle is currently running it waits for the previous to complete and then runs.

type Config

type Config struct {
	ExternalAddress string `user:"true" help:"the public address of the node, useful for nodes behind NAT" default:""`

	// Chore config values
	Interval time.Duration `help:"how frequently the node contact chore should run" releaseDefault:"1h" devDefault:"30s"`
}

Config contains configurable values for contact service

type Endpoint

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

Endpoint implements the contact service Endpoints

architecture: Endpoint

func NewEndpoint

func NewEndpoint(log *zap.Logger, pingStats *PingStats) *Endpoint

NewEndpoint returns a new contact service endpoint

func (*Endpoint) PingNode

func (endpoint *Endpoint) PingNode(ctx context.Context, req *pb.ContactPingRequest) (_ *pb.ContactPingResponse, err error)

PingNode provides an easy way to verify a node is online and accepting requests

type PingStats

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

PingStats contains information regarding when the node was last pinged

func (*PingStats) WasPinged

func (stats *PingStats) WasPinged(when time.Time)

WasPinged notifies the service it has been remotely pinged.

func (*PingStats) WhenLastPinged

func (stats *PingStats) WhenLastPinged() (when time.Time)

WhenLastPinged returns last time someone pinged this node.

type Service added in v0.22.0

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

Service is the contact service between storage nodes and satellites

func NewService added in v0.22.0

func NewService(log *zap.Logger, self *overlay.NodeDossier) *Service

NewService creates a new contact service

func (*Service) Local added in v0.22.0

func (service *Service) Local() overlay.NodeDossier

Local returns the storagenode node-dossier

func (*Service) UpdateSelf added in v0.22.0

func (service *Service) UpdateSelf(capacity *pb.NodeCapacity)

UpdateSelf updates the local node with the capacity

Jump to

Keyboard shortcuts

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