Documentation
¶
Overview ¶
Package names centralises every NATS resource name packtrail uses — streams, KV buckets, object stores, subjects and durable consumer names — derived from a single namespace prefix, plus the validation rules for every identifier that ends up as a NATS subject token or KV key segment.
Index ¶
- Constants
- func CheckToken(what, s string) error
- func Partition(execID string, n int) int
- func TriggerMsgExecID(flow, msgID string) string
- func TriggerSeqExecID(flow, stream string, seq uint64) string
- func ValidPrefix(p string) bool
- func ValidToken(s string) bool
- type Names
- func (n Names) CmdPartitionFilter(partition int) string
- func (n Names) CmdStreamSubjects() []string
- func (n Names) CmdSubject(partition int, execID string) string
- func (n Names) CronFilter() string
- func (n Names) CronSubject(name string) string
- func (n Names) CtlSubject(kind string) string
- func (n Names) DLQSubject(kind, key string) string
- func (n Names) DLQSubjects() string
- func (n Names) DurCron() string
- func (n Names) DurDispatch(partition int) string
- func (n Names) DurEngine(partition int) string
- func (n Names) DurIndexer() string
- func (n Names) DurWorker(kind string) string
- func (n Names) EventPartitionFilter(partition int) string
- func (n Names) EventSubject(partition int, execID string) string
- func (n Names) EventsSubjects() string
- func (n Names) ProgressFilter(execID string) string
- func (n Names) ProgressSubject(execID, node string) string
- func (n Names) ScheduleSubject(name string) string
- func (n Names) StopSubject(execID string) string
- func (n Names) StopSubjects() string
- func (n Names) TimerExecFilter(execID string) string
- func (n Names) TimerSubject(execID, timerID string) string
- func (n Names) WorkDelaySubject(kind, id string) string
- func (n Names) WorkDelaySubjects() string
- func (n Names) WorkSubject(kind string) string
- func (n Names) WorkSubjects() string
Constants ¶
const Default = "packtrail"
Default is the namespace prefix used when none is supplied.
Variables ¶
This section is empty.
Functions ¶
func CheckToken ¶ added in v1.0.0
CheckToken returns a descriptive error when s is not a valid token. what names the identifier in the message ("execution id", "flow name", …).
func Partition ¶ added in v1.0.0
Partition maps an execution id to its partition in [0, n). It is FNV-1a (32 bit) modulo n, chosen because it is trivial to reproduce in any language SDK: every command for an execution must land in the same partition.
func TriggerMsgExecID ¶ added in v1.0.0
TriggerMsgExecID is the execution a trigger of flow starts for a message with Nats-Msg-Id msgID. Flows triggered by the same message get different ids, and a redelivered or republished message the same one.
func TriggerSeqExecID ¶ added in v1.0.0
TriggerSeqExecID is the execution a stream trigger of flow starts for a message without Nats-Msg-Id: the message's stream and sequence identify it.
func ValidPrefix ¶ added in v1.0.0
ValidPrefix reports whether p is a valid namespace prefix.
func ValidToken ¶ added in v1.0.0
ValidToken reports whether s can be used as a single NATS subject token and KV key segment.
Types ¶
type Names ¶
type Names struct {
Prefix string
// Streams.
StreamEvents string // source of truth: <p>.ev.<partition>.<exec>
StreamCmd string // command inbox + durable timers + cron schedules
StreamWork string // worker jobs: <p>.work.<kind>
StreamDLQ string // dead letters: <p>.dlq.<kind>.<key>
// KV buckets.
BucketSnapshots string
BucketFlows string
BucketIndex string
BucketCache string
BucketSem string
BucketStore string
// Object stores.
ObjectBlobs string
ObjectArchive string
}
Names holds every concrete resource name for one namespace.
func New ¶
New builds the resource names for prefix. An empty prefix falls back to Default. New panics on an invalid prefix: it is an unrecoverable configuration error that would corrupt every derived name, and callers are expected to validate user input with ValidPrefix first.
func (Names) CmdPartitionFilter ¶ added in v1.0.0
CmdPartitionFilter matches every command of one partition.
func (Names) CmdStreamSubjects ¶ added in v1.0.0
CmdStreamSubjects lists the subjects of the command stream.
func (Names) CmdSubject ¶ added in v1.0.0
CmdSubject is the command inbox subject of one execution.
func (Names) CronFilter ¶ added in v1.0.0
CronFilter matches every fired cron message.
func (Names) CronSubject ¶ added in v1.0.0
CronSubject receives the messages fired by the cron schedule named name.
func (Names) CtlSubject ¶ added in v1.0.0
CtlSubject carries core-NATS control broadcasts between engine processes (not persisted).
func (Names) DLQSubject ¶ added in v1.0.0
DLQSubject is the dead-letter subject for one kind of dead letter.
func (Names) DLQSubjects ¶ added in v1.0.0
DLQSubjects is the subject filter of the dead-letter stream.
func (Names) DurDispatch ¶ added in v1.0.0
DurDispatch is the durable consumer that feeds one dispatcher partition.
func (Names) DurIndexer ¶
DurIndexer is the durable consumer that maintains the visibility index.
func (Names) DurWorker ¶ added in v1.0.0
DurWorker is the durable consumer shared by every worker of one kind.
func (Names) EventPartitionFilter ¶ added in v1.0.0
EventPartitionFilter matches every execution of one partition.
func (Names) EventSubject ¶ added in v1.0.0
EventSubject is the subject holding every event of one execution.
func (Names) EventsSubjects ¶ added in v1.0.0
EventsSubjects is the subject filter of the events stream.
func (Names) ProgressFilter ¶ added in v1.0.0
ProgressFilter matches every progress message of execID.
func (Names) ProgressSubject ¶ added in v1.0.0
ProgressSubject carries the core-NATS progress messages a worker publishes while running node of execID: never stored (G5-04).
func (Names) ScheduleSubject ¶ added in v1.0.0
ScheduleSubject holds the cron schedule message named name.
func (Names) StopSubject ¶ added in v1.0.0
StopSubject carries the core-NATS stop notices for jobs of execID: the work they do is no longer wanted (G5-02).
func (Names) StopSubjects ¶ added in v1.0.0
StopSubjects matches every stop notice (one subscription per worker process).
func (Names) TimerExecFilter ¶ added in v1.0.0
TimerExecFilter matches every pending timer of one execution.
func (Names) TimerSubject ¶ added in v1.0.0
TimerSubject holds the schedule message of one durable timer.
func (Names) WorkDelaySubject ¶ added in v1.0.0
WorkDelaySubject holds the schedule that hands a busy job back to its kind's queue later.
func (Names) WorkDelaySubjects ¶ added in v1.0.0
WorkDelaySubjects is the subject filter of hand-back schedules.
func (Names) WorkSubject ¶ added in v1.0.0
WorkSubject is the job queue of one worker kind.
func (Names) WorkSubjects ¶ added in v1.0.0
WorkSubjects is the subject filter of the work stream.