pub struct CompressionPolicy {Show 18 fields
pub target_tokens: Option<usize>,
pub reserve_output_tokens: usize,
pub preset: Preset,
pub task_scope: TaskScope,
pub encoding: OutputEncoding,
pub pruning: Option<PruningPolicy>,
pub preserve_latest_user_message: bool,
pub disabled: Vec<String>,
pub experimental: bool,
pub enable: Vec<String>,
pub store_originals: bool,
pub retrieval_namespace: String,
pub retrieval_ttl_seconds: Option<u64>,
pub retrieval_backend: String,
pub retrieval_store_path: Option<PathBuf>,
pub lossy: Option<LossyPath>,
pub lossy_ratio: f64,
pub lossy_preserve: Vec<String>,
/* private fields */
}Fields§
§target_tokens: Option<usize>§reserve_output_tokens: usize§preset: Preset§task_scope: TaskScope§encoding: OutputEncoding§pruning: Option<PruningPolicy>§preserve_latest_user_message: bool§disabled: Vec<String>§experimental: boolCLI --experimental: enables transforms with ModeEntry.experimental == true
(currently diff_compaction; log_compaction was promoted out of --experimental
after the Phase 5 fidelity gate, see modes::ALL_ENTRIES) at their validated ratio band.
enable: Vec<String>CLI --enable <id>: force-enable a specific transform ID even though its preset-matrix
entry doesn’t enable it for the current preset. Still requires experimental for any
transform whose ModeEntry.experimental == true (see modes::pipeline_for).
store_originals: boolWhen true, and the full pre-transform input contains no secret-shaped content,
pipeline::compress_with_estimator persists it to the reversible evidence store
(retrieval_backend/retrieval_store_path) under its SHA-256 hash.
retrieval_namespace: StringThe evidence-store namespace stored-original entries are keyed under (see
retrieval_store::RetrievalStore::store).
retrieval_ttl_seconds: Option<u64>TTL passed to RetrievalStore::store for newly stored originals. None means
“use retrieval_store::DEFAULT_TTL_SECONDS” (this is a default, not “never expire” —
that per-entry meaning belongs to RetrievalStore::store’s own ttl_seconds parameter).
retrieval_backend: StringBackend name passed to RetrievalStore::open (“memory” | “filesystem” |
“sqlite” — the latter fails clearly, handled as best-effort skip, see
pipeline::maybe_store_originals).
retrieval_store_path: Option<PathBuf>Filesystem backend root override. None means
retrieval_store::default_store_path().
lossy: Option<LossyPath>Opt-in lossy JSON array-item selection: array items are dropped and replaced by a
recoverable $tf_ref marker. None (the default) means the lossless pipeline is
untouched — this field is set only by an explicit CLI flag, never derived from
preset/experimental, and is deliberately NOT part of modes.rs/ALL_ENTRIES: it is a
fundamentally different category (data-lossy, not just structurally-lossy-but-reversible)
from every other transform in this crate. See pipeline::apply_lossy_reduction.
lossy_ratio: f64BEST-EFFORT selection hint, not an enforced budget: how aggressively to prune, as the
fraction (0.0..=1.0) of the prunable pool’s own estimated token cost to keep when lossy
is set. It parameterizes transforms::json_prune’s selection walk and is deliberately
never re-checked against the final serialized document — the achieved whole-document ratio
will differ, since the pool excludes preserved arrays, all non-array content, and items
cheaper than the $tf_ref marker that would replace them, and since
pipeline::apply_lossy_reduction discards a whole prune that fails to beat the lossless
pipeline. target_tokens is the enforced ceiling; this is not. Ignored when lossy is
None.
lossy_preserve: Vec<String>Dot-separated paths (see transforms::json_prune::LossyOptions::preserve_paths) whose
arrays must never be pruned. Ignored when lossy is None.
Implementations§
Source§impl CompressionPolicy
impl CompressionPolicy
pub fn builder() -> CompressionPolicyBuilder
Sourcepub fn validate(&self) -> Result<(), TokenFoldError>
pub fn validate(&self) -> Result<(), TokenFoldError>
Re-checks the same invariants CompressionPolicyBuilder::build enforces, against the
concrete built struct rather than the builder’s Option fields. Every field here is
pub, so a caller can construct or mutate a CompressionPolicy directly without ever
going through the builder – pipeline::compress_with_estimator calls this on every
policy it receives so a hand-built policy can’t silently skip the same fail-closed
guarantees a builder-built one gets for free.
Trait Implementations§
Source§impl Clone for CompressionPolicy
impl Clone for CompressionPolicy
Source§fn clone(&self) -> CompressionPolicy
fn clone(&self) -> CompressionPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more