receptor

package
v0.12.5-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2020 License: ISC Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(backupFile string, tree *avl.Tree) error

Backup store all peers into a backup file

func Restore

func Restore(peerFile string, r Receptor) error

Restore peers from a backup file

Types

type Entity

type Entity struct {
	PublicKey []byte
	Listeners []byte
	Timestamp time.Time // last seen time
}

type Receptor

type Receptor interface {
	Add([]byte, []byte, uint64) bool
	SetSelf([]byte, []byte) error
	Next([]byte) ([]byte, []byte, time.Time, error)
	Random([]byte) ([]byte, []byte, time.Time, error)
	ReBalance()
	UpdateTime([]byte, time.Time)
	IsChanged() bool
	Change(bool)
	IsInitialised() bool
	Connectable() *avl.Tree
	ID() id.ID
	Self() *avl.Node
	SelfListener() []byte
	Expire()
}

Receptor - interface for receptor operations

func New

func New(log *logger.L) Receptor

New - return Receptor interface

type StoreEntity

type StoreEntity struct {
	PublicKey []byte
	Listeners []byte
	Timestamp uint64 // last seen time
}

func (StoreEntity) MarshalText

func (e StoreEntity) MarshalText() ([]byte, error)

MarshalText is the json marshal function for PeerItem

func (*StoreEntity) UnmarshalText

func (e *StoreEntity) UnmarshalText(data []byte) error

UnmarshalText is the json unmarshal function for PeerItem

Jump to

Keyboard shortcuts

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