contact

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chore

type Chore struct {
	Loop *sync2.Cycle
	// 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, maxSleep time.Duration, trust *trust.Pool, transport transport.Client, rt *kademlia.RoutingTable) *Chore

NewChore creates a new contact chore

func (*Chore) Close

func (chore *Chore) Close() error

Close stops 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

type Config

type Config struct {
	Interval time.Duration `help:"how frequently the node contact chore should run" releaseDefault:"1h" devDefault:"30s"`
	// MaxSleep should remain at default value to decrease traffic congestion to satellite
	MaxSleep time.Duration `help:"maximum duration to wait before pinging satellites" releaseDefault:"45m" devDefault:"0s" hidden:"true"`
}

Config contains configurable parameters for contact chore

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 who and when the node was last pinged

func (*PingStats) WasPinged

func (stats *PingStats) WasPinged(when time.Time, srcNodeID storj.NodeID, srcAddress string)

WasPinged notifies the service it has been remotely pinged.

func (*PingStats) WhenLastPinged

func (stats *PingStats) WhenLastPinged() (when time.Time, who storj.NodeID, addr string)

WhenLastPinged returns last time someone pinged this node.

Jump to

Keyboard shortcuts

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