Skip to content

Class: FullTrackName ​

Fully-qualified track identifier = hierarchical namespace (tuple) + leaf name bytes.

Constraints enforced (throws TrackNameError):

Namespace input may be:

  • string path with segments separated by / (converted via Tuple.fromUtf8Path). Empty segments are dropped, so '' and '/' both yield a zero-element namespace.
  • Existing Tuple instance.

Name input may be:

  • UTF-8 string (encoded)
  • Raw Uint8Array (used directly)

Instances are created via FullTrackName.tryNew (validates) or FullTrackName.deserialize. Use FullTrackName.serialize for wire encoding and FullTrackName.toString for a human friendly diagnostic format: namespace/segments:hexname (name rendered as lowercase hex, no 0x prefix).

The string form is intended for logs/debug only; do not parse it for protocol operations.

Properties ​

name ​

readonly name: Uint8Array


namespace ​

readonly namespace: Tuple

Methods ​

serialize() ​

serialize(): FrozenByteBuffer

Serialize to a frozen buffer: tuple (namespace) followed by length‑prefixed name bytes. Consumers needing raw bytes should call .toUint8Array() on the returned FrozenByteBuffer.

Returns ​

FrozenByteBuffer


toString() ​

toString(): string

Human-readable representation: \<namespace path joined by '/'\>:\<name as lowercase hex\>. If the underlying Tuple exposes toUtf8Path, it's used; otherwise the raw fields are joined. This is lossy only in the sense that name bytes are hex encoded; round-tripping requires serialization.

Returns ​

string


deserialize() ​

static deserialize(buf): FullTrackName

Parse a serialized full track name. Performs the same validations as FullTrackName.tryNew. The provided buffer's read cursor advances accordingly.

Parameters ​

buf ​

BaseByteBuffer

Returns ​

FullTrackName

Throws ​

:TrackNameError if constraints are violated.


tryNew() ​

static tryNew(namespace, name): FullTrackName

Construct a validated full track name.

Validation steps:

  1. Convert namespace string -> Tuple (split on '/') if needed.
  2. Reject if namespace tuple field count is > MAX_NAMESPACE_TUPLE_COUNT.
  3. Encode name string to UTF-8 if needed.
  4. Reject if total serialized length (namespace tuple + name bytes) > MAX_FULL_TRACK_NAME_LENGTH.

Parameters ​

namespace ​

string | Tuple

name ​

string | Uint8Array<ArrayBufferLike>

Returns ​

FullTrackName

Throws ​

:TrackNameError on any constraint violation.

Example ​

ts
const full = FullTrackName.tryNew('media/video', 'keyframe')
console.log(full.toString()) // media/video:6b65796672616d65