Skip to main content

Crate rust_zero_core

Crate rust_zero_core 

Source
Expand description

Framework-neutral runtime primitives shared by rust-zero services.

The crate provides configuration loading, circuit breaking, adaptive load shedding, consistent hashing, and async retry helpers. They intentionally do not depend on a particular HTTP or gRPC framework so REST, RPC, and background services can share them.

Re-exports§

pub use auth::decode_jwt_hs256;
pub use auth::encode_jwt_hs256;
pub use auth::sign_request;
pub use auth::AuthFailure;
pub use auth::JwtClaimProjection;
pub use auth::JwtValidationError;
pub use auth::RequestSignature;
pub use auth::RequestSignatureVerifier;
pub use auth::AUTH_KEY_ID_HEADER;
pub use auth::AUTH_SIGNATURE_HEADER;
pub use auth::AUTH_TIMESTAMP_HEADER;
pub use balancer::BalancerError;
pub use balancer::NodeSnapshot;
pub use balancer::P2cBalancer;
pub use balancer::P2cRequest;
pub use bloom::BloomError;
pub use bloom::BloomFilter;
pub use breaker::BreakerState;
pub use breaker::CircuitBreaker;
pub use breaker::CircuitBreakerConfig;
pub use breaker::CircuitBreakerError;
pub use breaker::CircuitBreakerPermit;
pub use breaker::CircuitBreakerPolicy;
pub use breaker::CircuitBreakerSnapshot;
pub use breaker::CircuitOutcome;
pub use breaker::RollingCircuitBreakerConfig;
pub use cache::CacheStats;
pub use cache::MemoryCache;
pub use cache::ReadThroughCache;
pub use cache::TtlCache;
pub use config::load_config;
pub use config::parse_config;
pub use config::ConfigError;
pub use config::ConfigFormat;
pub use config::ServiceConfig;
pub use config_center::ConfigCenterError;
pub use config_center::ConfigSnapshot;
pub use config_center::DynamicConfig;
pub use discov::DiscoveredEndpoint;
pub use discov::DiscoveryError;
pub use discov::DiscoveryReconnectBackoff;
pub use discov::EndpointChangeFuture;
pub use discov::EndpointSubscription;
pub use discov::ServiceEvent;
pub use discov::ServiceLease;
pub use discov::ServiceRegistry;
pub use discov::ServiceSubscription;
pub use etcd::EtcdClient;
pub use etcd::EtcdConfig;
pub use etcd::EtcdConfigWatcher;
pub use etcd::EtcdError;
pub use etcd::EtcdServiceLease;
pub use etcd::EtcdServiceSubscription;
pub use executor::BatchExecutor;
pub use executor::BatchExecutorError;
pub use executor::ChunkExecutor;
pub use executor::DelayExecutor;
pub use executor::DelayExecutorError;
pub use executor::LessExecutor;
pub use executor::PeriodicExecutor;
pub use executor::PeriodicExecutorError;
pub use fx::retry;
pub use fx::timeout;
pub use fx::RetryPolicy;
pub use hash::ConsistentHash;
pub use health::HealthRegistry;
pub use health::HealthSnapshot;
pub use kubernetes::KubernetesDiscovery;
pub use kubernetes::KubernetesDiscoveryConfig;
pub use kubernetes::KubernetesDiscoveryError;
pub use kubernetes::KubernetesServiceSubscription;
pub use limit::LimitDecision;
pub use limit::PeriodLimiter;
pub use limit::TokenLimiter;
pub use limit::RedisLimiterSnapshot;
pub use limit::RedisPeriodLimiter;
pub use limit::RedisTokenLimiter;
pub use load::AdaptiveShedder;
pub use load::LoadShedderConfig;
pub use load::LoadShedderMode;
pub use load::LoadShedderSnapshot;
pub use load::ShedPermit;
pub use log::LogConfig;
pub use log::LogContext;
pub use log::LogEncoding;
pub use log::LogError;
pub use log::LogField;
pub use log::LogLevel;
pub use log::LogSampler;
pub use log::LogTarget;
pub use log::Logger;
pub use log::RotationPolicy;
pub use log::Sensitive;
pub use metric::CounterVec;
pub use metric::GaugeVec;
pub use metric::HistogramOptions;
pub use metric::HistogramVec;
pub use metric::Metrics;
pub use metric::MetricsError;
pub use metric::VectorOptions;
pub use profile::ProfilePoint;
pub use profile::ProfileSnapshot;
pub use profile::Profiler;
pub use pubsub::Broker;
pub use pubsub::Subscription;
pub use queue::BalancedPusher;
pub use queue::FanoutPusher;
pub use queue::PushError;
pub use queue::PusherConfigError;
pub use queue::QueueConfigError;
pub use queue::QueueEvent;
pub use queue::QueueMetrics;
pub use queue::QueueProducer;
pub use queue::QueueReceiver;
pub use queue::QueueRuntime;
pub use queue::QueueRuntimeConfig;
pub use queue::QueueRuntimeError;
pub use queue::QueueSender;
pub use queue::RunningQueue;
pub use rolling::RollingSnapshot;
pub use rolling::RollingWindow;
pub use service::wait_for_shutdown_signal;
pub use service::RunningServices;
pub use service::ServiceGroup;
pub use service::ServiceGroupError;
pub use service::Shutdown;
pub use service::ShutdownHandle;
pub use service::ShutdownSignal;
pub use singleflight::SingleFlight;
pub use singleflight::SingleFlightError;
pub use stores_mongo::CachedMongoCollection;
pub use stores_mongo::MongoCacheConfig;
pub use stores_mongo::MongoStore;
pub use stores_mongo::MongoStoreConfig;
pub use stores_mongo::MongoStoreError;
pub use stores_mongo::MongoStoreMetrics;
pub use stores_redis::RedisCacheError;
pub use stores_redis::RedisJsonCache;
pub use stores_redis::RedisLock;
pub use stores_redis::RedisModelCache;
pub use stores_redis::RedisModelCacheConfig;
pub use stores_redis::RedisModelCacheError;
pub use stores_redis::RedisStore;
pub use stores_redis::RedisStoreConfig;
pub use stores_redis::RedisStoreError;
pub use stores_redis::RedisStoreMetrics;
pub use stores_redis::RedisSubscription;
pub use stores_redis::RedisSubscriptionConfig;
pub use stores_redis::RedisSubscriptionEvent;
pub use stores_redis::RedisSubscriptionMessage;
pub use stores_redis::RedisTtl;
pub use stores_sql::CachedSqlStore;
pub use stores_sql::MySqlStore;
pub use stores_sql::PostgresStore;
pub use stores_sql::SqlCacheConfig;
pub use stores_sql::SqlStore;
pub use stores_sql::SqlStoreConfig;
pub use stores_sql::SqlStoreError;
pub use stores_sql::SqlStoreMetrics;
pub use stores_sql::SqliteStore;
pub use telemetry::OtlpTransport;
pub use telemetry::Telemetry;
pub use telemetry::TelemetryConfig;
pub use telemetry::TelemetryError;
pub use telemetry::TelemetrySpan;
pub use telemetry::TelemetrySpanKind;
pub use trace::TraceContext;
pub use trace::TraceContextError;
pub use trace::TraceFlags;
pub use validation::Validate;
pub use validation::Validation;
pub use validation::ValidationErrors;
pub use validation::Violation;

Modules§

auth
Transport-neutral authentication results and time-window-bounded request signatures.
balancer
bloom
breaker
cache
config
config_center
discov
etcd
Etcd-backed configuration and service discovery.
executor
fx
hash
health
kubernetes
Kubernetes EndpointSlice service discovery.
limit
load
log
metric
profile
pubsub
queue
rolling
service
singleflight
stores_mongo
MongoDB collections, transactions, instrumentation, and cache-aside records.
stores_redis
Redis data structures, locks, streams, subscriptions, and model caching.
stores_sql
Typed SQLx pools, instrumentation, batching, and cache-aside records.
telemetry
OpenTelemetry tracing and OTLP export.
trace
validation