pending_tasks

package
v0.0.0-...-1b86ce5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 21 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHandlers

func AddHandlers(externalRouter chi.Router)

func DecodeTask

func DecodeTask(taskJson io.Reader) (task_common.Task, error)

Reads JSON response from ctfeutil.GET_OLDEST_PENDING_TASK_URI and returns either the Task decoded from the response or nil if there are no pending tasks. Returns an error if there is a problem decoding the JSON. Does not close taskJson.

func EncodeTask

func EncodeTask(taskJson io.Writer, oldestTask task_common.Task) error

Writes JSON representation of oldestTask to taskJson. Returns an error if oldestTask's type is unknown, if there was an error encoding to JSON, or there is an error writing to taskJson. Does not close taskJson.

func GetGCEPendingTaskCount

func GetGCEPendingTaskCount(ctx context.Context) (int, error)

GetGCEPendingTaskCount returns count of pending GCE CT tasks from all task types.

func GetOldestPendingTask

func GetOldestPendingTask(ctx context.Context) (task_common.Task, error)

GetOldestPendingTask returns the oldest pending task of any type.

func GetPendingTaskCount

func GetPendingTaskCount(ctx context.Context) (int64, error)

GetPendingTaskCount returns the total number of pending tasks of all types. On error, the first return value will be -1 and the second return value will be non-nil.

func ReloadTemplates

func ReloadTemplates(resourcesDir string)

Types

type CompletedTask

type CompletedTask struct {
	Type        string `json:"type"`
	Username    string `json:"username"`
	Description string `json:"description"`
	TsCompleted int64  `json:"ts_completed"`
}

type CompletedTaskResponse

type CompletedTaskResponse struct {
	UniqueUsers    int             `json:"unique_users"`
	CompletedTasks []CompletedTask `json:"completed_tasks"`
}

Jump to

Keyboard shortcuts

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