Implementation:ArroyoSystems Arroyo Public Ids
| Knowledge Sources | |
|---|---|
| Domains | Streaming, Identity |
| Last Updated | 2026-02-08 08:00 GMT |
Overview
Provides a typed public ID generation system using nanoid with a type-specific prefix scheme for all Arroyo API resources.
Description
This module generates human-readable, URL-safe, prefixed identifiers for all Arroyo resources. Each ID consists of a type-specific prefix followed by an underscore and a 10-character nanoid drawn from a 62-character alphanumeric alphabet (0-9, A-Z, a-z).
The IdTypes enum defines all resource types with their corresponding prefixes:
- ak -- ApiKey
- cp -- ConnectionProfile
- sch -- Schema
- pl -- Pipeline
- job -- JobConfig
- chk -- Checkpoint
- js -- JobStatus
- ci -- ClusterInfo
- jlm -- JobLogMessage
- ct -- ConnectionTable
- ctp -- ConnectionTablePipeline
- udf -- Udf
Example generated IDs: "pl_aB3xK9mL2p", "ct_Zr4wQ8nE1s".
Usage
Call generate_id with the appropriate IdTypes variant whenever a new resource is created that needs a public-facing identifier.
Code Reference
Source Location
- Repository: ArroyoSystems_Arroyo
- File: crates/arroyo-rpc/src/public_ids.rs
Signature
pub enum IdTypes {
ApiKey, ConnectionProfile, Schema, Pipeline,
JobConfig, Checkpoint, JobStatus, ClusterInfo,
JobLogMessage, ConnectionTable, ConnectionTablePipeline, Udf,
}
pub fn generate_id(id_type: IdTypes) -> String;
Import
use arroyo_rpc::public_ids::{generate_id, IdTypes};
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| id_type | IdTypes | Yes | The resource type to generate an ID for |
Outputs
| Name | Type | Description |
|---|---|---|
| id | String | Prefixed nanoid string (e.g., "pl_aB3xK9mL2p") |
Usage Examples
use arroyo_rpc::public_ids::{generate_id, IdTypes};
let pipeline_id = generate_id(IdTypes::Pipeline);
// e.g., "pl_aB3xK9mL2p"
let connection_id = generate_id(IdTypes::ConnectionTable);
// e.g., "ct_Zr4wQ8nE1s"