jobtags

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package jobtags checks a job's tags. The hopper package checks an insert's and a listing's tags with it, and hoppertest those of a job it runs, so that a test accepts only the tags an insert would.

Index

Constants

View Source
const (
	MaxBytes = 255
	Max      = 64
)

MaxBytes is the longest tag, and Max the most distinct tags a job may have. hopper exports them as MaxTagBytes and MaxTags.

Variables

This section is empty.

Functions

func Check

func Check(tags []string) ([]string, error)

Check validates a job's tags and drops repeats, keeping the first of each. It returns nil for none.

func CheckOne

func CheckOne(t string) error

CheckOne validates one tag: 1 to MaxBytes bytes of valid UTF-8 without control characters.

func Distinct

func Distinct(tags []string) []string

Distinct returns tags without repeats, keeping the first of each, or nil for none: the tags a job with them has, and those a listing walks.

func DistinctAtMost

func DistinctAtMost(tags []string, n int) ([]string, bool)

DistinctAtMost is Distinct that gives up, reporting false, once it has found more than n distinct tags, so that a long list costs a check of n tags each rather than one of every tag against every other. Past Max distinct tags, which only a row a direct SQL write stored can hold (a scan reads it with Distinct), repeats are found with a set, so that such a row costs its length rather than its square.

Types

This section is empty.

Jump to

Keyboard shortcuts

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