external

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caravela

type Caravela interface {

	// Sends a create offer message to a trader from a supplier that wants to offer its resources.
	CreateOffer(ctx context.Context, fromNode, toNode *types.Node, offer *types.Offer) error

	// Sends a refresh message from a trader to a supplier. It is used to mutually know that both are alive.
	RefreshOffer(ctx context.Context, fromTrader, toSupp *types.Node, offer *types.Offer) (bool, error)

	// Sends a remove offer message from a supplier to a trader. It means the supplier does not handle the offer anymore.
	RemoveOffer(ctx context.Context, fromSupp, toTrader *types.Node, offer *types.Offer) error

	// Sends a get message to obtain all the available offers in a trader.
	GetOffers(ctx context.Context, fromNode, toTrader *types.Node, relay bool) ([]types.AvailableOffer, error)

	// Sends a message to a neighbor trader saying that a given trader has offers available
	AdvertiseOffersNeighbor(ctx context.Context, fromTrader, toNeighborTrader, traderOffering *types.Node) error

	// Sends a launch container message to a supplier in order to deploy the container
	LaunchContainer(ctx context.Context, fromBuyer, toSupplier *types.Node, offer *types.Offer,
		containerConfig []types.ContainerConfig) ([]types.ContainerStatus, error)

	// Sends a stop container message to a supplier in order to stop the container
	StopLocalContainer(ctx context.Context, toSupplier *types.Node, containerID string) error

	// Sends a message to obtain the system configurations of an existing node. Used by joining nodes to know what are
	// the system configuration parameters and the respective values.
	ObtainConfiguration(ctx context.Context, systemsNode *types.Node) (*configuration.Configuration, error)
}

Caravela is the complete API/Interface for the remote client of a node.

type DockerClient

type DockerClient interface {
	// Obtains the Docker engine max CPU cores and RAM.
	GetDockerCPUAndRAM() (int, int)

	// Checks the status of a container in the  Docker engine.
	CheckContainerStatus(containerID string) (container.ContainerStatus, error)

	// Runs a container in the Docker engine.
	RunContainer(contConfig types.ContainerConfig) (*types.ContainerStatus, error)

	// Remove a container from the Docker engine.
	RemoveContainer(containerID string) error
}

Interface for interacting with the Docker daemon. Provides a useful wrapper, for docker API client, for simple interaction with CARAVELA components.

type Overlay

type Overlay interface {
	// Create/Bootstrap the overlay in the current node.
	Create(ctx context.Context, thisNode types.OverlayMembership) error

	// Join an overlay given a participant node IP and the respective port where its overlay daemon is listening.
	Join(ctx context.Context, overlayNodeIP string, overlayNodePort int, thisNode types.OverlayMembership) error

	// Get a list of remote nodes using a given key.
	Lookup(ctx context.Context, key []byte) ([]*types.OverlayNode, error)

	// Get a list of the neighbors nodes of the given node.
	Neighbors(ctx context.Context, nodeID []byte) ([]*types.OverlayNode, error)

	// Unique identifier for the physical node where the overlay is running.
	// The overlay can have virtual nodes here we only want return always one ID that is unique in all nodes.
	NodeID(ctx context.Context) ([]byte, error)

	// Leave the overlay.
	Leave(ctx context.Context) error
}

Overlay represents an API for a distributed overlay of nodes that allows us to create a new instance of the overlay, join it, leave it, lookup for nodes by a given key and get the neighbors of a specific node.

Jump to

Keyboard shortcuts

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