Documentation
¶
Index ¶
Constants ¶
const ( // Bless Runtime flag names. BLSRuntimeFlagEntry = "entry" BLSRuntimeFlagExecutionTime = "run-time" BLSRuntimeFlagDebug = "debug-info" BLSRuntimeFlagFuel = "limited-fuel" BLSRuntimeFlagMemory = "limited-memory" BLSRuntimeFlagFSRoot = "fs-root-path" BLSRuntimeFlagLogger = "runtime-logger" BLSRuntimeFlagPermission = "permission" BLSRuntimeFlagEnv = "env" BLSRuntimeFlagDrivers = "drivers-root-path" )
const (
BLSDefaultRuntimeEntryPoint = "_start"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeAttestors ¶
type Attributes ¶
type Attributes struct {
// Values specify which attributes the node in question should have.
// At the moment we support strict equality only, so no `if RAM >= 16GB` types of conditions.
Values []Parameter `json:"values,omitempty"`
// Should we accept nodes whose attributes are not attested?
AttestationRequired bool `json:"attestation_required,omitempty"`
// Explicitly request specific attestors.
Attestors AttributeAttestors `json:"attestors,omitempty"`
}
type BLSRuntimeConfig ¶
type BLSRuntimeConfig struct {
Entry string `json:"entry,omitempty"`
ExecutionTime uint64 `json:"run_time,omitempty"`
DebugInfo bool `json:"debug_info,omitempty"`
Fuel uint64 `json:"limited_fuel,omitempty"`
Memory uint64 `json:"limited_memory,omitempty"`
Logger string `json:"runtime_logger,omitempty"`
DriversRootPath string `json:"drivers_root_path,omitempty"`
// Fields not allowed to be set in the request.
Input string `json:"-"`
FSRoot string `json:"-"`
}
RuntimeConfig represents the CLI flags supported by the runtime
type Cluster ¶
type Cluster struct {
Main peer.ID `json:"main,omitempty"`
Peers []peer.ID `json:"peers,omitempty"`
}
Cluster represents the set of peers that executed the request.
type Config ¶
type Config struct {
Runtime BLSRuntimeConfig `json:"runtime,omitempty"`
Environment []EnvVar `json:"env_vars,omitempty"`
Stdin *string `json:"stdin,omitempty"`
Permissions []string `json:"permissions,omitempty"`
ResultAggregation ResultAggregation `json:"result_aggregation,omitempty"`
Attributes *Attributes `json:"attributes,omitempty"`
// NodeCount specifies how many nodes should execute this request.
NodeCount int `json:"number_of_nodes,omitempty"`
// When should the execution timeout
Timeout int `json:"timeout,omitempty"`
// Consensus algorithm to use. Raft and PBFT are supported at this moment.
ConsensusAlgorithm string `json:"consensus_algorithm,omitempty"`
// Threshold (percentage) defines how many nodes should respond with a result to consider this execution successful.
Threshold float64 `json:"threshold,omitempty"`
}
Config represents the configurable options for an execution request.
type EnvVar ¶
EnvVar represents the name and value of the environment variables set for the execution.
type NodeResult ¶
type NodeResult struct {
Result
Signature string `json:"signature,omitempty"` // Signed digest of the response.
PBFT PBFTResultInfo `json:"pbft,omitempty"`
Metadata any `json:"metadata,omitempty"`
}
NodeResult is an annotated execution result.
func (NodeResult) VerifySignature ¶
func (r NodeResult) VerifySignature(key crypto.PubKey) error
type PBFTResultInfo ¶
type ProcessID ¶
type ProcessID struct {
PID int // PID can used to identify a process on all platforms.
Handle uintptr // windows.Handle value that can be used for Windows-specific operations.
}
ProcessID is used to identify an OS process.
type Request ¶
type Request struct {
FunctionID string `json:"function_id"`
Method string `json:"method"`
Parameters []Parameter `json:"parameters,omitempty"`
Config Config `json:"config"`
// Optional signature of the request.
Signature string `json:"signature,omitempty"`
}
Request describes an execution request.
type Result ¶
type Result struct {
Code codes.Code `json:"code"`
Result RuntimeOutput `json:"result"`
Usage Usage `json:"usage,omitempty"`
}
Result describes an execution result.
type ResultAggregation ¶
type ResultMap ¶
type ResultMap map[peer.ID]NodeResult
ResultMap contains execution results from multiple peers.
func (ResultMap) MarshalJSON ¶
MarshalJSON provides means to correctly handle JSON serialization/deserialization. See:
https://github.com/libp2p/go-libp2p/pull/2156 https://github.com/libp2p/go-libp2p-resource-manager/pull/67#issuecomment-1176820561
type RuntimeOutput ¶
type RuntimeOutput struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
Log string `json:"-"`
}
RuntimeOutput describes the output produced by the Bless Runtime during execution.
type Usage ¶
type Usage struct {
WallClockTime time.Duration `json:"wall_clock_time,omitempty"`
CPUUserTime time.Duration `json:"cpu_user_time,omitempty"`
CPUSysTime time.Duration `json:"cpu_sys_time,omitempty"`
MemoryMaxKB int64 `json:"memory_max_kb,omitempty"`
}
Usage represents the resource usage information for a particular execution.