gomap

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileBackup

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

FileBackup backs up the peer database to a local file.

func (*FileBackup) Init

func (bck *FileBackup) Init(db storage.Database) error

func (*FileBackup) Load

func (bck *FileBackup) Load() error

func (*FileBackup) Save

func (bck *FileBackup) Save() error

Save encodes and writes the database to a file

type Memory

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

func (*Memory) Backup

func (db *Memory) Backup() storage.Backup

func (*Memory) Check

func (db *Memory) Check() bool

func (*Memory) Drop

func (db *Memory) Drop(hash storage.Hash, id storage.PeerID)

Drop deletes peer

func (*Memory) HashStats

func (db *Memory) HashStats(hash storage.Hash) (complete, incomplete uint16)

HashStats returns number of complete and incomplete peers associated with the hash

func (*Memory) Hashes

func (db *Memory) Hashes() int

Hashes gets the number of hashes

func (*Memory) Init

func (db *Memory) Init(backup storage.Backup) error

func (*Memory) PeerList

func (db *Memory) PeerList(hash storage.Hash, numWant uint, removePeerId bool) (peers [][]byte)

PeerList returns a peer list for the given hash capped at max

func (*Memory) PeerListBytes

func (db *Memory) PeerListBytes(hash storage.Hash, numWant uint) (peers4 []byte, peers6 []byte)

PeerListBytes returns a byte encoded peer list for the given hash capped at num

func (*Memory) Save

func (memoryDb *Memory) Save(ip netip.Addr, port uint16, complete bool, hash storage.Hash, id storage.PeerID)

func (*Memory) SyncExpvars

func (db *Memory) SyncExpvars() error

func (*Memory) Trim

func (db *Memory) Trim()

type NoneBackup

type NoneBackup struct{}

NoneBackup is an empty backup driver. It doesn't back anything up.

func (*NoneBackup) Init

func (bck *NoneBackup) Init(db storage.Database) error

func (NoneBackup) Load

func (bck NoneBackup) Load() error

func (NoneBackup) Save

func (bck NoneBackup) Save() error

type PeerMap

type PeerMap struct {
	Complete   uint16
	Incomplete uint16
	Peers      map[storage.PeerID]*storage.Peer
	// contains filtered or unexported fields
}

type PgBackup

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

PgBackup backs up the peer database to a postgres sql database.

func (*PgBackup) Init

func (bck *PgBackup) Init(db storage.Database) error

func (PgBackup) Load

func (bck PgBackup) Load() error

func (PgBackup) Save

func (bck PgBackup) Save() error

Jump to

Keyboard shortcuts

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