Skip to main content

photon_backend/
lib.rs

1//! Transport log, storage adapters, and delivery for Photon.
2//!
3//! Pluggable [`StoragePort`] implementations, unified [`GenericPhotonBackend`],
4//! subscriptions, checkpoints, retention, and consumer groups.
5//!
6//! ## Goals
7//!
8//! - Append-only sequenced transport with swappable storage adapters (`mem`, `sqlite`, broker tiers)
9//! - Durable subscriptions with coalesced checkpoints and optional retention reclaim
10//! - Consumer-group shard routing for load-balanced handlers
11//!
12//! ## Non-goals
13//!
14//! - Canonical system-of-record datastore (transport log is encrypted and transient)
15//! - Ops/admin UI (hosts provide their own)
16//!
17//! Public crate documentation map: `cargo doc -p uf-photon --features runtime,mem --open`.
18
19#![cfg(feature = "runtime")]
20#![cfg_attr(test, allow(clippy::unwrap_used, clippy::expect_used))]
21
22pub mod backend;
23pub mod broker_security;
24pub mod checkpoint;
25pub mod consumer_group;
26pub mod delivery;
27pub mod delivery_mode;
28pub mod descriptor;
29pub mod error;
30pub mod event;
31pub mod executor_services;
32pub mod group_subscribe;
33pub mod handler_ctx;
34pub mod handler_descriptor;
35pub mod handler_registry;
36pub mod input;
37pub mod instrumentation;
38pub mod models;
39pub mod publish_routing;
40pub mod registry;
41pub mod retention;
42pub mod sanitize;
43pub mod shard_router;
44pub mod storage;
45
46pub use backend::{
47    BackendCapabilities, BackendContext, EmbeddedBackend, GenericPhotonBackend, PhotonBackend,
48};
49pub use broker_security::{BrokerTransportSecurity, ALLOW_INSECURE_BROKER_ENV};
50pub use consumer_group::{
51    ConsumerGroupCoordinator, ConsumerLease, FleetGroupCoordinator, GroupMember, LeaseStore,
52    MemoryLeaseStore, StaticGroupCoordinator,
53};
54pub use delivery_mode::{DeliveryMode, ShardConfig};
55pub use descriptor::TopicDescriptor;
56pub use error::{PhotonError, Result, SharedError};
57pub use event::{open_stored_event, seal_event_for_storage, TransportCrypto, ENVELOPE_JSON_KEY};
58pub use executor_services::ExecutorServices;
59pub use group_subscribe::{merge_shard_streams, AbortOnDrop};
60pub use handler_ctx::HandlerCtx;
61pub use handler_descriptor::HandlerDescriptor;
62pub use handler_registry::HandlerRegistry;
63pub use input::{
64    map_broker_connect_err, redact_credentials_in_text, redact_endpoint, validate_payload_size,
65    validate_topic_name, MAX_PAYLOAD_JSON_BYTES, MAX_TOPIC_NAME_BYTES,
66};
67pub use models::{
68    Envelope, Event, GroupOpts, SubscribeOpts, Subscription, SubscriptionHandle, SubscriptionMode,
69    TopicMetadata,
70};
71pub use publish_routing::{resolve_publish_target, PublishTarget};
72pub use registry::TopicRegistry;
73pub use retention::{
74    ReclaimReport, RetentionDeps, RetentionHook, RetentionPolicy, RetentionReclaimer,
75    SubscriptionPartition, TopicPartition,
76};
77pub use sanitize::{sanitize_error_message, MAX_ERROR_MESSAGE_CHARS};
78pub use shard_router::{
79    group_publish_storage_key, is_shard_storage_key, parse_shard_storage_key, routing_key,
80    shard_id, shard_storage_key, SHARD_KEY_PREFIX,
81};
82pub use storage::{topic_filter_matches, InProcStoragePort, StorageCapabilities, StoragePort};
83
84pub use quark::inventory;