pub struct VirtualVariableFile { /* private fields */ }Expand description
Virtual representation of a service’s variable file
This abstraction allows both local memory-mapped files and remote WSS-synced files to be accessed through a unified interface. The file maintains:
- Current variable data in memory
- Metadata about variable locations and sizes
- A shadow copy for change detection
- Per-variable change tracking
Implementations§
Source§impl VirtualVariableFile
impl VirtualVariableFile
Sourcepub fn new(service_id: String, service_name: String, tenant_id: String) -> Self
pub fn new(service_id: String, service_name: String, tenant_id: String) -> Self
Create a new virtual variable file
Sourcepub fn service_id(&self) -> &str
pub fn service_id(&self) -> &str
Get service ID
Sourcepub fn service_name(&self) -> &str
pub fn service_name(&self) -> &str
Get service name
Sourcepub async fn register_variable(&self, metadata: VariableMetadata) -> Result<()>
pub async fn register_variable(&self, metadata: VariableMetadata) -> Result<()>
Register a variable
Sourcepub async fn get_variable_metadata(
&self,
name: &str,
) -> Result<VariableMetadata>
pub async fn get_variable_metadata( &self, name: &str, ) -> Result<VariableMetadata>
Get variable metadata by name
Sourcepub async fn list_variables(&self) -> Result<Vec<VariableMetadata>>
pub async fn list_variables(&self) -> Result<Vec<VariableMetadata>>
List all variables
Sourcepub async fn read_variable_slice(&self, name: &str) -> Result<Vec<u8>>
pub async fn read_variable_slice(&self, name: &str) -> Result<Vec<u8>>
Read a variable as zero-copy slice
Sourcepub async fn shadow_bytes(&self) -> Vec<u8> ⓘ
pub async fn shadow_bytes(&self) -> Vec<u8> ⓘ
Get shadow copy
Sourcepub async fn get_changed_variables(&self) -> Vec<String>
pub async fn get_changed_variables(&self) -> Vec<String>
Get list of changed variables since last sync
Sourcepub async fn clear_changes(&self)
pub async fn clear_changes(&self)
Clear change tracking
Sourcepub async fn mark_variables_changed(&self, names: Vec<String>)
pub async fn mark_variables_changed(&self, names: Vec<String>)
Mark specific variables as changed
Sourcepub async fn compare_ranges(
current: &[u8],
shadow: &[u8],
) -> Result<Vec<(u64, u64)>>
pub async fn compare_ranges( current: &[u8], shadow: &[u8], ) -> Result<Vec<(u64, u64)>>
Compare two byte ranges using wide SIMD operations
Returns byte offsets where differences were found
Sourcepub async fn find_changed_variables_from_diff(
&self,
diff_ranges: &[(u64, u64)],
) -> Result<Vec<String>>
pub async fn find_changed_variables_from_diff( &self, diff_ranges: &[(u64, u64)], ) -> Result<Vec<String>>
Find which variables changed based on byte differences
Sourcepub async fn sync_shadow(&self) -> Result<()>
pub async fn sync_shadow(&self) -> Result<()>
Sync shadow with current (after sending updates to server)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VirtualVariableFile
impl !RefUnwindSafe for VirtualVariableFile
impl Send for VirtualVariableFile
impl Sync for VirtualVariableFile
impl Unpin for VirtualVariableFile
impl UnsafeUnpin for VirtualVariableFile
impl !UnwindSafe for VirtualVariableFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more