Documentation ¶
Overview ¶
Package tesson contains Tesson core implementation details.
Tesson has several main abstractions: Topology, RuntimeContext and Frontend.
Topology's responsible for gathering the information about hardware layout of the machine, analysing it and generating a deployment plan.
RuntimeContext is an abstraction over execution engine, e.g. Docker Engine. It is supposed to spin up instances based on the deployment plan provided by Topology.
Frontend is an optional component which represents a load balancer. It will be used to set up a virtual service, and aggregate all shards under a single endpoint.
Default implementation is based on libhwloc, docker & gorb.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributeOptions ¶
type DistributeOptions struct {
Granularity Granularity
}
DistributeOptions specifies options for Distribute.
type ExecOptions ¶
type ExecOptions struct { Image string // Container image name. Layout []Unit // Hardware layout. Ports []string // Exposed ports to publish. Config string // Container config file. }
ExecOptions specifies options for Exec.
type Frontend ¶
type Frontend interface { CreateService(group string, shards []Shard) error RemoveService(group string, shards []Shard) error }
Frontend represents a load balancer.
func NewGorbFrontend ¶
NewGorbFrontend constructs a new Frontend powered by Gorb.
type Granularity ¶
type Granularity uint
Granularity specifies distribution granularity.
const ( NodeGranularity Granularity = iota CoreGranularity )
A list of supported distribution granularities.
func ParseGranularity ¶
func ParseGranularity(g string) (Granularity, error)
ParseGranularity parses granularity strings.
type Group ¶
type Group struct { Name string // Human-readable group name. Image string // Container image name. Shards []Shard // Associated shards. }
Group represents runtime group status.
type RuntimeContext ¶
type RuntimeContext interface { Exec(group string, opts ExecOptions) (Group, error) List() ([]Group, error) Info(group string) (Group, error) Stop(group string, opts StopOptions) error }
RuntimeContext represents an execution engine.
func NewDockerContext ¶
func NewDockerContext(ctx context.Context) (RuntimeContext, error)
NewDockerContext constructs a new Docker-powered RuntimeContext.
type Shard ¶
type Shard struct { Name string // Human-readable shard name. ID string // Unique shard ID. Status string // Status string. Unit Unit // Hardware layout. Ports []types.Port }
Shard represents runtime shard status.
type StopOptions ¶
type StopOptions struct { Purge bool // Removes the container and its volumes. Timeout time.Duration // Timeout to SIGKILL. }
StopOptions specifies options for Stop.
type Topology ¶
type Topology interface { N() int Distribute(n int, opts DistributeOptions) ([]Unit, error) }
Topology represents the hardware layout of a machine.
func NewHwlocTopology ¶
NewHwlocTopology constructs a Topology for the local machine, implemented in terms of libhwloc.