prstore

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderRecord

type ProviderRecord struct {
	Key     []byte        // The Key pertaining to the Provider Record.
	Node    string        // The Node in Serialized Address format which is ready to provide that value
	AddedAt int64         // When was the provider record added.
	TTL     int64         // TTL for the Provider Record.
	TTLUnit time.Duration // the Unit of TTL
}

func NewProviderRecord

func NewProviderRecord(key []byte, node string, time int64, ttl int64, unit time.Duration) *ProviderRecord

func (*ProviderRecord) HasExpired

func (pr *ProviderRecord) HasExpired() bool

HasExpired Is the ProviderRecord Expired

type ProviderStore

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

func NewProviderStore

func NewProviderStore(ttl int64, unit time.Duration) *ProviderStore

func (*ProviderStore) AddProvider

func (pr *ProviderStore) AddProvider(key []byte, node string) error

func (*ProviderStore) Contains

func (pr *ProviderStore) Contains(records []*ProviderRecord, node string) bool

func (*ProviderStore) GetProvider

func (pr *ProviderStore) GetProvider(key []byte) ([]string, error)

func (*ProviderStore) PruneOld

func (pr *ProviderStore) PruneOld()

func (*ProviderStore) PruneWorker

func (pr *ProviderStore) PruneWorker()

func (*ProviderStore) UpdateTTL

func (pr *ProviderStore) UpdateTTL(records []*ProviderRecord, node string)

Jump to

Keyboard shortcuts

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