revcache

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCleaner

func NewCleaner(rc RevCache, s string) *cleaner.Cleaner

NewCleaner creates a cleaner task that deletes expired revocations.

func NoRevokedHopIntf

func NoRevokedHopIntf(ctx context.Context, revCache RevCache,
	s *seg.PathSegment) (bool, error)

NoRevokedHopIntf returns true if there is no on-segment revocation.

Types

type Key

type Key struct {
	IA   addr.IA
	IfID iface.ID
}

Key denotes the key for the revocation cache.

func NewKey

func NewKey(ia addr.IA, ifID iface.ID) Key

NewKey creates a new key for the revocation cache.

func (Key) String

func (k Key) String() string

type ResultChan

type ResultChan <-chan RevOrErr

ResultChan is a channel of results.

type RevCache

type RevCache interface {
	// Get items with the given keys from the cache. Returns all present requested items that are
	// not expired or an error if the query failed.
	Get(ctx context.Context, key Key) (*path_mgmt.RevInfo, error)
	// GetAll returns a channel that will provide all items in the revocation cache. If the cache
	// can't prepare the result channel a nil channel and the error are returned. If the querying
	// succeeded the channel will contain the revocations in the cache, or an error if the stored
	// data could not be parsed. Note that implementations can spawn a goroutine to fill the
	// channel, which means the channel must be fully drained to guarantee the destruction of the
	// goroutine.
	GetAll(ctx context.Context) (ResultChan, error)
	// Insert inserts or updates the given revocation into the cache.
	// Returns whether an insert was performed.
	Insert(ctx context.Context, rev *path_mgmt.RevInfo) (bool, error)
	// DeleteExpired deletes expired entries from the cache.
	// Users of the revcache should make sure to periodically call this method to prevent an
	// ever growing cache.
	// Returns the amount of deleted entries.
	DeleteExpired(ctx context.Context) (int64, error)
	db.LimitSetter
	io.Closer
}

RevCache is a cache for revocations. Revcache implementations must be safe for concurrent usage.

type RevOrErr

type RevOrErr struct {
	Rev *path_mgmt.RevInfo
	Err error
}

RevOrErr is either a revocation or an error.

Directories

Path Synopsis
Package mock_revcache is a generated GoMock package.
Package mock_revcache is a generated GoMock package.

Jump to

Keyboard shortcuts

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