blockless

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MessageHealthCheck             = "MsgHealthCheck"
	MessageInstallFunction         = "MsgInstallFunction"
	MessageInstallFunctionResponse = "MsgInstallFunctionResponse"
	MessageRollCall                = "MsgRollCall"
	MessageRollCallResponse        = "MsgRollCallResponse"
	MessageExecute                 = "MsgExecute"
	MessageExecuteResponse         = "MsgExecuteResponse"
	MessageFormCluster             = "MsgFormCluster"
	MessageFormClusterResponse     = "MsgFormClusterResponse"
	MessageDisbandCluster          = "MsgDisbandCluster"
)

Message types in the Blockless protocol.

View Source
const (
	ProtocolID protocol.ID = "/b7s/work/1.0.0"
	EnvPrefix  string      = "B7S_"
)
View Source
const (
	HeadNodeLabel   = "head"
	WorkerNodeLabel = "worker"
)

The following are labels for the node roles, used when parsing the node role as a string.

Variables

View Source
var (
	ErrNotFound                = errors.New("not found")
	ErrRollCallTimeout         = errors.New("roll call timed out - not enough nodes responded")
	ErrExecutionNotEnoughNodes = errors.New("not enough execution results received")
)

Sentinel errors.

Functions

func PeerIDsToStr added in v0.3.0

func PeerIDsToStr(ids []peer.ID) []string

PeerIDsToStr will convert a list of peer.IDs to strings.

func RuntimeCLI

func RuntimeCLI() string

RuntimeCLI returns the name of the Blockless Runtime executable.

Types

type Deployment

type Deployment struct {
	CID         string    `json:"cid,omitempty"`
	Checksum    string    `json:"checksum,omitempty"`
	URI         string    `json:"uri,omitempty"`
	Methods     []Methods `json:"methods,omitempty"`
	Aggregation string    `json:"aggregation,omitempty"`
	Nodes       int       `json:"nodes,omitempty"`
	File        string    `json:"file,omitempty"`
}

type Executor added in v0.3.0

type Executor interface {
	ExecuteFunction(requestID string, request execute.Request) (execute.Result, error)
}

type Function

type Function struct {
	ID         string   `json:"id,omitempty"`
	Name       string   `json:"name,omitempty"`
	Version    string   `json:"version,omitempty"`
	Runtime    string   `json:"runtime,omitempty"`
	Extensions []string `json:"extensions,omitempty"`
}

Function represents a Blockless function that can be executed.

type FunctionManifest

type FunctionManifest struct {
	ID          string        `json:"id,omitempty"`
	Name        string        `json:"name,omitempty"`
	Description string        `json:"description,omitempty"`
	Function    Function      `json:"function,omitempty"`
	Deployment  Deployment    `json:"deployment,omitempty"`
	Runtime     Runtime       `json:"runtime,omitempty"`
	Cached      bool          `json:"cached,omitempty"`
	Hooks       []interface{} `json:"hooks,omitempty"`
	FSRootPath  string        `json:"fs_root_path,omitempty"`
	Entry       string        `json:"entry,omitempty"`
	ContentType string        `json:"contentType,omitempty"`
	Permissions []string      `json:"permissions,omitempty"`

	DriversRootPath string `json:"drivers_root_path,omitempty"`
	LimitedFuel     uint   `json:"limited_fuel,omitempty"`
	LimitedMemory   uint   `json:"limited_memory,omitempty"`
}

FunctionManifest describes some important configuration options for a Blockless function.

type FunctionRecord added in v0.6.1

type FunctionRecord struct {
	CID      string           `json:"cid"`
	URL      string           `json:"url"`
	Manifest FunctionManifest `json:"manifest"`
	Archive  string           `json:"archive"`
	Files    string           `json:"files"`

	UpdatedAt     time.Time `json:"updated_at"`
	LastRetrieved time.Time `json:"last_retrieved"`
}

type FunctionStore added in v0.6.1

type FunctionStore interface {
	SaveFunction(function FunctionRecord) error
	RetrieveFunction(cid string) (FunctionRecord, error)
	RetrieveFunctions() ([]FunctionRecord, error)
	RemoveFunction(id string) error
}

type Message added in v0.5.0

type Message interface {
	Type() string
}

type Methods

type Methods struct {
	Name       string      `json:"name,omitempty"`
	Entry      string      `json:"entry,omitempty"`
	Arguments  []Parameter `json:"arguments,omitempty"`
	EnvVars    []Parameter `json:"envvars,omitempty"`
	ResultType string      `json:"result_type,omitempty"`
}

type NodeRole

type NodeRole uint8

NodeRole is a representation of the node's role.

const (
	HeadNode NodeRole = iota + 1
	WorkerNode
)

The following are all possible node roles.

func (NodeRole) String

func (n NodeRole) String() string

String returns the string representation of the node role.

func (NodeRole) Valid

func (n NodeRole) Valid() bool

type Parameter

type Parameter struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

Parameter represents a generic name-value pair.

type Peer

type Peer struct {
	ID        peer.ID       `json:"id,omitempty"`
	MultiAddr string        `json:"multiaddress,omitempty"`
	AddrInfo  peer.AddrInfo `json:"addrinfo,omitempty"`
}

Peer identifies another node in the Blockless network.

type PeerStore added in v0.6.1

type PeerStore interface {
	SavePeer(peer Peer) error
	RetrievePeer(id peer.ID) (Peer, error)
	RetrievePeers() ([]Peer, error)
	RemovePeer(id peer.ID) error
}

type Runtime

type Runtime struct {
	Checksum string `json:"checksum,omitempty"`
	URL      string `json:"url,omitempty"`
}

Runtime is here to support legacy manifests.

type Store added in v0.6.1

type Store interface {
	PeerStore
	FunctionStore
}

Jump to

Keyboard shortcuts

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