powergate: github.com/textileio/powergate/reputation/internal/source Index | Files

package source

import "github.com/textileio/powergate/reputation/internal/source"

Index

Package Files

source.go store.go

Variables

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")
)

type Source Uses

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 Uses

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

Refresh pulls fresh information from source.

type Store Uses

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

Store contains Sources information.

func NewStore Uses

func NewStore(ds datastore.TxnDatastore) *Store

NewStore returns a new SourceStore.

func (*Store) Add Uses

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

Add adds a new Source to the store.

func (*Store) GetAll Uses

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

GetAll returns all Sources.

func (*Store) Update Uses

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

Update updates a Source.

Package source imports 8 packages (graph) and is imported by 3 packages. Updated 2020-06-08. Refresh now. Tools for package owners.