Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Photon
Feature flags, wiring, and verify commands for adding Photon to a Rust service. Project overview: README.
Install
crates.io package uf-photon (Rust crate name remains photon):
= { = "uf-photon", = "0.1.0", = ["runtime", "mem"] }
Features
| Feature | Purpose |
|---|---|
runtime |
Full stack — backends, Photon, executor. |
mem |
Default in-process storage (InProcStoragePort) for tests and dev |
sqlite |
Embedded SQLite storage (photon-backend-sqlite) |
nats |
NATS JetStream storage adapter (photon-backend-nats) |
fluvio |
Fluvio storage adapter (photon-backend-fluvio) |
kafka |
Kafka storage adapter (photon-backend-kafka) |
Configuration reference: docs.rs photon::config. Architecture: docs.rs photon.
Ships with no default features (default = []). Enable runtime + mem for the standard evaluation path.
Wiring
- Build with
Photon::builder()— default installsInProcStoragePort(mem). RequiresPHOTON_TRANSPORT_KEY(TransportCrypto::from_env). - Optionally pass
.storage_port(Arc<dyn StoragePort>)forsqliteor broker adapters. - Call
.auto_registry()when using#[photon::topic]/#[photon::subscribe]. - Keep the
Photonhandle and callpublish_on(&photon)/subscribe_on(&photon, opts)(preferred). - Optional:
photon::configure(photon)for process-wide.publish()/.subscribe()sugar. - Call
photon.start_executor(identity)when using#[photon::subscribe]handlers.
Default bootstrap (mem)
use Photon;
// Loads PHOTON_TRANSPORT_KEY via from_env().
let photon = builder.auto_registry.build?;
// EventType { ... }.publish_on(&photon).await?;
// Optional: configure(photon) for .publish() without a handle.
Custom storage port
use Arc;
use Photon;
use InProcStoragePort;
use TransportCrypto;
let port = new;
let photon = builder
.storage_port
.auto_registry
.build?;
Broker env vars and builder options: each adapter's *StoragePortBuilder rustdoc (linked from photon::config).
SQLite — durable single-process
Write-through persistence with in-memory live fanout (no external broker):
use Arc;
use ;
let port = new;
// Or: SqliteStoragePort::from_env().await? // reads PHOTON_SQLITE_PATH
let photon = builder
.storage_port
.auto_registry
.build?;
NATS JetStream — production (durable)
Durable subscriptions, checkpoint replay, and stream-sharded fleet ingress:
use Arc;
use ;
let port = new;
let photon = builder
.storage_port
.auto_registry
.build?;
NATS JetStream — high ingress (ephemeral)
Maximum publish throughput when durable replay and checkpoints are not required:
use Arc;
use ;
let port = new;
let photon = builder
.storage_port
.auto_registry
.build?;
Builder fields and env fallbacks: NatsStoragePortBuilder rustdoc.
Verify
Prefer AWS when local cargo is unavailable: ../infra/aws/sqlite-smoke/scripts/run-remote-check.sh.
Full matrix: root README § Verify. Macro expansion: docs/macro-expansion.md.