store

package
v2.6.20 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMinerNotExists = errors.New("miner doesn't exists")
)

Functions

This section is empty.

Types

type QueryIndexFilters

type QueryIndexFilters struct {
	MinerLocation string
}

type QueryIndexSort

type QueryIndexSort struct {
	Ascending     bool
	TextileRegion string
	Field         QueryIndexSortField
}

type QueryIndexSortField

type QueryIndexSortField int
const (
	SortFieldTextileDealTotalSuccessful QueryIndexSortField = iota
	SortFieldTextileDealLastSuccessful
	SortFieldTextileRetrievalTotalSuccessful
	SortFieldTextileRetrievalLastSuccessful
	SortFieldAskPrice
	SortFieldVerifiedAskPrice
	SortFieldActiveSectors
)

type Store

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

func New

func New(db *mongo.Database) (*Store, error)

func (*Store) GenerateMinerIndexSnapshot

func (s *Store) GenerateMinerIndexSnapshot(ctx context.Context) error

func (*Store) GetAllMiners

func (s *Store) GetAllMiners(ctx context.Context) ([]model.MinerInfo, error)

func (*Store) GetLastIndexSnapshotTime

func (s *Store) GetLastIndexSnapshotTime(ctx context.Context) (time.Time, error)

func (*Store) GetLastRetrievalRecordUpdatedAt

func (s *Store) GetLastRetrievalRecordUpdatedAt(ctx context.Context, powName string) (time.Time, error)

GetLastRetrievalRecordUpdatedAt returns the latests updated-at timestamp of a particular external Powergate. This might serve to ask the external powergate, for newer records since this timestamp.

func (*Store) GetLastStorageDealRecordUpdatedAt

func (s *Store) GetLastStorageDealRecordUpdatedAt(ctx context.Context, powName string) (time.Time, error)

GetLastStorageDealRecordUpdatedAt returns the latests updated-at timestamp of a particular external Powergate. This might serve to ask the external powergate, for newer records since this timestamp.

func (*Store) GetMinerInfo

func (s *Store) GetMinerInfo(ctx context.Context, miner string) (model.MinerInfo, error)

func (*Store) GetPowergateTargets

func (s *Store) GetPowergateTargets(ctx context.Context) ([]model.PowTarget, error)

GetPowergateTargets returns the external Powergates that will be polled to import storage-deal and retrieval records.

func (*Store) PersistRetrievalRecords

func (s *Store) PersistRetrievalRecords(ctx context.Context, powName, region string, prrs []model.PowRetrievalRecord) error

PersistRetrievalRecords merge a set of retrieval records for an external powergate. The action has upsert semantics, so if the record already exists, it's updated.

func (*Store) PersistStorageDealRecords

func (s *Store) PersistStorageDealRecords(ctx context.Context, powName, region string, psrs []model.PowStorageDealRecord) error

PersistStorageDealRecords merge a set of storage-deal records for an external powergate. The action has upsert semantics, so if the record already exists, it's updated.

func (*Store) PutFilecoinInfo

func (s *Store) PutFilecoinInfo(ctx context.Context, miner string, info model.FilecoinInfo) error

func (*Store) PutMetadataLocation

func (s *Store) PutMetadataLocation(ctx context.Context, miner string, location string) error

func (*Store) QueryIndex

func (s *Store) QueryIndex(ctx context.Context, filters QueryIndexFilters, sort QueryIndexSort, limit int, offset int64) ([]model.MinerInfo, error)

func (*Store) UpdateTextileDealsInfo

func (s *Store) UpdateTextileDealsInfo(ctx context.Context) error

func (*Store) UpdateTextileRetrievalsInfo

func (s *Store) UpdateTextileRetrievalsInfo(ctx context.Context) error

Jump to

Keyboard shortcuts

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