service

package
v0.0.0-...-d725eba Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: GPL-3.0 Imports: 13 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

func NewConfig

func NewConfig(config *configuration.RabbitMQConfiguration) *Config

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 {
	Client  *client.Client
	Timeout time.Duration
}

DockerService contains all settings to talk to the docker api

func NewDockerServiceWithTimeout

func NewDockerServiceWithTimeout(timeout time.Duration) (*DockerService, error)

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