source

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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