Interface ISessionStorage
Holds the actual value bound at each address in a session's memory space, as either a typed
IBindingHandle or, for the handful of MS-VBAL constructs that operate on raw storage
(LSet between two UDT variables; MS-VBAL only ever allows this and the already-value-level
fixed-length String form), a plain byte buffer. An address is one kind or the other, never
both.
public interface ISessionStorage
Remarks
ISessionMemoryAllocator deliberately does not cover this: it only accounts for allocation size and fragmentation, never values. An ISessionStorage depends on one to reserve address space, then binds the caller's value at the resulting address.
Methods
TryAllocate(int, IBindingHandle, out MemoryAddress)
Reserves size bytes through the underlying ISessionMemoryAllocator
and binds handle at the resulting address.
bool TryAllocate(int size, IBindingHandle handle, out MemoryAddress address)
Parameters
sizeinthandleIBindingHandleaddressMemoryAddress
Returns
- bool
falseif the underlying memory space is exhausted.
TryAllocateBytes(int, out MemoryAddress)
Reserves size bytes through the underlying ISessionMemoryAllocator
as a raw byte buffer, zero-initialized, at the resulting address.
bool TryAllocateBytes(int size, out MemoryAddress address)
Parameters
sizeintaddressMemoryAddress
Returns
- bool
falseif the underlying memory space is exhausted.
TryDeallocate(MemoryAddress)
Frees the binding and the underlying storage at address.
bool TryDeallocate(MemoryAddress address)
Parameters
addressMemoryAddress
Returns
- bool
trueif a binding existed ataddressand was released.
TryRead(MemoryAddress, out IBindingHandle?)
Gets the IBindingHandle bound at address.
bool TryRead(MemoryAddress address, out IBindingHandle? handle)
Parameters
addressMemoryAddresshandleIBindingHandle
Returns
TryReadBytes(MemoryAddress, out byte[]?)
Gets a copy of the byte buffer at address.
bool TryReadBytes(MemoryAddress address, out byte[]? bytes)
Parameters
addressMemoryAddressbytesbyte[]
Returns
- bool
falseifaddressis not a byte-backed allocation.
TryRebind(MemoryAddress, IBindingHandle)
Replaces the IBindingHandle currently bound at address, e.g. to
let a location-identified value (a UDT, an array) bind itself to the very address that was just
reserved for it.
bool TryRebind(MemoryAddress address, IBindingHandle handle)
Parameters
addressMemoryAddresshandleIBindingHandle
Returns
- bool
trueifaddresswas already allocated and its binding was replaced.
TryWriteBytes(MemoryAddress, ReadOnlySpan<byte>)
Replaces the byte buffer at address with a copy of bytes.
The new buffer's length need not match the original allocation's.
bool TryWriteBytes(MemoryAddress address, ReadOnlySpan<byte> bytes)
Parameters
addressMemoryAddressbytesReadOnlySpan<byte>
Returns
- bool
falseifaddressis not a byte-backed allocation.