pub struct Orbitals { /* private fields */ }Expand description
The fleet’s table of shared values. Cheap to clone.
Implementations§
Source§impl Orbitals
impl Orbitals
Sourcepub fn new(fleet: Arc<Fleet>) -> Result<Self>
pub fn new(fleet: Arc<Fleet>) -> Result<Self>
Attach to the fleet’s table, creating it when this is the first process to ask. An in-memory fleet gets a table on the heap, shared by everything that holds the same fleet.
Sourcepub fn allocate<T: Primitive>(&self, initial: T) -> Result<Orbital<T>>
pub fn allocate<T: Primitive>(&self, initial: T) -> Result<Orbital<T>>
Declare a value holding initial. The id inside the handle is what
other processes open.
The slot is not given back until the table is reset, so the
capacity counts declarations, not live values: declare a value once
and keep it, as a static, rather than one per request.
Sourcepub fn open<T: Primitive>(&self, id: OrbitalId) -> Result<Orbital<T>>
pub fn open<T: Primitive>(&self, id: OrbitalId) -> Result<Orbital<T>>
A handle to the value id names. An id of another type is
Error::KindMismatch; an id this table did not mint, or minted
before its last reset, is Error::Stale.
Sourcepub fn reset_all(&self) -> Result<()>
pub fn reset_all(&self) -> Result<()>
Empty the table and start a new epoch, after which every earlier id is stale.
For the table’s owner, at a boot where no other process is attached and no handle is in use. A handle kept across a reset still points at its slot, which the next allocation may hand to someone else.