tqname

package
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoParent      = errors.New("root task queue partition has no parent")
	ErrInvalidDegree = errors.New("invalid task queue partition branching degree")
)

Functions

This section is empty.

Types

type Name

type Name struct {
	// contains filtered or unexported fields
}

Name encapsulates all the name mangling we do for task queues.

Users work with "high-level task queues" and can give them arbitrary names (except for our prefix).

Each high-level task queue corresponds to one or more "low-level task queues", each of which has a distinct task queue manager in memory in matching service, as well as a distinct identity in persistence.

There are two pieces of identifying information for low-level task queues: a partition index, and a version set identifier. All low-level task queues have a partition index, which may be 0. Partition 0 is called the "root". The version set identifier is optional: task queues with it are called "versioned" and task queues without it are called "unversioned".

All versioned low-level task queues use mangled names. All unversioned low-level task queues with non-zero partition also use mangled names.

Mangled names look like this:

/_sys/<base name>/[<version set id>:]<partition id>

The partition id is required, and the version set id is optional. If present, it is separated from the partition id by a colon. This scheme lets users use anything they like for a base name, except for strings starting with "/_sys/", without ambiguity.

For backward compatibility, unversioned low-level task queues with partition 0 do not use mangled names, they use the bare base name.

func FromBaseName

func FromBaseName(name string) (Name, error)

FromBaseName takes a base name and returns a Name. Returns an error if name looks like a mangled name.

func Parse

func Parse(name string) (Name, error)

Parse takes a mangled low-level task queue name and returns a Name. Returns an error if the given name is not a valid mangled name.

func (Name) BaseNameString

func (tn Name) BaseNameString() string

BaseNameString returns the base name for a task queue. This should be used when looking up settings in dynamic config, and pretty much nowhere else. To get the name of the root partition, use tn.Root().FullName().

func (Name) FullName

func (tn Name) FullName() string

FullName returns the mangled name of the task queue, to be used in RPCs and persistence.

func (Name) IsRoot

func (tn Name) IsRoot() bool

IsRoot returns true if this task queue is a root partition.

func (Name) Parent

func (tn Name) Parent(degree int) (Name, error)

Parent returns a Name for the parent partition, using the given branching degree.

func (Name) Partition

func (tn Name) Partition() int

Partition returns the partition number for a task queue.

func (Name) Root

func (tn Name) Root() Name

Root is shorthand for WithPartition(0).

func (Name) VersionSet

func (tn Name) VersionSet() string

VersionSet returns the version set for a task queue.

func (Name) WithPartition

func (tn Name) WithPartition(partition int) Name

WithPartition returns a new Name with the same base and version set but a different partition.

func (Name) WithVersionSet

func (tn Name) WithVersionSet(versionSet string) Name

WithVersionSet returns a new Name with the same base and partition but a different version set.

Jump to

Keyboard shortcuts

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