Documentation ¶
Index ¶
- Constants
- type DB
- func (d *DB) GetBonds(peerID tanka.PeerID) ([]*tanka.Bond, error)
- func (d *DB) GetPeer(peerID tanka.PeerID) (_ *tanka.Peer, err error)
- func (d *DB) RegisterPenalty(peerID tanka.PeerID, stamp time.Time, penaltyID [32]byte, scoreDecrement uint8, ...) error
- func (d *DB) RegisterSuccess(peerID tanka.PeerID, stamp time.Time, refID [32]byte) error
- func (d *DB) Reputation(peerID tanka.PeerID) (rep *tanka.Reputation, err error)
- func (d *DB) StoreBond(newBond *tanka.Bond) (goodBonds []*tanka.Bond, err error)
- type IterationOption
- type KeyValueDB
Constants ¶
View Source
const (
ErrNotFound = dex.ErrorKind("not found")
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func (*DB) RegisterPenalty ¶
func (*DB) RegisterSuccess ¶
func (*DB) Reputation ¶
type IterationOption ¶
type IterationOption struct {
// contains filtered or unexported fields
}
func WithMaxEntries ¶
func WithMaxEntries(max uint64, deleteExcess bool) *IterationOption
func WithPrefix ¶
func WithPrefix(b []byte) *IterationOption
func WithReverse ¶
func WithReverse() *IterationOption
type KeyValueDB ¶
type KeyValueDB interface { Get(k []byte, thing encoding.BinaryUnmarshaler) (bool, error) Store(k []byte, thing encoding.BinaryMarshaler) error Close() error ForEach(f func(k, v []byte) error, opts ...*IterationOption) error Run(context.Context) Delete(k []byte) error }
func NewMemoryDB ¶
func NewMemoryDB() KeyValueDB
Click to show internal directories.
Click to hide internal directories.