protocol

package
v0.0.0-...-e85c719 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Definitions of protocol structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClaimRequest

type ClaimRequest struct {
	ClientID int32   `json:"clientid"`
	Group    string  `json:"group"`
	Duration int64   `json:"duration"`
	Depends  []int64 `json:"depends"`
}

type TaskInfo

type TaskInfo struct {
	ID    int64  `json:"id"`
	Group string `json:"group"`
	Data  string `json:"data"`

	// The TimeSpec, when positive, indicates an absolute timestamp in
	// nanoseconds since the epoch (UTC). When negative, its absolute value
	// will be added to the current time to create an appropriate timestamp.
	TimeSpec int64 `json:"duration"`

	// The owner, though present here, will always be ignored when trying to
	// perform an update. This is informational when obtaining tasks, not used
	// for changing them.
	OwnerID int32 `json:"ownerid"`
}

type TaskResponse

type TaskResponse struct {
	Tasks []TaskInfo         `json:'newtasks'`
	Error *TaskResponseError `json:'error'`
}

A TaskResponse is used to return slices of tasks and errors. For example, if an UpdateRequest fails, the response will contain a list of reasons for the failure in the errors slice.

type TaskResponseError

type TaskResponseError struct {
	// Changes contains the list of tasks that were not present and could thus not be changed.
	Changes []int64 `json:'changes'`

	// Deletes contains the list of IDs that could not be deleted.
	Deletes []int64 `json:'deletes'`

	// Depends contains the list of IDs that were not present and caused the update to fail.
	Depends []int64 `json:'depends'`

	// Owned contains the list of IDs that were owned by another client and could not be changed.
	Owned []int64 `json:'owned'`

	// Bugs contains a list of errors representing caller precondition failures (bad inputs).
	Bugs []error `json:'bugs'`
}

A TaskResponseError is a slice of errors, one for each portion of a task request that failed.

func (*TaskResponseError) Error

func (te *TaskResponseError) Error() string

Error returns an error string (and satisfies the Error interface).

func (*TaskResponseError) HasBugs

func (te *TaskResponseError) HasBugs() bool

func (*TaskResponseError) HasDependencyErrors

func (te *TaskResponseError) HasDependencyErrors() bool

func (*TaskResponseError) HasErrors

func (te *TaskResponseError) HasErrors() bool

type UpdateRequest

type UpdateRequest struct {
	ClientID int32      `json:"clientid"`
	Adds     []TaskInfo `json:"adds"`
	Updates  []TaskInfo `json:"updates"`
	Deletes  []int64    `json:"deletes"`
	Depends  []int64    `json:"depends"`
}

Jump to

Keyboard shortcuts

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