storage

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackListedPeer added in v0.10.2

type BlackListedPeer = restrictedPeer

func NewBlackListedPeer added in v0.10.2

func NewBlackListedPeer(ip IP, blackListTimestampMillis int64, blackListDuration time.Duration, reason string) BlackListedPeer

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) AddOrUpdateKnown added in v0.10.0

func (bs *CBORStorage) AddOrUpdateKnown(known []KnownPeer, now time.Time) error

AddOrUpdateKnown adds known peers with now timestamp 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) AddToBlackList added in v0.10.2

func (bs *CBORStorage) AddToBlackList(blackListed []BlackListedPeer) error

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

func (*CBORStorage) BlackList added in v0.10.2

func (bs *CBORStorage) BlackList(now time.Time) []BlackListedPeer

func (*CBORStorage) DeleteBlackListedByIP added in v0.10.2

func (bs *CBORStorage) DeleteBlackListedByIP(restricted []BlackListedPeer) error

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) DropBlackList added in v0.10.2

func (bs *CBORStorage) DropBlackList() error

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 lose 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) IsBlackListedIP added in v0.10.2

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

func (*CBORStorage) IsBlackListedIPs added in v0.10.2

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

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(limit int) []KnownPeer

func (*CBORStorage) RefreshBlackList added in v0.10.2

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

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 = restrictedPeer

func NewSuspendedPeer added in v0.10.2

func NewSuspendedPeer(ip IP, suspendTimestampMillis int64, suspendDuration time.Duration, reason string) SuspendedPeer

Jump to

Keyboard shortcuts

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