Documentation ¶
Index ¶
- type CBORStorage
- func (bs *CBORStorage) AddKnown(known []KnownPeer) error
- func (bs *CBORStorage) AddSuspended(suspended []SuspendedPeer) error
- func (bs *CBORStorage) DeleteKnown(known []KnownPeer) error
- func (bs *CBORStorage) DeleteSuspendedByIP(suspended []SuspendedPeer) error
- func (bs *CBORStorage) DropKnown() error
- func (bs *CBORStorage) DropStorage() error
- func (bs *CBORStorage) DropSuspended() error
- func (bs *CBORStorage) IsSuspendedIP(ip IP, now time.Time) bool
- func (bs *CBORStorage) IsSuspendedIPs(ips []IP, now time.Time) []bool
- func (bs *CBORStorage) Known() []KnownPeer
- func (bs *CBORStorage) RefreshSuspended(now time.Time) error
- func (bs *CBORStorage) Suspended(now time.Time) []SuspendedPeer
- type IP
- type KnownPeer
- type SuspendedPeer
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 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