Skip to main content

Crate engine

Crate engine 

Source
Expand description

The generic state substrate for the Virtual Computing Engine.

This crate implements the Engine layer of the Virtual Computing Engine. It provides generic mechanisms only: object identity, metadata, a filesystem, detached namespaces, generic authorization, and a synchronous event system. It must never know about processes, networking, firewalls, package managers, or any operating system.

The OS layer (not part of this crate) gives these mechanisms meaning.

§Modules

  • core — object identity, object kinds, metadata, virtual time.
  • filesystem — the generic filesystem tree, paths, detached namespaces.
  • security — principals/actors, generic authorization mechanisms.
  • events — the synchronous event system and event bus.
  • io — generic input/output primitives (streams, pipes, and the interactive terminal interface).
  • engine — the Engine facade combining everything.

§Event model

A state mutation commits atomically, then synchronously dispatches its event chain. Listeners observe the completed state and may re-enter the Engine (for example, to derive state). Dispatch never holds the store lock, so listener re-entry is safe.

§Time

The shared timeline is monotonic once seeded: it only ever moves forward (VirtualClock::set asserts this in debug builds). Work that must appear asynchronous (a background job) runs under Engine::suspend_time, which books the virtual time it consumes against that work instead of moving the machine-wide clock backwards.

Re-exports§

pub use crate::core::metadata::Metadata;
pub use crate::core::metadata::MetadataPatch;
pub use crate::core::metadata::MetadataValue;
pub use crate::core::metadata::Name;
pub use crate::core::object::ObjectKind;
pub use crate::core::object_id::Id;
pub use crate::core::object_id::ObjectId;
pub use crate::core::time::Clock;
pub use crate::core::time::HostClock;
pub use crate::core::time::Timestamp;
pub use crate::core::time::VirtualClock;
pub use crate::engine::CreateOptions;
pub use crate::engine::Engine;
pub use crate::error::Error;
pub use crate::events::event::EventData;
pub use crate::events::event::ObjectEvent;
pub use crate::events::event_bus::EventBus;
pub use crate::events::event_type::EventType;
pub use crate::events::subscription::SubscriptionId;
pub use crate::filesystem::detached_namespace::DetachedNamespace;
pub use crate::filesystem::path::VirtualPath;
pub use crate::io::BytesInput;
pub use crate::io::BytesOutput;
pub use crate::io::EmptyInput;
pub use crate::io::Input;
pub use crate::io::InputError;
pub use crate::io::InputMode;
pub use crate::io::Key;
pub use crate::io::KeyEvent;
pub use crate::io::Output;
pub use crate::io::OutputError;
pub use crate::io::Pipe;
pub use crate::io::SinkOutput;
pub use crate::io::Size;
pub use crate::io::StringInput;
pub use crate::io::Terminal;
pub use crate::security::actor::ActorId;
pub use crate::security::authorization::AuthorizationData;
pub use crate::security::authorization::AuthorizationPolicy;
pub use crate::security::authorization::AuthorizationRequest;
pub use crate::security::authorization::AuthorizationResult;
pub use crate::security::authorization::Operation;
pub use crate::security::authorization::ParentReference;
pub use crate::security::authorization::PermissivePolicy;

Modules§

core
Core Engine concepts: identity, object kinds, metadata, virtual time.
engine
The Engine facade.
error
Error types for the Engine.
events
The Engine event system.
filesystem
The generic filesystem.
io
Generic input/output primitives.
security
Generic security mechanisms.