#[non_exhaustive]pub enum VirtualValue {
Materialized {
value: Value,
schema: Schema,
},
Cached {
key: CacheKey,
schema: Schema,
},
Deferred {
producer_node_id: String,
cache_key: CacheKey,
schema: Schema,
},
Stream {
source_id: String,
schema: Schema,
},
}Expand description
A lazy reference to a value that can be materialized on demand.
This is the core of Soma’s data virtualization. Instead of computing and storing every intermediate result, values are represented as references that carry enough information to:
- Inspect schema without loading data
- Check whether the data is already available
- Compute it when needed
Like Denodo’s data virtualization, but for computation rather than SQL.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Materialized
Already computed and in memory. Ready to use.
Cached
Stored in cache (K/V store). Can be loaded on demand.
Deferred
Not computed yet. Carries the “recipe” to produce it: which node produces it, and what its cache key would be.
Stream
A stream that materializes chunk by chunk.
Implementations§
Source§impl VirtualValue
impl VirtualValue
Sourcepub fn materialized(value: Value) -> Self
pub fn materialized(value: Value) -> Self
Create a materialized value with auto-inferred schema.
Sourcepub fn materialized_with_schema(value: Value, schema: Schema) -> Self
pub fn materialized_with_schema(value: Value, schema: Schema) -> Self
Create a materialized value with explicit schema.
Sourcepub fn deferred(
producer_node_id: impl Into<String>,
cache_key: CacheKey,
schema: Schema,
) -> Self
pub fn deferred( producer_node_id: impl Into<String>, cache_key: CacheKey, schema: Schema, ) -> Self
Create a deferred (not yet computed) reference.
Sourcepub fn status(&self) -> ValueStatus
pub fn status(&self) -> ValueStatus
Get the current status.
Sourcepub fn cache_key(&self) -> Option<&CacheKey>
pub fn cache_key(&self) -> Option<&CacheKey>
Get the cache key (if this value is cached or deferred).
Sourcepub fn try_load(&self, cache: &dyn CacheStore) -> Result<Option<Value>>
pub fn try_load(&self, cache: &dyn CacheStore) -> Result<Option<Value>>
Materialize from a cache store. Returns the value if found, None if not cached.
Sourcepub fn resolve(&self, cache: &dyn CacheStore) -> Result<Self>
pub fn resolve(&self, cache: &dyn CacheStore) -> Result<Self>
Upgrade this reference: if Deferred, check cache; if Cached, load. Returns a new VirtualValue that may be closer to Materialized.
Trait Implementations§
Source§impl Clone for VirtualValue
impl Clone for VirtualValue
Source§fn clone(&self) -> VirtualValue
fn clone(&self) -> VirtualValue
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more