Expand description
§Sassi
Typed in-memory pool (Punnu<T>) with composable predicate algebra
(BasicPredicate<T> + MemQ<T>) and cross-runtime trait queries.
Sassi is framework-neutral: usable from native services, workers,
libraries, and wasm32-unknown-unknown applications without a
backend-specific dependency. Predicates compose with &, |, ^,
! operators and evaluate through the same in-memory path on every
supported target.
Pre-v0.1.0 alpha. The core public surface is available now:
Cacheable identities, Punnu<T> pools, in-memory
MemQ scopes, lazy fetch helpers, TTL/LRU policy, event streams,
and atomic delta application.
§Quick tour
use sassi::{Cacheable, Field, MemQ, Punnu};
#[derive(Clone)]
struct User { id: i64, age: u32 }
#[derive(Default)]
struct UserFields {
pub id: Field<User, i64>,
pub age: Field<User, u32>,
}
impl Cacheable for User {
type Id = i64;
type Fields = UserFields;
fn id(&self) -> i64 { self.id }
fn fields() -> UserFields {
UserFields {
id: Field::new("id", |u| &u.id),
age: Field::new("age", |u| &u.age),
}
}
}
let users = Punnu::<User>::builder().build();
users.insert(User { id: 1, age: 32 }).await.unwrap();
let adults = users
.scope(vec![MemQ::filter_basic(User::fields().age.gte(18))])
.collect();
assert_eq!(adults.len(), 1);Re-exports§
pub use backend::BackendInvalidation;pub use backend::BackendInvalidationStream;pub use backend::BackendKeyspace;pub use backend::CacheBackend;pub use backend::FileBackend;pub use backend::MemoryBackend;pub use cacheable::Cacheable;pub use cacheable::Field;pub use error::WireFormatError;pub use error::BackendError;pub use error::FetchError;pub use error::InsertError;pub use predicate::BasicPredicate;pub use predicate::FieldPredicate;pub use predicate::LookupOp;pub use predicate::MemQ;pub use punnu::BackendFailureMode;pub use punnu::CacheTier;pub use punnu::DeltaApplyStats;pub use punnu::DeltaPunnuFetcher;pub use punnu::DeltaQuery;pub use punnu::DeltaRefreshHandle;pub use punnu::DeltaResult;pub use punnu::EventReason;pub use punnu::InvalidationReason;pub use punnu::OnConflict;pub use punnu::Punnu;pub use punnu::PunnuBuilder;pub use punnu::PunnuConfig;pub use punnu::PunnuEvent;pub use punnu::PunnuFetcher;pub use punnu::PunnuMetrics;pub use punnu::PunnuScope;pub use punnu::RefreshHandle;pub use punnu::RefreshMode;pub use punnu::TenantKey;pub use punnu::UpdateResult;pub use sassi::Sassi;pub use watermark::DeltaSyncCacheable;pub use watermark::MonotonicWatermark;
Modules§
- backend
- Pluggable L2 cache backend interfaces and built-in implementations.
- cacheable
Cacheabletrait +Fieldaccessor — the identity contract for entries stored in aPunnu.- error
- Library-wide error types.
- predicate
- Predicate algebras.
- punnu
Punnu<T>— typed in-memory pool with composable predicate filtering, an event stream, single-flight fetch coalescing, opt-in TTL, and pluggable L2 backends.- sassi
- Cross-type orchestration for typed
Punnupools. - watermark
- Monotonic watermark contracts for delta-sync refreshes.
- wire
- Versioned JSON wire envelope for L2 cache backends.
Functions§
- version
- The crate version, surfaced from
CARGO_PKG_VERSION. Useful for runtime diagnostics. Sassi’s wire envelope uses its ownwire::WIRE_FORMAT_MAJOR, not the crate semver version.
Type Aliases§
- Instant
- Cross-target monotonic clock instant. See module-level docs.
Attribute Macros§
- trait_
impl - Attribute macro for registering a trait implementation with
Sassi::all_impl::<dyn Trait>().
Derive Macros§
- Cacheable
- Derive macro for
sassi::Cacheable.