Skip to main content

elura/
lib.rs

1//! Application-facing API for Elura.
2//!
3//! The crate root contains only the framework error types. Runtime components,
4//! extension contracts and infrastructure integrations live in their domain
5//! modules.
6
7#![deny(rustdoc::broken_intra_doc_links)]
8#![deny(missing_docs)]
9
10#[cfg(feature = "core")]
11pub use elura_core::{Error, Result};
12
13/// Low-level protocol and domain primitives.
14#[cfg(feature = "core")]
15pub mod core {
16    pub use elura_core::{
17        account_version, gateway_world, identity, online, otp, outbox, ownership, protocol, push,
18        rate_limit, realm_gateway, realtime, replay, replication, session, state_hash, ticket,
19    };
20}
21
22/// Common application types and extension traits for opt-in glob imports.
23///
24/// Concrete adapters and provider implementations remain in their domain
25/// modules so their infrastructure dependencies stay visible at call sites.
26pub mod prelude {
27    #[cfg(feature = "core")]
28    pub use crate::{Error, Result};
29    #[cfg(feature = "core")]
30    pub use elura_core::account_version::{
31        AccountVersionKey, AccountVersionStore, MutableAccountVersionStore,
32    };
33    #[cfg(feature = "core")]
34    pub use elura_core::online::{
35        DuplicateLoginMode, OnlineBackend, OnlineDirectory, OnlineStats, OnlineStatsReader,
36    };
37    #[cfg(feature = "core")]
38    pub use elura_core::otp::OtpStore;
39    #[cfg(feature = "core")]
40    pub use elura_core::outbox::{DeadLetter, OutboxDelivery, OutboxEvent, OutboxStore};
41    #[cfg(feature = "core")]
42    pub use elura_core::ownership::OwnershipResolver;
43    #[cfg(feature = "core")]
44    pub use elura_core::push::{
45        PushHandler, PushReceipt, PushRequest, PushTarget, PushTargetResolver, PushTransport,
46    };
47    #[cfg(feature = "core")]
48    pub use elura_core::session::{
49        Identity, PlayerKey, SessionControlHandler, SessionControlTransport,
50    };
51    #[cfg(feature = "core")]
52    pub use elura_core::ticket::{ReplayStore, TicketPurpose, TicketService};
53
54    #[cfg(feature = "core")]
55    pub use crate::discovery::{
56        GatewayWorldRoutingConfig, WorldDiscovery, WorldRegistrar, WorldRegistration,
57    };
58    #[cfg(feature = "gateway")]
59    pub use crate::gateway::observability::{AdmissionAdmin, GatewayAdmin};
60    #[cfg(feature = "gateway")]
61    pub use crate::gateway::{
62        Gateway, GatewayConfig, GatewayInterceptContext, GatewayInterceptor, GatewayNext,
63        GatewayRealmAdmissionConfig, GatewayRequest, GatewayResponse, GatewayServer,
64        GatewayStatsSnapshot, GatewayTicketConfig, GatewayWorldTlsConfig, ReconnectTicketRequest,
65        ReconnectTicketResponse, RouteRateLimit, TcpWorldClient, WorldClient, WorldRequest,
66        WorldRouteTarget, WorldRouteUpdater,
67    };
68    #[cfg(feature = "runtime")]
69    pub use crate::launch::ServerTlsFilesConfig;
70    #[cfg(feature = "monolith")]
71    pub use crate::monolith::{Monolith, MonolithServer};
72    #[cfg(feature = "runtime")]
73    pub use crate::observability::{
74        AdminDiagnostics, AdminServer, AdminServerConfig, PrometheusText, Readiness, ReadinessProbe,
75    };
76    #[cfg(feature = "gateway")]
77    pub use crate::protection::{
78        BackendProtector, CircuitState, ProtectionConfig, ProtectionStats,
79    };
80    #[cfg(feature = "runtime")]
81    pub use crate::security::{
82        ClientTlsConfig, InternalToken, ServerTlsConfig, TlsCertificateReloader,
83    };
84    #[cfg(feature = "gateway")]
85    pub use crate::transport::{
86        AccountVersionSettings, AdmissionController, AdmissionDecision, AdmissionRejection,
87        AdmissionRequest, AdmissionSettings, AdmissionStage, GatewayTransport,
88        GatewayTransportListener, ProxyProtocolConfig, QuicConfig, RealmAdmission, SessionEvent,
89        SessionEventKind, SessionObserver, TcpConfig, TcpProxyProtocolConfig, TcpTransport,
90        TrustedProxies, WebSocketConfig,
91    };
92    #[cfg(feature = "world")]
93    pub use crate::world::player::{InvalidationBus, InvalidationHandler, PlayerLoader};
94    #[cfg(feature = "world")]
95    pub use crate::world::{
96        Event, InProcessWorldClient, Next, Route, World, WorldConfig, WorldContext,
97        WorldDiagnostics, WorldHandler, WorldMiddleware, WorldModule, WorldServer,
98        WorldStatsSnapshot,
99    };
100
101    #[cfg(feature = "runtime")]
102    pub use elura_runtime::outbox::{EventHandler, IdempotencyStore};
103
104    #[cfg(any(feature = "identity", feature = "notification-alisms", feature = "otp"))]
105    pub use crate::providers::identity::{
106        IdentityBindingStore, IdentityProvider, OtpSender, OtpVerifier, PasswordCredentialStore,
107    };
108    #[cfg(feature = "providers")]
109    pub use crate::providers::payment::PaymentProvider;
110    #[cfg(feature = "providers")]
111    pub use crate::providers::{ProviderError, ProviderName, ProviderResult};
112}
113
114/// World runtime APIs grouped by responsibility.
115#[cfg(feature = "world")]
116pub mod world {
117    pub use elura_world::{
118        Event, InProcessWorldClient, Next, Route, World, WorldConfig, WorldContext,
119        WorldDiagnostics, WorldHandler, WorldMiddleware, WorldModule, WorldModuleRegistry,
120        WorldServer, WorldStatsSnapshot,
121    };
122
123    /// Middleware contracts and built-in middleware.
124    pub mod middleware {
125        pub use elura_world::LoggingMiddleware;
126
127        /// Transaction support for unit-of-work middleware.
128        pub mod transaction {
129            pub use elura_world::{
130                TransactionFactory, TransactionGuard, UnitOfWorkMiddleware, WorldTransaction,
131            };
132        }
133    }
134
135    /// Player-state loading, caching and invalidation middleware.
136    pub mod player {
137        pub use elura_world::player::*;
138    }
139
140    /// Data returned by World diagnostics.
141    pub mod diagnostics {
142        pub use elura_world::RouteInfo;
143    }
144
145    /// In-process World test harness.
146    pub mod testing {
147        pub use elura_world::WorldHarness;
148    }
149}
150
151/// Advanced runtime APIs grouped by responsibility. These are intentionally
152/// not flattened into the crate root used by World applications.
153#[cfg(feature = "core")]
154pub use elura_core::gateway_world as discovery;
155
156/// Transactional outbox contracts and dispatch runtime.
157#[cfg(feature = "runtime")]
158pub mod outbox {
159    pub use elura_core::outbox::*;
160    pub use elura_runtime::outbox::*;
161}
162
163#[cfg(feature = "runtime")]
164pub use elura_runtime::{launch, lifecycle, observability, security};
165
166#[cfg(feature = "gateway")]
167pub use elura_gateway::{self as gateway, protection, transport};
168
169#[cfg(feature = "monolith")]
170pub use elura_monolith as monolith;
171
172/// Redis, SQL, Kubernetes and other infrastructure implementations.
173#[cfg(feature = "adapters")]
174pub use elura_adapters as adapters;
175
176/// Identity, notification, OTP and payment integrations for upper applications.
177#[cfg(feature = "providers")]
178pub mod providers {
179    pub use elura_providers::{ProviderError, ProviderName, ProviderResult, payment};
180
181    #[cfg(any(feature = "identity", feature = "notification-alisms", feature = "otp"))]
182    pub use elura_providers::identity;
183    #[cfg(feature = "notification-alisms")]
184    pub use elura_providers::notification;
185    #[cfg(feature = "otp")]
186    pub use elura_providers::otp;
187}