service

package
v0.0.0-...-4ba9c06 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2019 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Tag          string
	Connection   string
	Exchange     string
	ExchangeType string
	Queue        string
	Key          string
}

Config contains the settings for AMPQ

type Consumer

type Consumer struct {
	Config *Config
	// contains filtered or unexported fields
}

Consumer is an object which can act on AMPQ messages

func NewConsumer

func NewConsumer(cfg *Config, handleFunc func(body []byte) error, instanceID int) (*Consumer, error)

NewConsumer creates new consumer which can act on AMPQ messages

func (*Consumer) HandleLoop

func (c *Consumer) HandleLoop(deliveries <-chan amqp.Delivery)

HandleLoop is the message loop of a consumer

func (*Consumer) Setup

func (c *Consumer) Setup() (<-chan amqp.Delivery, error)

Setup connects a consumer to the AMPQ queue from the config

func (*Consumer) Shutdown

func (c *Consumer) Shutdown() error

Shutdown will gracefully stop a consumer

type DockerService

type DockerService struct {
	// the context docker is relate to
	Context context.Context
	// client is the interface to the docker runtime
	Client *client.Client
}

DockerService contains all settings to talk to the docker api

func NewDockerService

func NewDockerService() *DockerService

NewDockerService creates a new docker client

func (*DockerService) ListContainers

func (ds *DockerService) ListContainers()

ListContainers lists all docker containers

func (*DockerService) ListImages

func (ds *DockerService) ListImages()

ListImages lists all docker images

func (*DockerService) Pull

func (ds *DockerService) Pull(image string) (string, error)

Pull pulls a docker image

func (*DockerService) Run

func (ds *DockerService) Run(
	imageName string,
	submissionZipFile string,
	frameworkZipFile string,
	DockerMemoryBytes int64,
) (string, int64, error)

Run executes a docker container and waits for the output

type Producer

type Producer struct {
	Config *Config
	// contains filtered or unexported fields
}

Producer is an object which can emit a AMPQ messages

func NewProducer

func NewProducer(cfg *Config) (*Producer, error)

NewProducer creates a new producer which can emit AMPQ messages

func (*Producer) Publish

func (c *Producer) Publish(body []byte) error

Publish emits an AMPQ message

type Worker

type Worker interface {
	Setup() error
	Shutdown() error
	HandleLoop(deliveries <-chan amqp.Delivery)
}

Worker is a description for an object getting messages over AMPQ

Jump to

Keyboard shortcuts

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