listing

package module
v0.0.0-...-e01a366 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 15 Imported by: 0

README

listing

API for querying tasks and the corresponding results.

Query params (URL params):

  • after=<key>: return results starting after the given key.
  • before=<key>: return results stopping before the given key.
  • limit=<int>: maximum number of results to return. Will be min(user_limit, hard_limit) in practice.
  • order=<order>: sorting order. Options: created-asc, created-desc (default)
  • spec-version=<string>: spec version to filter for
  • has-fail=<bool>: to only list results that had a non-success result.
  • client-<client-name>=<client-version | all>: only show tasks with results for the given client, and only the specified version. Repeat the parameter to query for multiple clients or versions. 'all' can be used as a catch-all for versions.

Result: JSON, format:

{
    "tasks": [ // list of tasks, format of a task:
        {
          "index": int, // for pagination purposes
          "blocks": int,
          "spec-version": string,
          "created": time,
          "key": string, // to retrieve storage data with 
          "results: {   // may not exist or be empty.
            <unique result key>: {
               "success": bool,
               "created": time,
               "client-name": string,
               "client-version": string,
               "post-hash": string,
               "files": {
                   "post-state": string, // URL to file
                   "err-log": string,  // URL to file
                   "out-log": string,  // URL to file
                }
            },
            ... more results
          }
        },
     ... more tasks
    ],
    "has-prev-page": bool,
    "has-next-page": bool,
}

Storage path format for inputs: https://storage.googleapis.com/<bucket>/<spec-version>/<key>/{pre.ssz, block_%d.ssz}

Output files are linked in the results "files" data.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientNameRegex, _ = regexp.Compile("^[0-9a-zA-Z][-_0-9a-zA-Z]{0,128}$")

make sure client name keys don't start with `__`, or underscores at all, or hyphens

View Source
var VersionRegex, _ = regexp.Compile("^[0-9a-zA-Z][-_.0-9a-zA-Z]{0,128}$")

versions are not used as keys in firestore, and may contain dots.

Functions

func Listing

func Listing(w http.ResponseWriter, r *http.Request)

Types

type ListingResult

type ListingResult struct {
	Tasks          []Task `json:"tasks"`
	TotalTaskCount int    `json:"total-task-count"`
}

type ResultEntry

type ResultEntry struct {
	Success       bool           `firestore:"success" json:"success"`
	Created       time.Time      `firestore:"created" json:"created"`
	ClientName    string         `firestore:"client-name" json:"client-name"`
	ClientVersion string         `firestore:"client-version" json:"client-version"`
	PostHash      string         `firestore:"post-hash" json:"post-hash"`
	Files         ResultFilesRef `firestore:"files" json:"files"`
}

type ResultFilesRef

type ResultFilesRef struct {
	PostState string `firestore:"post-state" json:"post-state"`
	ErrLog    string `firestore:"err-log" json:"err-log"`
	OutLog    string `firestore:"out-log" json:"out-log"`
}

type Task

type Task struct {
	Index       int                    `firestore:"index" json:"index"`
	Blocks      int                    `firestore:"blocks" json:"blocks"`
	SpecVersion string                 `firestore:"spec-version" json:"spec-version"`
	SpecConfig  string                 `firestore:"spec-config" json:"spec-config"`
	Created     time.Time              `firestore:"created" json:"created"`
	Results     map[string]ResultEntry `firestore:"results" json:"results"`
	// ignored by firestore. But used to uniquely identify the task, and fetch its contents from storage.
	Key string `firestore:"-" json:"key"`
}

type TaskIndexDoc

type TaskIndexDoc struct {
	NextIndex int `firestore:"next-index"`
}

Jump to

Keyboard shortcuts

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