metadata

package
v0.0.0-...-300ac43 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterSizeMax = 1000
)

Variables

View Source
var (
	ClusterIDPattern = regexp.MustCompile(`^[a-zA-Z0-9_-]{1,32}`)
)
View Source
var (
	DefaultPeerDefinition = PeerDefinition{
		GitReference:       "HEAD",
		Transports:         []string{"tcp"},
		Muxers:             []string{"mplex"},
		SecurityTransports: []string{"secio"},
		Routing:            "nil",
	}
)

Functions

func ReadTimestamps

func ReadTimestamps(bkt *bolt.Bucket, created, updated *time.Time) error

func RecreateBucket

func RecreateBucket(bkt *bolt.Bucket, key []byte) (*bolt.Bucket, error)

func ValidateClusterID

func ValidateClusterID(id string) error

func WithTransactionContext

func WithTransactionContext(ctx context.Context, tx *bolt.Tx) context.Context

func WriteTimestamps

func WriteTimestamps(bkt *bolt.Bucket, created, updated time.Time) error

Types

type Benchmark

type Benchmark struct {
	ID string

	Status BenchmarkStatus

	Cluster Cluster

	Scenario Scenario

	Plan ScenarioPlan

	Labels []string

	CreatedAt, UpdatedAt time.Time
}

type BenchmarkStatus

type BenchmarkStatus string

BenchmarkStatus is the current status of a benchmark.

var (
	BenchmarkPlanning BenchmarkStatus = "planning"

	BenchmarkRunning BenchmarkStatus = "running"

	BenchmarkDone BenchmarkStatus = "done"

	BenchmarkError BenchmarkStatus = "error"
)

type BenchmarkStore

type BenchmarkStore interface {
	GetBenchmark(ctx context.Context, id string) (Benchmark, error)

	ListBenchmarks(ctx context.Context) ([]Benchmark, error)

	CreateBenchmark(ctx context.Context, benchmark Benchmark) (Benchmark, error)

	UpdateBenchmark(ctx context.Context, benchmark Benchmark) (Benchmark, error)

	LabelBenchmarks(ctx context.Context, ids, adds, removes []string) ([]Benchmark, error)

	DeleteBenchmarks(ctx context.Context, ids ...string) error
}

type Build

type Build struct {
	ID string

	Link string

	CreatedAt, UpdatedAt time.Time
}

type BuildStore

type BuildStore interface {
	GetBuild(ctx context.Context, id string) (Build, error)

	ListBuilds(ctx context.Context) ([]Build, error)

	CreateBuild(ctx context.Context, build Build) (Build, error)

	DeleteBuild(ctx context.Context, id string) error
}

type Cluster

type Cluster struct {
	ID string

	Status ClusterStatus

	Definition ClusterDefinition

	Labels []string

	CreatedAt, UpdatedAt time.Time
}

func (Cluster) Validate

func (c Cluster) Validate() error

type ClusterDefinition

type ClusterDefinition struct {
	Groups []ClusterGroup
}

func (ClusterDefinition) GenerateLabels

func (d ClusterDefinition) GenerateLabels() (labels []string)

func (ClusterDefinition) Size

func (d ClusterDefinition) Size() int

type ClusterGroup

type ClusterGroup struct {
	Size         int
	InstanceType string
	Region       string
	Peer         *PeerDefinition `json:"peer,omitempty"`
	Labels       []string
}

type ClusterStatus

type ClusterStatus string
var (
	ClusterCreating   ClusterStatus = "creating"
	ClusterConnecting ClusterStatus = "connecting"
	ClusterCreated    ClusterStatus = "created"
	ClusterDestroying ClusterStatus = "destroying"
	ClusterDestroyed  ClusterStatus = "destroyed"
	ClusterError      ClusterStatus = "error"
)

type ClusterStore

type ClusterStore interface {
	GetCluster(ctx context.Context, id string) (Cluster, error)

	ListClusters(ctx context.Context) ([]Cluster, error)

	CreateCluster(ctx context.Context, cluster Cluster) (Cluster, error)

	UpdateCluster(ctx context.Context, cluster Cluster) (Cluster, error)

	LabelClusters(ctx context.Context, ids, adds, removes []string) ([]Cluster, error)

	DeleteCluster(ctx context.Context, id string) error
}

type DB

func NewDB

func NewDB(root string) (DB, error)

type Experiment

type Experiment struct {
	ID string

	Status ExperimentStatus

	Definition ExperimentDefinition

	Reports []Report

	Labels []string

	CreatedAt, UpdatedAt time.Time
}

func (*Experiment) FromJSON

func (e *Experiment) FromJSON(data []byte) error

FromJSON loads the experiment definition with the values from data

func (*Experiment) ToJSON

func (e *Experiment) ToJSON() ([]byte, error)

ToJSON is a helper function to convert an Experiment into it's JSON representation

type ExperimentDefinition

type ExperimentDefinition struct {
	Trials []TrialDefinition
}

ExperimentDefinition defines an experiment.

func (*ExperimentDefinition) FromJSON

func (ed *ExperimentDefinition) FromJSON(data []byte) error

FromJSON loads the experiment definition with the values from data

func (*ExperimentDefinition) ToJSON

func (ed *ExperimentDefinition) ToJSON() ([]byte, error)

ToJSON is a helper function to convert an ExperimentDefinition into it's JSON representation

type ExperimentStatus

type ExperimentStatus string
var (
	ExperimentRunning ExperimentStatus = "running"
	ExperimentDone    ExperimentStatus = "done"
	ExperimentError   ExperimentStatus = "error"
)

type ExperimentStore

type ExperimentStore interface {
	GetExperiment(ctx context.Context, id string) (Experiment, error)

	ListExperiments(ctx context.Context) ([]Experiment, error)

	CreateExperiment(ctx context.Context, experiment Experiment) (Experiment, error)

	UpdateExperiment(ctx context.Context, experiment Experiment) (Experiment, error)

	LabelExperiments(ctx context.Context, ids, adds, removes []string) ([]Experiment, error)

	DeleteExperiment(ctx context.Context, id string) error
}

type Node

type Node struct {
	ID string

	Address string

	AgentPort int

	AppPort int

	Peer PeerDefinition

	Labels []string

	CreatedAt, UpdatedAt time.Time
}

type NodeStore

type NodeStore interface {
	GetNode(ctx context.Context, cluster, id string) (Node, error)

	ListNodes(ctx context.Context, cluster string) ([]Node, error)

	CreateNode(ctx context.Context, cluster string, node Node) (Node, error)

	CreateNodes(ctx context.Context, cluster string, node []Node) ([]Node, error)

	UpdateNode(ctx context.Context, cluster string, node Node) (Node, error)

	LabelNodes(ctx context.Context, cluster string, ids, adds, removes []string) ([]Node, error)
}

type ObjectDefinition

type ObjectDefinition struct {
	// Type specifies what type is the source of the data and how the data is
	// retrieved. Types must be one of the following: ["oci-image"].
	Type string `json:"type"`

	Source string `json:"source"`

	// Layout specify how the DAG is shaped and constructed over the IPLD blocks.
	Layout string `json:"layout"`

	// Chunker specify which chunking algorithm to use to chunk the data into IPLD
	// blocks.
	Chunker string `json:"chunker"`

	RawLeaves bool `json:"rawLeaves"`

	HashFunc string `json:"hashFunc"`

	MaxLinks int `json:"maxLinks"`
}

ObjectDefinition define a type of data that will be distributed during the benchmark. The definition also specify options on how the data is converted into IPFS datastructures.

type ObjectType

type ObjectType string

ObjectType is the type of data retrieved.

var (
	// ObjectContainerImage indicates that the object is an OCI image.
	ObjectContainerImage ObjectType = "oci-image"
)

type PeerDefinition

type PeerDefinition struct {
	GitReference string

	Transports []string

	Muxers []string

	SecurityTransports []string

	Routing string
}

type Report

type Report struct {
	Summary ReportSummary

	Aggregates ReportAggregates

	Nodes map[string]ReportNode

	Queries map[string][]string
}

type ReportAggregates

type ReportAggregates struct {
	Totals ReportNode
}

type ReportBandwidth

type ReportBandwidth struct {
	Totals metrics.Stats

	// TODO: Convert back to map[node id].
	Peers map[string]metrics.Stats

	Protocols map[protocol.ID]metrics.Stats
}

type ReportBitswap

type ReportBitswap struct {
	BlocksReceived   uint64
	DataReceived     uint64
	BlocksSent       uint64
	DataSent         uint64
	DupBlksReceived  uint64
	DupDataReceived  uint64
	MessagesReceived uint64
}

type ReportNode

type ReportNode struct {
	Bitswap ReportBitswap

	Bandwidth ReportBandwidth
}

type ReportStore

type ReportStore interface {
	GetReport(ctx context.Context, id string) (Report, error)

	CreateReport(ctx context.Context, id string, report Report) error
}

type ReportSummary

type ReportSummary struct {
	TotalTime time.Duration

	Trace string

	Metrics string
}

type Scenario

type Scenario struct {
	ID string

	Definition ScenarioDefinition

	Labels []string

	CreatedAt, UpdatedAt time.Time
}

type ScenarioDefinition

type ScenarioDefinition struct {
	Objects map[string]ObjectDefinition `json:"objects,omitempty"`

	// Seed map a query to an action. Queries are executed in parallel to seed
	// a cluster with initial data before running the benchmark.
	Seed map[string]string `json:"seed,omitempty"`

	// Benchmark maps a query to an action. Queries are executed in parallel
	// during the benchmark and metrics are collected during this stage.
	Benchmark map[string]string `json:"benchmark,omitempty"`
}

ScenarioDefinition defines a scenario.

type ScenarioPlan

type ScenarioPlan struct {
	Objects map[string]cid.Cid

	Seed ScenarioStage

	Benchmark ScenarioStage
}

type ScenarioStage

type ScenarioStage map[string]Task

type ScenarioStore

type ScenarioStore interface {
	GetScenario(ctx context.Context, id string) (Scenario, error)

	ListScenarios(ctx context.Context) ([]Scenario, error)

	CreateScenario(ctx context.Context, scenario Scenario) (Scenario, error)

	UpdateScenario(ctx context.Context, scenario Scenario) (Scenario, error)

	LabelScenarios(ctx context.Context, ids, adds, removes []string) ([]Scenario, error)

	DeleteScenarios(ctx context.Context, ids ...string) error
}

type Task

type Task struct {
	Type TaskType

	Subject string
}

type TaskType

type TaskType string
var (
	TaskUpdate     TaskType = "update"
	TaskGet        TaskType = "get"
	TaskConnect    TaskType = "connect"
	TaskConnectOne TaskType = "connect-one"
	TaskDisconnect TaskType = "disconnect"
)

type TrialDefinition

type TrialDefinition struct {
	Cluster  ClusterDefinition  `json:"cluster"`
	Scenario ScenarioDefinition `json:"scenario"`
}

TrialDefinition is a grouping of a cluster, and scenario to run together

Jump to

Keyboard shortcuts

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