Function brane_cli::run::initialize_instance

source ·
pub async fn initialize_instance<O: Write, E: Write>(
    stdout_writer: O,
    stderr_writer: E,
    drv_endpoint: impl AsRef<str>,
    pindex: Arc<Mutex<PackageIndex>>,
    dindex: Arc<Mutex<DataIndex>>,
    user: Option<String>,
    attach: Option<AppId>,
    options: ParserOptions,
) -> Result<InstanceVmState<O, E>, Error>
Expand description

Initializes the state for an instance VM.

This implements most of initialize_instance_vm(), which we separate to have some clients (*cough* IDE *cough*) able to create a VM while sharing an index.

§Arguments

  • stdout_writer: Some Write-handle that we use to write stdout to.
  • stderr_writer: Some Write-handle that we use to write stderr to.
  • drv_endpoint: The brane-drv endpoint that we will connect to to run stuff.
  • pindex: The PackageIndex that contains the remote’s available packages.
  • dindex: The DataIndex that contains the remote’s available datasets.
  • user: Some (tentative) identifier of the user who might receive the end result.
  • attach: If given, we will try to attach to a session with that ID. Otherwise, we start a new session.
  • options: The ParserOptions that describe how to parse the given source.

§Returns

A new InstanceVmState that represents the initialized VM.

§Errors

This function may error if we failed to reach the remote driver, or if the given session did not exist.