Documentation
¶
Index ¶
- Constants
- Variables
- func Benchmark(p Provider) (int, error)
- func CPUProviderID() uint32
- func GetFiles(dir string, predicate func(os.FileInfo) bool) ([]os.FileInfo, error)
- func LoadMetadata(dir string) (*shared.PostMetadata, error)
- func SaveMetadata(dir string, v *shared.PostMetadata) error
- func SearchForNonce(ctx context.Context, cfg Config, initOpts InitOpts, opts ...searchForNonceOpt) (nonce uint64, nonceValue []byte, err error)
- func SearchWithLogger(logger *zap.Logger) searchForNonceOpt
- type Config
- type ConfigMismatchError
- type DiskState
- type ErrReferenceLabelMismatch
- type InitOpts
- type Initializer
- type Logger
- type OptionFunc
- type Provider
- type Status
Constants ¶
const MetadataFileName = "postdata_metadata.json"
Variables ¶
var ( ErrAlreadyInitializing = errors.New("already initializing") ErrCannotResetWhileInitializing = errors.New("cannot reset while initializing") ErrStateMetadataFileMissing = errors.New("metadata file is missing") )
var ErrNonceNotFound = errors.New("nonce not found")
Functions ¶
func Benchmark ¶ added in v0.6.0
Benchmark returns the hashes per second the selected compute provider achieves on the current machine.
func CPUProviderID ¶
func CPUProviderID() uint32
CPUProviderID returns the ID of the CPU provider or nil if the CPU provider is not available.
func LoadMetadata ¶
func LoadMetadata(dir string) (*shared.PostMetadata, error)
func SaveMetadata ¶
func SaveMetadata(dir string, v *shared.PostMetadata) error
func SearchForNonce ¶ added in v0.8.9
func SearchForNonce( ctx context.Context, cfg Config, initOpts InitOpts, opts ...searchForNonceOpt, ) (nonce uint64, nonceValue []byte, err error)
SearchForNonce is searches for a nonce in the already initialized data. Will return ErrNonceNotFound if no nonce was found. Otherwise, it will return the nonce the 16B of label it points to.
func SearchWithLogger ¶ added in v0.8.9
Types ¶
type ConfigMismatchError ¶
type ConfigMismatchError = shared.ConfigMismatchError
type DiskState ¶
type DiskState struct {
// contains filtered or unexported fields
}
func NewDiskState ¶
func (*DiskState) NumBytesWritten ¶
func (*DiskState) NumFilesWritten ¶ added in v0.3.0
func (*DiskState) NumLabelsWritten ¶
type ErrReferenceLabelMismatch ¶ added in v0.8.8
type ErrReferenceLabelMismatch struct { Index uint64 Commitment []byte Expected []byte Actual []byte }
func (ErrReferenceLabelMismatch) Error ¶ added in v0.8.8
func (e ErrReferenceLabelMismatch) Error() string
type Initializer ¶
type Initializer struct {
// contains filtered or unexported fields
}
Initializer is responsible for initializing a new PoST commitment.
func NewInitializer ¶
func NewInitializer(opts ...OptionFunc) (*Initializer, error)
func (*Initializer) Initialize ¶
func (init *Initializer) Initialize(ctx context.Context) error
Initialize is the process in which the prover commits to store some data, by having its storage filled with pseudo-random data with respect to a specific id. This data is the result of a computationally-expensive operation.
func (*Initializer) Nonce ¶ added in v0.2.2
func (init *Initializer) Nonce() *uint64
func (*Initializer) NonceValue ¶ added in v0.8.10
func (init *Initializer) NonceValue() []byte
func (*Initializer) NumLabelsWritten ¶ added in v0.2.2
func (init *Initializer) NumLabelsWritten() uint64
func (*Initializer) Reset ¶
func (init *Initializer) Reset() error
func (*Initializer) Status ¶ added in v0.2.0
func (init *Initializer) Status() Status
type OptionFunc ¶ added in v0.2.2
type OptionFunc func(*option) error
func WithCommitmentAtxId ¶ added in v0.2.2
func WithCommitmentAtxId(id []byte) OptionFunc
WithCommitmentAtxId sets the ID of the CommitmentATX.
func WithConfig ¶ added in v0.2.0
func WithConfig(cfg Config) OptionFunc
WithConfig sets the config for the initializer.
func WithInitOpts ¶ added in v0.2.0
func WithInitOpts(initOpts config.InitOpts) OptionFunc
WithInitOpts sets the init options for the initializer.
func WithLogger ¶ added in v0.2.0
func WithLogger(logger *zap.Logger) OptionFunc
WithLogger sets the logger for the initializer.
func WithNodeId ¶ added in v0.2.2
func WithNodeId(nodeId []byte) OptionFunc
WithNodeId sets the ID of the Node.
type Provider ¶ added in v0.6.1
func OpenCLProviders ¶ added in v0.6.0
Providers returns a list of available compute providers.