store

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT, MIT Imports: 11 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtendedPeerstore

type ExtendedPeerstore interface {
	peerstore.Peerstore
	ScoreDatastore
	peerstore.CertifiedAddrBook
}

ExtendedPeerstore defines a type-safe API to work with additional peer metadata based on a libp2p peerstore.Peerstore

func NewExtendedPeerstore

func NewExtendedPeerstore(ctx context.Context, ps peerstore.Peerstore, store ds.Batching) (ExtendedPeerstore, error)

type PeerScores

type PeerScores struct {
	Gossip float64
}

type ScoreDatastore

type ScoreDatastore interface {
	// GetPeerScores returns the current scores for the specified peer
	GetPeerScores(id peer.ID) (PeerScores, error)

	// SetScore stores the latest score for the specified peer and score type
	SetScore(id peer.ID, scoreType ScoreType, score float64) error
}

ScoreDatastore defines a type-safe API for getting and setting libp2p peer score information

type ScoreType

type ScoreType int
const (
	TypeGossip ScoreType = iota
)

Jump to

Keyboard shortcuts

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