internal

package
v0.0.0-...-4e98154 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeInfo

type NodeInfo struct {
	HostInfo host.InfoStat `json:"hostInfo,omitempty"`
	CPUInfo  cpuinfo       `json:"cpuInfo,omitempty"`
	Workers  int           `json:"workers,omitempty"`
}

NodeInfo holds some somewhat arbitrary info about a worker node.

func CPUInfo

func CPUInfo() (*NodeInfo, error)

CPUInfo returns the data about this specific node, to be used in reports as-is.

type UserCredentials

type UserCredentials struct {
	UserID            string `json:"userID,omitempty"`
	UserSecretVersion string `json:"userSecretVersion,omitempty"`
	UserSecret        string `json:"userSecret,omitempty"`
}

UserCredentials hold the userid, secret, and secret version we will use to authenticate. The UserSecret is the only part that is strictly confidential. Using a UserSecretVersion allows rotation of the secret if one is compromised, while maintaining some amount of trust in what was already submitted.

type WorkAuthenticator

type WorkAuthenticator struct {
	AuthenticatorVersion string `json:"authenticatorVersion,omitempty"`
	UserSecretVersion    string `json:"userSecretVersion,omitempty"`
	Authenticator        string `json:"authenticator,omitempty"`
}

WorkAuthenticator is a signature on the work we performed.

type WorkEvidence

type WorkEvidence struct {
	TotalIterations uint64 `json:"totalIterations,omitempty"`
	MaxIterations   uint64 `json:"maxIterations,omitempty"`
}

WorkEvidence is used for proving work was performed. For non-"complete" status updates, these should be set to zero.

type WorkPacket

type WorkPacket struct {
	// ID is the work packet ID, assigned by the server.
	ID string `json:"id,omitempty"`

	// Nonce is used as a work authenticator.
	Nonce string `json:"nonce,omitempty"`

	// StartingValue is the first number (inclusive) to check.
	StartingValue *big.Int `json:"startingValue,omitempty"`

	// EndingValue is the last number (inclusive) to check.
	EndingValue *big.Int `json:"endingValue,omitempty"`

	// AssignedOn is when this work item was assigned.
	AssignedOn time.Time `json:"assignedOn,omitempty"`

	// Expiry indicates a cutoff time after which
	// this work item may be considered abandoned, and reassigned.
	// This is not exactly a hard cut-off, and if the work is
	// completed after this time, if the evidence is accepted,
	// work will still be considered complete.
	Expiry time.Time `json:"expiry,omitempty"`
}

WorkPacket is a message from the server to incidate a work item.

type WorkProgressReport

type WorkProgressReport struct {
	Work WorkPacket `json:"work,omitempty"`

	// NodeInfo is the collected node info for where this work
	// was performed.
	NodeInfo NodeInfo `json:"nodeInfo,omitempty"`

	// WorkerID is the specific worker thread which completed this
	// work unit.
	WorkerID int `json:"workerID,omitempty"`

	// Status indicates why we are sending this report.
	//   pending = in our work list, but not yet started.
	//   running = currently running on a worker.
	//   abandoned = we no longer wish to work on this.
	//   completed = we have completed the work requested.
	// While statuses other than "completed" can be sent and will
	// update the user's view of work they have in progress,
	// only "completed" is required to be sent.  Work without
	// any other update will be marked as "pending" in the UI.
	Status string `json:"status,omitempty"`

	// StartedOn is the UTC timestamp of when we began working on this specific work packet.
	StartedOn time.Time `json:"startedOn,omitempty"`

	// CompletedOn is when we completed the work.
	CompletedOn time.Time `json:"completedOn,omitempty"`

	Evidence      WorkEvidence      `json:"evidence,omitempty"`
	Authenticator WorkAuthenticator `json:"authenticator,omitempty"`
}

WorkProgressReport is a message sent to indicate completed work, as well as status updates as work is performed, and other status changes.

Jump to

Keyboard shortcuts

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