external

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2018 License: GPL-3.0 Imports: 4 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(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(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(fromSupp, toTrader *types.Node, offer *types.Offer) error

	// Sends a get message to obtain all the available offers in a trader.
	GetOffers(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(fromTrader, toNeighborTrader, traderOffering *types.Node) error

	// Sends a launch container message to a supplier in order to deploy the container
	LaunchContainer(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(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(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(imageKey string, portMappings []types.PortMapping, args []string, cpus int64,
		ram int) (string, 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(thisNode types.OverlayMembership) error

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

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

	// Get a list of the neighbors nodes of the given node.
	Neighbors(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() ([]byte, error)

	// Leave the overlay.
	Leave() 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