work

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PowRepo

type PowRepo struct {
	W proofofwork.ProofOfWork
}

PowRepo is the repository for proof of work

func (*PowRepo) GetName

func (p *PowRepo) GetName() string

GetName will return the name of the work type

func (*PowRepo) GetTicketOutput

func (p *PowRepo) GetTicketOutput() string

GetTicketOutput will return the output that is stored inside a ticket

func (*PowRepo) GetWorkOutput

func (p *PowRepo) GetWorkOutput() map[string]interface{}

GetWorkOutput will return a list of data that will be returned in the ticket

func (*PowRepo) GetWorkProofOutput

func (p *PowRepo) GetWorkProofOutput() map[string]interface{}

GetWorkProofOutput will return the proof / work done that will be send back to the server

func (*PowRepo) MarshalJSON

func (p *PowRepo) MarshalJSON() (data []byte, err error)

MarshalJSON will return a marshalled version of the pow repository

func (*PowRepo) ValidateWork

func (p *PowRepo) ValidateWork(data []byte) bool

ValidateWork will validate the work data

func (*PowRepo) Work

func (p *PowRepo) Work()

Work will actually do the work

type PowResultType

type PowResultType struct {
	Proof uint64
}

PowResultType is the result that gets returned when done the work

type Repository

type Repository interface {
	GetName() string
	GetWorkOutput() map[string]interface{}
	GetWorkProofOutput() map[string]interface{}
	ValidateWork(data []byte) bool
	Work()
}

Repository is the main interface for work types

func GetPreferredWork

func GetPreferredWork(preferences []string) (Repository, error)

GetPreferredWork will fetch work by taken the preference into account

func NewPow

func NewPow() (Repository, error)

NewPow will return a new proof-of-work repository filled

func NewPowFromString

func NewPowFromString(s string) (Repository, error)

NewPowFromString will return a new pow structure taken from a string representation

Jump to

Keyboard shortcuts

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