protocol

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	URL string `json:"url"`
}

Callback represents what we need to know to make a particular callback request This is not just a string so that we could support adding headers or other special things in the callback request

type CreateRunOptions

type CreateRunOptions struct {
	APIKey string
}

type Data

type Data interface {
}

Data is the interface for all core event data

type DefaultAndMax

type DefaultAndMax struct {
	Default int64 `json:"default"`
	Max     int64 `json:"max"`
}

DefaultAndMax is a useful type for int64 resources that have a default and a maximum value

type EnvVariable

type EnvVariable struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

EnvVariable is the name and value of an environment variable

type Event

type Event struct {
	ID    string    `json:"id,omitempty"`
	RunID string    `json:"run_id"`
	Time  time.Time `json:"time"`
	Type  string    `json:"type"`
	Data  Data      `json:"data"`
}

Event is the top level struct for representing events

func NewFinishEvent

func NewFinishEvent(id string, runID string, time time.Time, stage string, exitData ExitDataStage) Event

NewFinishEvent creates and returns a new finish event

func NewFirstEvent

func NewFirstEvent(id string, runID string, time time.Time) Event

NewFirstEvent creates and returns a new last event

func NewLastEvent

func NewLastEvent(id string, runID string, time time.Time) Event

NewLastEvent creates and returns a new last event

func NewLogEvent

func NewLogEvent(id string, runID string, time time.Time, stage string, stream string, text string) Event

NewLogEvent creates and returns a new log event

func NewStartEvent

func NewStartEvent(id string, runID string, time time.Time, stage string) Event

NewStartEvent creates and returns a new start event

func (*Event) UnmarshalJSON

func (e *Event) UnmarshalJSON(data []byte) error

UnmarshalJSON converts json to EventWrapper

type ExitData

type ExitData struct {
	Build    *ExitDataStage `json:"build,omitempty"`
	Execute  *ExitDataStage `json:"execute,omitempty"`
	Finished bool           `json:"finished"`
}

ExitData holds information about how things ran and how much resources were used

type ExitDataStage

type ExitDataStage struct {
	ExitCode int        `json:"exit_code"`
	Usage    StageUsage `json:"usage"`
}

ExitDataStage gives the exit data for a single stage

type FinishData

type FinishData struct {
	Stage    string        `json:"stage"`
	ExitData ExitDataStage `json:"exit_data"`
}

FinishData represent the completion of a build or run

type FirstData

type FirstData struct {
}

FirstData is the first event that's sent in a run

type Hello

type Hello struct {
	Message     string        `json:"message"`
	MaxRunTime  DefaultAndMax `json:"max_run_time"`
	Memory      DefaultAndMax `json:"memory"`
	Version     string        `json:"version"`
	RunnerImage string        `json:"runner_image"`
}

Hello gives some basic useful information about the server

type JSONEvent

type JSONEvent struct {
	ID    string           `json:"id"`
	RunID string           `json:"run_id"`
	Time  time.Time        `json:"time"`
	Type  string           `json:"type"`
	Data  *json.RawMessage `json:"data"`
}

JSONEvent is used for reading JSON

type JSONUsage

type JSONUsage struct {
	Time  time.Time        `json:"time"`
	RunID string           `json:"run_id"`
	Type  string           `json:"type"`
	Data  *json.RawMessage `json:"data"`
}

JSONUsage is used for reading JSON

type LastData

type LastData struct {
}

LastData is the last event that's sent in a run

type LogData

type LogData struct {
	Stage  string `json:"stage"`
	Stream string `json:"stream"`
	Text   string `json:"text"`
}

LogData is the output of some text from the build or run of a scraper

type MemoryUsageData

type MemoryUsageData struct {
	Memory   uint64 `json:"memory"`
	Duration uint64 `json:"duration"`
}

type NetworkUsageData

type NetworkUsageData struct {
	In  uint64 `json:"in"`
	Out uint64 `json:"out"`
}

type Run

type Run struct {
	ID string `json:"id"`
}

Run is what you get when you create a run and what you need to update it

type StageUsage

type StageUsage struct {
	MaxRSS     uint64 `json:"max_rss"`     // In bytes
	NetworkIn  uint64 `json:"network_in"`  // In bytes
	NetworkOut uint64 `json:"network_out"` // In bytes
}

Usage gives the resource usage for a single stage

type StartData

type StartData struct {
	Stage string `json:"stage"`
}

StartData represents the start of a build or run

type StartRunOptions

type StartRunOptions struct {
	Output     string        `json:"output"`
	Callback   Callback      `json:"callback"`
	Env        []EnvVariable `json:"env"`
	MaxRunTime int64         `json:"max_run_time"`
	Memory     int64         `json:"memory"`
}

StartRunOptions are options that can be used when starting a run

type Usage

type Usage struct {
	Time  time.Time   `json:"time"`
	RunID string      `json:"run_id"`
	Type  string      `json:"type"`
	Data  interface{} `json:"data"`
}

Usage is the top level struct for representing usage that's reported externally

func NewMemoryUsage

func NewMemoryUsage(runID string, time time.Time, memory uint64, duration time.Duration) Usage

NewMemoryUsage creates and returns a new memory usage

func NewNetworkUsage

func NewNetworkUsage(runID string, time time.Time, in uint64, out uint64) Usage

NewNetworkUsage creates and returns a new network usage

func (*Usage) UnmarshalJSON

func (usage *Usage) UnmarshalJSON(data []byte) error

UnmarshalJSON converts json to EventWrapper

Jump to

Keyboard shortcuts

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