Documentation
¶
Index ¶
- type Action
- type AddOption
- type AddSettings
- type AgentAPI
- type AppAPI
- type Benchmark
- type BenchmarkAPI
- type Build
- type BuildAPI
- type Builder
- type Cluster
- type ClusterAPI
- type ControlAPI
- type CreateClusterOption
- type CreateClusterSettings
- type Downloader
- type Experiment
- type ExperimentAPI
- type Labeled
- type LabeledSet
- type ListOption
- type ListSettings
- type Node
- type NodeAPI
- type NodeGroup
- type NodeProvider
- type Peer
- type Query
- type QueryOption
- type QuerySettings
- type SSHOption
- type SSHSettings
- type Scenario
- type ScenarioAPI
- type StartBenchmarkOption
- type StartBenchmarkSettings
- type Transformer
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddOption ¶
type AddOption func(*AddSettings) error
AddOption is an option for AddSettings.
func WithChunker ¶
WithChunker sets the chunking strategy for the content.
func WithHashFunc ¶
WithHashFunc sets the hashing function for the blocks.
func WithLayout ¶
WithLayout sets the format for DAG generation.
func WithMaxLinks ¶
WithMaxLinks sets the maximum children each block can have.
func WithRawLeaves ¶
WithRawLeaves sets whether to use raw blocks for leaf nodes.
type AddSettings ¶
type AddSettings struct {
Layout string
Chunker string
RawLeaves bool
Hidden bool
Shard bool
NoCopy bool
HashFunc string
MaxLinks int
}
AddSettings describe the settings for adding content to the peer.
type Benchmark ¶
type Benchmark interface {
Labeled
Metadata() metadata.Benchmark
Report(ctx context.Context) (metadata.Report, error)
}
Benchmark is an execution of a scenario on a cluster.
type BenchmarkAPI ¶
type BenchmarkAPI interface {
// Create creates a benchmark of a scenario on a cluster.
Create(ctx context.Context, cluster, scenario string, opts ...StartBenchmarkOption) (id string, err error)
// Get returns a benchmark.
Get(ctx context.Context, id string) (Benchmark, error)
Label(ctx context.Context, ids, adds, removes []string) ([]Benchmark, error)
// List returns available benchmarks.
List(ctx context.Context, opts ...ListOption) ([]Benchmark, error)
Remove(ctx context.Context, ids ...string) error
}
BenchmarkAPI defines API for benchmark operations.
type Build ¶
type Build interface {
// ID returns a uniquely identifiable string.
ID() string
Metadata() metadata.Build
// Open creates a reader for the build's binary.
Open(ctx context.Context) (io.ReadCloser, error)
}
Build is an compiled peer ready to be deployed.
type BuildAPI ¶
type BuildAPI interface {
// Get returns a build.
Get(ctx context.Context, id string) (Build, error)
// List returns available builds.
List(ctx context.Context) ([]Build, error)
// Upload uploads a binary for a build.
Upload(ctx context.Context, r io.Reader) (Build, error)
}
BuildAPI defines the API for build operations.
type Builder ¶
type Builder interface {
// Init initializes the builder.
Init(ctx context.Context) error
// Resolve resolves a git-ref to a commit it can uniquely build.
Resolve(ctx context.Context, ref string) (commit string, err error)
// Build compiles the peer at the given commit.
Build(ctx context.Context, commit string) (link string, err error)
}
Builder compiles the peer to hotswap the underlying implementation on a live cluster.
type Cluster ¶
type Cluster interface {
Labeled
Metadata() metadata.Cluster
// Update updates nodes in a cluster matching the list options with the given
// peer definition.
Update(ctx context.Context, pdef metadata.PeerDefinition, opts ...ListOption) ([]Node, error)
}
Cluster is a group of instances connected in a p2p network. They can be provisioned by developers, or CI. Clusters may span multiple regions and have heterogeneous nodes.
type ClusterAPI ¶
type ClusterAPI interface {
// Create deploys a cluster.
Create(ctx context.Context, name string, opts ...CreateClusterOption) (id string, err error)
// Get returns a cluster.
Get(ctx context.Context, name string) (Cluster, error)
// Label adds/removes labels to/from clusters.
Label(ctx context.Context, names, adds, removes []string) ([]Cluster, error)
// List returns available clusters.
List(ctx context.Context, opts ...ListOption) ([]Cluster, error)
// Remove destroys clusters permanently.
Remove(ctx context.Context, names ...string) error
}
ClusterAPI defines API for cluster operations.
type ControlAPI ¶
type ControlAPI interface {
// Cluster returns an implementaiton of Cluster API.
Cluster() ClusterAPI
// Node returns an implementation of Node API.
Node() NodeAPI
// Scenario returns an implementation of Scenario API.
Scenario() ScenarioAPI
// Benchmark returns an implementation of Benchmark API.
Benchmark() BenchmarkAPI
// Experiment returns an implementation of Experiment API.
Experiment() ExperimentAPI
// Build returns an implementation of Build API.
Build() BuildAPI
}
ControlAPI defines APIs for labd.
type CreateClusterOption ¶
type CreateClusterOption func(*CreateClusterSettings) error
CreateClusterOption is an option to modify create cluster settings.
func WithClusterDefinition ¶
func WithClusterDefinition(definition string) CreateClusterOption
func WithClusterInstanceType ¶
func WithClusterInstanceType(instanceType string) CreateClusterOption
func WithClusterRegion ¶
func WithClusterRegion(region string) CreateClusterOption
func WithClusterSize ¶
func WithClusterSize(size int) CreateClusterOption
type CreateClusterSettings ¶
type CreateClusterSettings struct {
Definition string
Size int
InstanceType string
Region string
ClusterDefinition metadata.ClusterDefinition
}
CreateClusterSettings specify cluster properties for creation.
type Downloader ¶
type Downloader interface {
// Download downloads an artifact with an abstract link.
Download(ctx context.Context, link string) (io.ReadCloser, error)
}
Download downlaods artifacts from an external distribution mechanism.
type Experiment ¶
type Experiment interface {
Labeled
Metadata() metadata.Experiment
}
type ExperimentAPI ¶
type ExperimentAPI interface {
Create(ctx context.Context, name string, edef metadata.ExperimentDefinition) (id string, err error)
Get(ctx context.Context, id string) (Experiment, error)
Label(ctx context.Context, ids, adds, removes []string) ([]Experiment, error)
List(ctx context.Context, opts ...ListOption) ([]Experiment, error)
Remove(ctx context.Context, ids ...string) error
}
ExperimentAPI is an unimplemented layer to run experiments, a collection of benchmarks while varying some aspect.
type Labeled ¶
type Labeled interface {
// ID returns a uniquely identifiable string.
ID() string
// Labels returns a unique list of labels.
Labels() []string
}
Labeled defines a resource that has labels.
type LabeledSet ¶
type LabeledSet interface {
// Add adds a labeled resource to the set.
Add(labeled Labeled)
// Remove removes a labeled resource from the set.
Remove(id string)
// Get returns a labeled resource from the set.
Get(id string) Labeled
// Contains returns whether a labeled resource with the id exists in the set.
Contains(id string) bool
// Slice returns the labeled resources as a slice.
Slice() []Labeled
}
LabeledSet is a set of labeled resources, duplicate resources are detected by the ID of the labeled resource.
type ListOption ¶
type ListOption func(*ListSettings) error
func WithQuery ¶
func WithQuery(q string) ListOption
type ListSettings ¶
type ListSettings struct {
Query string
}
type NodeAPI ¶
type NodeAPI interface {
// Get returns a node.
Get(ctx context.Context, cluster, id string) (Node, error)
Label(ctx context.Context, cluster string, ids, adds, removes []string) ([]Node, error)
List(ctx context.Context, cluster string, opts ...ListOption) ([]Node, error)
}
NodeAPI defines the API for node operations.
type NodeProvider ¶
type NodeProvider interface {
// CreateNodeGroup returns a healthy cluster of nodes.
CreateNodeGroup(ctx context.Context, id string, cdef metadata.ClusterDefinition) (*NodeGroup, error)
// DestroyNodeGroup destroys a cluster of nodes.
DestroyNodeGroup(ctx context.Context, ng *NodeGroup) error
}
NodeProvider is a service that can provision nodes.
type Peer ¶
type Peer interface {
// Host returns the libp2p host.
Host() host.Host
// DAGService returns the IPLD DAG service.
DAGService() ipld.DAGService
// Connect connects to the libp2p peers.
Connect(ctx context.Context, infos []peer.AddrInfo) error
// Disconnect disconnects from libp2p peers.
Disconnect(ctx context.Context, infos []peer.AddrInfo) error
// Add adds content from an io.Reader into the Peer's storage.
Add(ctx context.Context, r io.Reader, opts ...AddOption) (ipld.Node, error)
// Get returns an Unixfsv1 file from a given cid.
Get(ctx context.Context, c cid.Cid) (files.Node, error)
// FetchGraph fetches the full DAG rooted at a given cid.
FetchGraph(ctx context.Context, c cid.Cid) error
// Report returns all the metrics collected from the peer.
Report(ctx context.Context) (metadata.ReportNode, error)
}
Peer is a minimal IPFS node that can distribute IPFS DAGs.
type Query ¶
type Query interface {
// String returns the original query.
String() string
// Match returns the subset of lset that matches the query.
Match(ctx context.Context, lset LabeledSet) (LabeledSet, error)
}
Query is an executable function against a cluster to match a set of nodes. Queries are used to group nodes to perform actions in either the seeding or benchmarking stage of a scenario.
type QueryOption ¶
type QueryOption func(*QuerySettings) error
func WithAddLabels ¶
func WithAddLabels(labels ...string) QueryOption
func WithRemoveLabels ¶
func WithRemoveLabels(labels ...string) QueryOption
type QuerySettings ¶
type SSHOption ¶
type SSHOption func(SSHSettings) error
SSHOption is an option to modify SSH settings.
type SSHSettings ¶
type SSHSettings struct {
}
SSHSetttings specify ssh settings when connecting to a node.
type Scenario ¶
Scenario is a schema for benchmarks that describes objects to benchmark, how the cluster is initially seeded, and what to benchmark.
type ScenarioAPI ¶
type ScenarioAPI interface {
// Create saves a scenario for the given scenario definition.
Create(ctx context.Context, name string, sdef metadata.ScenarioDefinition) (Scenario, error)
// Get returns a scenario.
Get(ctx context.Context, name string) (Scenario, error)
// Label adds and removes labels from nodes identified by the list of names.
Label(ctx context.Context, names, adds, removes []string) ([]Scenario, error)
// List returns available scenarios.
List(ctx context.Context, opts ...ListOption) ([]Scenario, error)
Remove(ctx context.Context, names ...string) error
}
ScenarioAPI defines API for scenario operations.
type StartBenchmarkOption ¶
type StartBenchmarkOption func(*StartBenchmarkSettings) error
func WithBenchmarkNoReset ¶
func WithBenchmarkNoReset() StartBenchmarkOption
type StartBenchmarkSettings ¶
type StartBenchmarkSettings struct {
NoReset bool
}
type Transformer ¶
type Transformer interface {
// Transform adds a resource defined by source into an IPFS DAG stored in
// peer.
Transform(ctx context.Context, peer Peer, source string, opts ...AddOption) (cid.Cid, error)
// Close releases any resources held by the Transformer.
Close() error
}
Transformer defines a way to convert an external resource into IPFS DAGs.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
labagent
command
|
|
|
labapp
command
|
|
|
labctl
command
|
|
|
labd
command
|
|
|
ociadd
command
|
|
|
ociget
command
|
|
|
s3build
command
|
|
|
s3download
command
|
|
|
s3upload
command
|
|
|
cue
|
|
|
parser
Package parser enables parsing of cue sources
|
Package parser enables parsing of cue sources |
|
routers/helpers
Package helpers contains helper functions to be reused by multiple routers
|
Package helpers contains helper functions to be reused by multiple routers |
|
pkg
|
|