swarm

package
v0.0.0-...-b9f6a0d Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package swarm helps a node in the swarm keep track of all the nodes that is connected to it it . it periodically checks to make sure nodes are alive it also helps with message broadcast process

Index

Constants

View Source
const (
	// DefaultRetryDelay ...
	DefaultRetryDelay = 10 * time.Second
	// DefaultMinPeers ...
	DefaultMinPeers = 1
	// DefaultMaxPeers ...
	DefaultMaxPeers = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	sync.Once
	MinPeers   uint32
	MaxPeers   uint32
	RetryDelay time.Duration
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig ...

func (*Config) Init

func (c *Config) Init()

Init ...

type Peer

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

Peer is used by swarm to encode/decode messages to peers

type State

type State uint32

State ...

const (
	// Initialized ...
	Initialized State = iota
	// Running ...
	Running
	// Shutdown ...
	Shutdown
)

func (State) String

func (s State) String() string

String ...

type Swarm

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

Swarm ...

func New

func New(conf *Config, coreConf *core.Config) *Swarm

New ...

func (*Swarm) Handshake

func (s *Swarm) Handshake(conn net.Conn) error

Handshake is called on swarm by gossip Shutdown so that swarm can go through the process of adding it to its list

func (*Swarm) Shutdown

func (s *Swarm) Shutdown() error

Shutdown ...

func (*Swarm) ShutdownCh

func (s *Swarm) ShutdownCh() <-chan struct{}

ShutdownCh ...

func (*Swarm) Start

func (s *Swarm) Start()

Start ...

Jump to

Keyboard shortcuts

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