source

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrAlreadyExists returns when the soure already exists in Store.
	ErrAlreadyExists = errors.New("source already exists")
	// ErrDoesntExists returns when the source isn't in the Store.
	ErrDoesntExists = errors.New("source doesn't exist")
)

Functions

This section is empty.

Types

type Source

type Source struct {
	ID          string
	Weight      float64
	Scores      map[string]int
	Maddr       ma.Multiaddr
	LastFetched *time.Time
}

Source is an external source of reputation information.

func (*Source) Refresh

func (s *Source) Refresh(ctx context.Context) error

Refresh pulls fresh information from source.

type Store

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

Store contains Sources information.

func NewStore

func NewStore(ds datastore.TxnDatastore) *Store

NewStore returns a new SourceStore.

func (*Store) Add

func (ss *Store) Add(s Source) error

Add adds a new Source to the store.

func (*Store) GetAll

func (ss *Store) GetAll() ([]Source, error)

GetAll returns all Sources.

func (*Store) Update

func (ss *Store) Update(s Source) error

Update updates a Source.

Jump to

Keyboard shortcuts

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