Documentation
¶
Overview ¶
Package chassis provides the chassis-go toolkit version and version compatibility check.
Index ¶
Constants ¶
const ( PortHTTP = 0 // Primary HTTP/REST API PortGRPC = 1 // gRPC transport PortMetrics = 2 // Admin, Prometheus metrics, health )
Standard port role offsets for chassis transport roles.
Variables ¶
var Version = strings.TrimSpace(rawVersion)
Version returns the current release of chassis-go, read from the VERSION file. This is the single source of truth for the version number.
Functions ¶
func AssertVersionChecked ¶
func AssertVersionChecked()
AssertVersionChecked crashes if RequireMajor has not been called yet. Other chassis modules call this at their entry points.
func Port ¶
Port returns a deterministic port number derived from a service name using the djb2 hash algorithm. The result is in the range 5000–48000, well below the OS ephemeral port range (49152+).
The optional offset parameter (default 0) allows multiple ports per service:
chassis.Port("my_svc") // base port (HTTP)
chassis.Port("my_svc", chassis.PortGRPC) // base + 1 (gRPC)
chassis.Port("my_svc", chassis.PortMetrics) // base + 2 (metrics)
func RequireMajor ¶
func RequireMajor(required int)
RequireMajor crashes the process if the chassis major version does not match the required version. Services must call this at the top of main() before using any other chassis module.
func ResetVersionCheck ¶
func ResetVersionCheck()
ResetVersionCheck is for testing only — resets the version assertion state.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package announcekit provides standardized lifecycle events for services and jobs.
|
Package announcekit provides standardized lifecycle events for services and jobs. |
|
Package cache provides an in-memory TTL/LRU cache with optional OTel metrics.
|
Package cache provides an in-memory TTL/LRU cache with optional OTel metrics. |
|
Package call provides a resilient HTTP client with retry, circuit breaker, and timeout support using a composable builder pattern.
|
Package call provides a resilient HTTP client with retry, circuit breaker, and timeout support using a composable builder pattern. |
|
cmd
|
|
|
demo-shutdown
command
Command demo-shutdown verifies that lifecycle.Run handles SIGTERM correctly, cancels Contexts, and drains gracefully.
|
Command demo-shutdown verifies that lifecycle.Run handles SIGTERM correctly, cancels Contexts, and drains gracefully. |
|
Package config provides a generic, reflection-based configuration loader that populates structs from environment variables using struct tags.
|
Package config provides a generic, reflection-based configuration loader that populates structs from environment variables using struct tags. |
|
Package deploy provides convention-based deploy directory discovery.
|
Package deploy provides convention-based deploy directory discovery. |
|
Package errors provides a unified error type with dual HTTP and gRPC status codes.
|
Package errors provides a unified error type with dual HTTP and gRPC status codes. |
|
examples
|
|
|
01-cli
command
Example 01-cli demonstrates a simple CLI tool using config + logz.
|
Example 01-cli demonstrates a simple CLI tool using config + logz. |
|
02-service
command
Example 02-service demonstrates a reference gRPC service using config + logz + lifecycle + grpckit + health.
|
Example 02-service demonstrates a reference gRPC service using config + logz + lifecycle + grpckit + health. |
|
03-client
command
Example 03-client demonstrates the call package with retries and circuit breaking.
|
Example 03-client demonstrates the call package with retries and circuit breaking. |
|
04-full-service
command
Example 04-full-service demonstrates all chassis 5.0 modules wired together: config, logz, lifecycle, errors, secval, metrics, health, httpkit, grpckit, otel.
|
Example 04-full-service demonstrates all chassis 5.0 modules wired together: config, logz, lifecycle, errors, secval, metrics, health, httpkit, grpckit, otel. |
|
Package flagz provides feature flags with percentage rollouts and pluggable sources.
|
Package flagz provides feature flags with percentage rollouts and pluggable sources. |
|
Package graphkit provides an HTTP client for graphiti_svc, the knowledge graph service.
|
Package graphkit provides an HTTP client for graphiti_svc, the knowledge graph service. |
|
Package grpckit provides gRPC server utilities including standard interceptors for logging, panic recovery, and health-check registration.
|
Package grpckit provides gRPC server utilities including standard interceptors for logging, panic recovery, and health-check registration. |
|
Package health provides composable health checks with parallel execution and a standard HTTP handler that returns structured JSON results.
|
Package health provides composable health checks with parallel execution and a standard HTTP handler that returns structured JSON results. |
|
Package heartbeatkit provides zero-config automatic liveness events.
|
Package heartbeatkit provides zero-config automatic liveness events. |
|
Package httpkit provides standard HTTP middleware and response utilities.
|
Package httpkit provides standard HTTP middleware and response utilities. |
|
internal
|
|
|
otelutil
Package otelutil provides shared OTel API helpers for chassis-go packages.
|
Package otelutil provides shared OTel API helpers for chassis-go packages. |
|
Package kafkakit provides publish/subscribe to Redpanda via the Kafka protocol, with envelope wrapping, tenant filtering, dead letter queue routing, and stats.
|
Package kafkakit provides publish/subscribe to Redpanda via the Kafka protocol, with envelope wrapping, tenant filtering, dead letter queue routing, and stats. |
|
Package lakekit provides an HTTP client for lake_svc, the data lake query service.
|
Package lakekit provides an HTTP client for lake_svc, the data lake query service. |
|
Package lifecycle provides a minimal orchestration primitive for running concurrent components that share a single context for cancellation and graceful shutdown via OS signals.
|
Package lifecycle provides a minimal orchestration primitive for running concurrent components that share a single context for cancellation and graceful shutdown via OS signals. |
|
Package logz provides structured JSON logging with trace ID propagation.
|
Package logz provides structured JSON logging with trace ID propagation. |
|
Package metrics provides OpenTelemetry metrics with cardinality protection.
|
Package metrics provides OpenTelemetry metrics with cardinality protection. |
|
Package otel bootstraps OpenTelemetry trace and metric pipelines for chassis-go services.
|
Package otel bootstraps OpenTelemetry trace and metric pipelines for chassis-go services. |
|
Package registry provides file-based service registration at /tmp/chassis/.
|
Package registry provides file-based service registration at /tmp/chassis/. |
|
Package registrykit provides an HTTP client for registry_svc, the entity registry service.
|
Package registrykit provides an HTTP client for registry_svc, the entity registry service. |
|
Package schemakit provides Avro schema loading, validation, serialization, deserialization, and registration with a Schema Registry (e.g.
|
Package schemakit provides Avro schema loading, validation, serialization, deserialization, and registration with a Schema Registry (e.g. |
|
Package seal provides cryptographic primitives: AES-256-GCM encryption, HMAC-SHA256 signing, and temporary signed tokens.
|
Package seal provides cryptographic primitives: AES-256-GCM encryption, HMAC-SHA256 signing, and temporary signed tokens. |
|
Package secval provides JSON security validation: dangerous key detection and nesting depth limits.
|
Package secval provides JSON security validation: dangerous key detection and nesting depth limits. |
|
Package testkit provides lightweight test helpers for chassis-go services.
|
Package testkit provides lightweight test helpers for chassis-go services. |
|
Package tick provides periodic task components for use with lifecycle.Run.
|
Package tick provides periodic task components for use with lifecycle.Run. |
|
Package tracekit propagates trace IDs across events and HTTP calls using Go's context mechanism.
|
Package tracekit propagates trace IDs across events and HTTP calls using Go's context mechanism. |
|
Package work provides structured concurrency primitives with bounded parallelism and OpenTelemetry tracing.
|
Package work provides structured concurrency primitives with bounded parallelism and OpenTelemetry tracing. |
|
Package xyops provides a client for the xyops API with curated methods, optional monitoring bridge, and a raw escape hatch.
|
Package xyops provides a client for the xyops API with curated methods, optional monitoring bridge, and a raw escape hatch. |
|
Package xyopsworker lets a chassis service receive and execute jobs dispatched by xyops, behaving as a satellite server.
|
Package xyopsworker lets a chassis service receive and execute jobs dispatched by xyops, behaving as a satellite server. |