Skip to main content

SharedOpenFileChannel

Trait SharedOpenFileChannel 

Source
pub trait SharedOpenFileChannel: Send + Sync {
    // Required methods
    fn promote(&self, model: &OpenFileModel) -> Result<(), SharedOpenFileError>;
    fn take(&self, id: OpenFileId) -> Result<OpenFileLease, SharedOpenFileError>;
    fn publish(&self, lease: OpenFileLease) -> Result<(), SharedOpenFileError>;
}
Expand description

Synchronous access to the canonical models of shared open file descriptions.

A DetFd method on a shared handle calls take, runs its synchronous body on the model, and calls publish, all while it holds the handle’s local lock and without awaiting. So a lease never outlives one method call. Detcore names no backend here: the backend that runs Detcore inside each guest process installs an implementation with install_shared_open_file_channel.

Required Methods§

Source

fn promote(&self, model: &OpenFileModel) -> Result<(), SharedOpenFileError>

Publishes the initial local model. A duplicate identity is refused. The caller exposes shared handles only after this succeeds.

Source

fn take(&self, id: OpenFileId) -> Result<OpenFileLease, SharedOpenFileError>

Takes the canonical model of id and starts a lease on it.

Source

fn publish(&self, lease: OpenFileLease) -> Result<(), SharedOpenFileError>

Stores lease.model as the canonical model of lease.id and ends the lease. A publish that does not name the current lease is refused.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§