Skip to main content

VirtualVariableFile

Struct VirtualVariableFile 

Source
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

Source

pub fn new(service_id: String, service_name: String, tenant_id: String) -> Self

Create a new virtual variable file

Source

pub fn service_id(&self) -> &str

Get service ID

Source

pub fn service_name(&self) -> &str

Get service name

Source

pub fn tenant_id(&self) -> &str

Get tenant ID

Source

pub async fn register_variable(&self, metadata: VariableMetadata) -> Result<()>

Register a variable

Source

pub async fn get_variable_metadata( &self, name: &str, ) -> Result<VariableMetadata>

Get variable metadata by name

Source

pub async fn list_variables(&self) -> Result<Vec<VariableMetadata>>

List all variables

Source

pub async fn read_variable_slice(&self, name: &str) -> Result<Vec<u8>>

Read a variable as zero-copy slice

Source

pub async fn write_variable(&self, name: &str, data: &[u8]) -> Result<()>

Write a variable

Source

pub async fn bytes(&self) -> Vec<u8>

Get raw bytes (zero-copy reference to internal buffer)

Source

pub async fn update_bytes(&self, data: Vec<u8>) -> Result<()>

Update entire file content

Source

pub async fn shadow_bytes(&self) -> Vec<u8>

Get shadow copy

Source

pub async fn update_shadow_bytes(&self, data: Vec<u8>) -> Result<()>

Update shadow copy

Source

pub async fn get_changed_variables(&self) -> Vec<String>

Get list of changed variables since last sync

Source

pub async fn clear_changes(&self)

Clear change tracking

Source

pub async fn mark_variables_changed(&self, names: Vec<String>)

Mark specific variables as changed

Source

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

Source

pub async fn find_changed_variables_from_diff( &self, diff_ranges: &[(u64, u64)], ) -> Result<Vec<String>>

Find which variables changed based on byte differences

Source

pub async fn sync_shadow(&self) -> Result<()>

Sync shadow with current (after sending updates to server)

Trait Implementations§

Source§

impl Debug for VirtualVariableFile

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V