storage

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBORStorage added in v0.9.0

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

func NewCBORStorage added in v0.9.0

func NewCBORStorage(baseDir string, now time.Time) (*CBORStorage, error)

func (*CBORStorage) AddKnown added in v0.9.0

func (bs *CBORStorage) AddKnown(known []KnownPeer) error

AddKnown adds known peers into peers storage with strong error guarantees.

func (*CBORStorage) AddSuspended added in v0.9.0

func (bs *CBORStorage) AddSuspended(suspended []SuspendedPeer) error

AddSuspended adds suspended peers into peers storage with strong error guarantees.

func (*CBORStorage) DeleteKnown added in v0.9.0

func (bs *CBORStorage) DeleteKnown(known []KnownPeer) error

DeleteKnown removes known peers from peers storage with strong error guarantees.

func (*CBORStorage) DeleteSuspendedByIP added in v0.9.0

func (bs *CBORStorage) DeleteSuspendedByIP(suspended []SuspendedPeer) error

DeleteSuspendedByIP removes suspended peers from peers storage with strong error guarantees. Note, that only IP field in input parameter will be used.

func (*CBORStorage) DropKnown added in v0.9.0

func (bs *CBORStorage) DropKnown() error

DropKnown clear known in memory cache and truncates known peers storage file with strong error guarantee.

func (*CBORStorage) DropStorage added in v0.9.0

func (bs *CBORStorage) DropStorage() error

DropStorage clear storage memory cache and truncates storage files. In case of error we can loose suspended peers storage file, but honestly it's almost impossible case.

func (*CBORStorage) DropSuspended added in v0.9.0

func (bs *CBORStorage) DropSuspended() error

DropSuspended clear suspended in memory cache and truncates suspended peers storage file with strong error guarantee.

func (*CBORStorage) IsSuspendedIP added in v0.9.0

func (bs *CBORStorage) IsSuspendedIP(ip IP, now time.Time) bool

func (*CBORStorage) IsSuspendedIPs added in v0.9.0

func (bs *CBORStorage) IsSuspendedIPs(ips []IP, now time.Time) []bool

func (*CBORStorage) Known added in v0.9.0

func (bs *CBORStorage) Known() []KnownPeer

func (*CBORStorage) RefreshSuspended added in v0.9.0

func (bs *CBORStorage) RefreshSuspended(now time.Time) error

RefreshSuspended removes expired peers from suspended peers storage with strong error guarantee.

func (*CBORStorage) Suspended added in v0.9.0

func (bs *CBORStorage) Suspended(now time.Time) []SuspendedPeer

type IP added in v0.9.0

type IP [net.IPv6len]byte

func IPFromString added in v0.9.0

func IPFromString(s string) IP

func IpFromIpPort added in v0.9.0

func IpFromIpPort(ipPort proto.IpPort) IP

func (*IP) String added in v0.9.0

func (i *IP) String() string

type KnownPeer added in v0.9.0

type KnownPeer proto.IpPort

func (*KnownPeer) IP added in v0.9.0

func (kp *KnownPeer) IP() IP

func (*KnownPeer) IpPort added in v0.9.0

func (kp *KnownPeer) IpPort() proto.IpPort

func (*KnownPeer) String added in v0.9.0

func (kp *KnownPeer) String() string

type SuspendedPeer added in v0.9.0

type SuspendedPeer struct {
	IP                     IP            `cbor:"0,keyasint,omitemtpy"`
	SuspendTimestampMillis int64         `cbor:"1,keyasint,omitemtpy"`
	SuspendDuration        time.Duration `cbor:"2,keyasint,omitemtpy"`
	Reason                 string        `cbor:"3,keyasint,omitemtpy"`
}

func (*SuspendedPeer) AwakeTime added in v0.9.0

func (sp *SuspendedPeer) AwakeTime() time.Time

func (*SuspendedPeer) IsSuspended added in v0.9.0

func (sp *SuspendedPeer) IsSuspended(now time.Time) bool

func (*SuspendedPeer) SuspendTime added in v0.9.0

func (sp *SuspendedPeer) SuspendTime() time.Time

Jump to

Keyboard shortcuts

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