1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
//! [`TenantKey`] — adopter-owned tenant labels for applications that keep
//! tenant context beside Sassi handles.
//!
//! Sassi does not infer tenant isolation from cached values and does not
//! turn [`crate::punnu::PunnuConfig::namespace`] into an L1 tenancy boundary.
//! `PunnuConfig::namespace` is for L2 backend keyspace separation.
//!
//! Applications that need tenant or substrate separation should make that
//! boundary explicit: own separate pool handles per substrate, use distinct
//! wrapper types, choose a tenant-qualified id when identity itself is
//! tenant-qualified, or carry `TenantKey` alongside the pool/reference that
//! is allowed to serve a request.
//!
//! Do not share one `Punnu<T>` across tenants while fetching by an unqualified
//! primitive id and relying on `TenantKey` beside the handle. L1 storage and
//! single-flight coalescing are keyed by `T::Id`, not by fetcher context. If two
//! tenants can both ask for `id = 7`, encode the tenant into `T::Id`, use a
//! tenant-specific wrapper type, or keep separate pools.
/// Opaque tenant identifier.
///
/// A `TenantKey` is just a wrapper around `String`: no parsing, no schema,
/// and no built-in authorization semantics. Sassi never inspects the contents.
/// Consumers choose the encoding; typical patterns are tenant slugs (`"acme"`),
/// stable external ids, or environment-prefixed labels (`"prod_acme"`).
///
/// `TenantKey` is useful application state, not an automatic cache-key
/// dimension. Passing it around beside a shared pool does not change
/// `get_or_fetch` or L1 identity semantics.
///
/// # Construction
///
/// Use the standard `From<String>` / `From<&str>` impls, or
/// [`TenantKey::none`] for the "single-tenant pool" sentinel.
///
/// ```
/// use sassi::TenantKey;
///
/// let acme: TenantKey = "acme".into();
/// assert_eq!(acme.as_str(), "acme");
/// assert!(TenantKey::none().is_none());
/// ```
;