providerfilters

package
v0.0.0-...-ada256f Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CidFilter

type CidFilter struct{}

CidFilter filters out invalid CID's or those which are not Raw or DagProtobuf.

func NewCidFilter

func NewCidFilter() *CidFilter

NewCidFilter returns a pointer to a new CidFilter.

func (*CidFilter) Filter

func (f *CidFilter) Filter(p t.Provider) (bool, error)

Filter takes a Provider and returns true when it is to be included, false when not and an error when unexpected condition occur.

type Filter

type Filter interface {
	Filter(t.Provider) (bool, error)
}

Filter takes a Provider and returns true when it is to be included, false when not and an error when unexpected condition occur.

type LastSeenFilter

type LastSeenFilter struct {
	Expiration time.Duration
	PruneLen   int
	// contains filtered or unexported fields
}

LastSeenFilter filters out recently seen Providers.

func NewLastSeenFilter

func NewLastSeenFilter(expiration time.Duration, pruneLen int) *LastSeenFilter

NewLastSeenFilter initialises a new LastSeenFilter and returns a pointer to it.

func (*LastSeenFilter) Filter

func (f *LastSeenFilter) Filter(p t.Provider) (bool, error)

Filter takes a Provider and returns true when it is to be included, false when not and an error when unexpected condition occur.

type MockFilter

type MockFilter struct {
	Calls int
	R     bool
	Err   error
	P     types.Provider
}

MockFilter represents a mock for a Filter.

func (*MockFilter) Filter

func (m *MockFilter) Filter(p types.Provider) (bool, error)

Filter returns the specified mock result and/or error and increments calls.

type MultiFilter

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

MultiFilter efficiently combines multiple filters into a single filter.

func NewMultiFilter

func NewMultiFilter(filters ...Filter) *MultiFilter

NewMultiFilter returns a pointer to a new MultiFilter.

func (*MultiFilter) Filter

func (m *MultiFilter) Filter(p t.Provider) (bool, error)

Filter takes a Provider and returns true when it is to be included, false when not and an error when unexpected condition occur.

Jump to

Keyboard shortcuts

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