commands

package
v0.0.0-...-b258b02 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAppNotAvailable = errors.New("app not available")

ErrAppNotAvailable is the error you get when you try to start a run but the code hasn't yet been uploaded

View Source
var ErrArchiveFormat = errors.New("archive format")

ErrArchiveFormat is the error you get trying to upload an archive with a bad format

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound is the error for something not being found. Use this as a sentinal value

Functions

This section is empty.

Types

type App

type App interface {
	CreateRun(options protocol.CreateRunOptions) (protocol.Run, error)
	DeleteRun(runID string) error
	StartRun(runID string, dockerImage string, options protocol.StartRunOptions) error
	GetApp(runID string) (io.Reader, error)
	PutApp(runID string, reader io.Reader, objectSize int64) error
	GetCache(runID string) (io.Reader, error)
	PutCache(runID string, reader io.Reader, objectSize int64) error
	GetOutput(runID string) (io.Reader, error)
	PutOutput(runID string, reader io.Reader, objectSize int64) error
	GetExitData(runID string) (protocol.ExitData, error)
	GetEvents(runID string, lastID string) EventIterator
	CreateEvent(runID string, event protocol.Event) error
	IsRunCreated(runID string) (bool, error)
	ReportAPINetworkUsage(runID string, in uint64, out uint64) error
}

App is the interface for the operations of the server

func New

func New(startupOptions *StartupOptions) (App, error)

New initialises the main state of the application

type AppImplementation

type AppImplementation struct {
	BlobStore     blobstore.BlobStore
	JobDispatcher jobdispatcher.Jobs
	Stream        stream.Stream
	KeyValueStore keyvaluestore.KeyValueStore
	HTTP          *http.Client

	// This is the URL that the wrapper uses to talk back to the server API
	ServerURL string
	// contains filtered or unexported fields
}

AppImplementation holds the state for the application

func (*AppImplementation) CreateEvent

func (app *AppImplementation) CreateEvent(runID string, event protocol.Event) error

CreateEvent add an event to the stream

func (*AppImplementation) CreateRun

func (app *AppImplementation) CreateRun(options protocol.CreateRunOptions) (protocol.Run, error)

CreateRun creates a run

func (*AppImplementation) DeleteRun

func (app *AppImplementation) DeleteRun(runID string) error

DeleteRun deletes the run. Should be the last thing called TODO: If one delete operation fails the rest should still be attempted

func (*AppImplementation) GetApp

func (app *AppImplementation) GetApp(runID string) (io.Reader, error)

GetApp downloads the tar & gzipped application code

func (*AppImplementation) GetCache

func (app *AppImplementation) GetCache(runID string) (io.Reader, error)

GetCache downloads the tar & gzipped build cache

func (*AppImplementation) GetEvents

func (app *AppImplementation) GetEvents(runID string, lastID string) EventIterator

GetEvents returns an iterator to get at all the events. Use "0" for lastId to start at the beginning of the stream. Otherwise use the id of the last seen event to restart the stream from that point. Don't try to restart the stream from the last event, otherwise More() will just wait around forever.

func (*AppImplementation) GetExitData

func (app *AppImplementation) GetExitData(runID string) (protocol.ExitData, error)

GetExitData downloads the exit data

func (*AppImplementation) GetOutput

func (app *AppImplementation) GetOutput(runID string) (io.Reader, error)

GetOutput downloads the scraper output

func (*AppImplementation) IsRunCreated

func (app *AppImplementation) IsRunCreated(runID string) (bool, error)

func (*AppImplementation) PutApp

func (app *AppImplementation) PutApp(runID string, reader io.Reader, objectSize int64) error

PutApp uploads the tar & gzipped application code

func (*AppImplementation) PutCache

func (app *AppImplementation) PutCache(runID string, reader io.Reader, objectSize int64) error

PutCache uploads the tar & gzipped build cache

func (*AppImplementation) PutOutput

func (app *AppImplementation) PutOutput(runID string, reader io.Reader, objectSize int64) error

PutOutput uploads the scraper output

func (*AppImplementation) ReportAPINetworkUsage

func (app *AppImplementation) ReportAPINetworkUsage(runID string, in uint64, out uint64) error

func (*AppImplementation) StartRun

func (app *AppImplementation) StartRun(runID string, dockerImage string, options protocol.StartRunOptions) error

StartRun starts the run

type EventIterator

type EventIterator interface {
	More() bool
	Next() (e protocol.Event, err error)
}

EventIterator is the interface for getting individual events in a list of events

type Events

type Events struct {
	// contains filtered or unexported fields
}

Events is an iterator to retrieve events from a stream

func (*Events) More

func (events *Events) More() bool

More checks whether there are more events available. If true you can then call Next()

func (*Events) Next

func (events *Events) Next() (e protocol.Event, err error)

Next returns the next event

type Key

type Key struct {
	// contains filtered or unexported fields
}

type MinioOptions

type MinioOptions struct {
	Host      string
	Bucket    string
	AccessKey string
	SecretKey string
}

MinioOptions are the options for the specific blob storage

type RedisOptions

type RedisOptions struct {
	Address  string
	Password string
	TLS      bool
	Database int
}

RedisOptions are the options for the specific key value store

type StartupOptions

type StartupOptions struct {
	Minio               MinioOptions
	Redis               RedisOptions
	RunsNamespace       string
	AuthenticationURL   string
	ResourcesAllowedURL string
	UsageURL            string
	ServerURL           string
}

StartupOptions are the options available when initialising the application

Jump to

Keyboard shortcuts

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