minerecorder

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDatastoreNotSet  = fmt.Errorf("database not set")
	ErrRecorderDisabled = fmt.Errorf("recorder disabled")
)
View Source
var (
	// MaxRecordPerQuery is the max record can be query in one time
	MaxRecordPerQuery uint = 288
	// ExpireEpoch is the num of epoch that record will be expired, default is 7 * 2880 epoch, about 7 days
	ExpireEpoch = abi.ChainEpoch(7 * 2880)

	DatastoreNamespaceKey = datastore.NewKey("/mine-record")
)
View Source
var (
	ErrorRecordNotFound          = datastore.ErrNotFound
	ErrorExceedMaxRecordPerQuery = fmt.Errorf("query exceed MaxRecordPerQuery(%d)", MaxRecordPerQuery)
)

Functions

func Record

func Record(ctx context.Context, miner address.Address, epoch abi.ChainEpoch, r Records) error

func SetDatastore

func SetDatastore(ds datastore.Datastore)

Types

type DefaultRecorder

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

func NewDefaultRecorder

func NewDefaultRecorder(ds datastore.Datastore) *DefaultRecorder

func (*DefaultRecorder) Query

func (d *DefaultRecorder) Query(ctx context.Context, miner address.Address, from abi.ChainEpoch, limit uint) ([]Records, error)

func (*DefaultRecorder) Record

func (d *DefaultRecorder) Record(ctx context.Context, miner address.Address, epoch abi.ChainEpoch, r Records) error

type Recorder

type Recorder interface {
	Record(ctx context.Context, miner address.Address, epoch abi.ChainEpoch, r Records) error
	Query(ctx context.Context, miner address.Address, from abi.ChainEpoch, limit uint) ([]Records, error)
}

type Records

type Records = map[string]string

func Query

func Query(ctx context.Context, miner address.Address, epoch abi.ChainEpoch, limit uint) ([]Records, error)

type SubRecorder

type SubRecorder interface {
	Record(ctx context.Context, r Records)
}

func Sub

func Sub(miner address.Address, epoch abi.ChainEpoch) SubRecorder

Jump to

Keyboard shortcuts

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