instanceid

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package instanceid resolves and validates the per-daemon instance identifier used to namespace global resources (git branches, worktree paths, channel titles) so multiple daemons can share one gateway home.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resolve

func Resolve(explicit, owner string) (string, error)

Resolve computes the instanceID from an explicit id (e.g. HERRSCHER_INSTANCE_ID) and a fallback owner snowflake (e.g. HERRSCHER_OWNER_ID), per Spec §2:

  1. explicit, when set, must be a valid slug or Resolve errors;
  2. otherwise the owner is slugified;
  3. otherwise "" (legacy, non-namespaced mode).

func Slugify

func Slugify(owner string) string

Slugify derives a short instanceID from an owner identifier (e.g. a gateway account snowflake). It returns "u" + the last up-to-8 characters of owner, which keeps the result <=9 chars and within the validation regex. An empty owner yields an empty string.

func Validate

func Validate(id string) bool

Validate reports whether id is a well-formed instanceID slug.

Types

This section is empty.

Jump to

Keyboard shortcuts

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