pub struct LeanWorkerSessionKey { /* private fields */ }Expand description
Worker reuse key for a capability-backed session.
A session key answers only one pool question: can an already-open child session safely host compatible work? The key includes both the capability project root and the import workspace root because one open session has one fixed Lean search path. It is not a downstream cache key, and it does not encode row schemas, cache validity, ranking, reporting, or source provenance.
Implementations§
Source§impl LeanWorkerSessionKey
impl LeanWorkerSessionKey
Sourcepub fn new(
project_root: impl Into<PathBuf>,
package: impl Into<String>,
lib_name: impl Into<String>,
imports: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn new( project_root: impl Into<PathBuf>, package: impl Into<String>, lib_name: impl Into<String>, imports: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a session key from the caller-visible capability requirements.
project_root is the capability project root. The import workspace
root defaults to the same value; capability builders with a distinct
target workspace override it internally.
Sourcepub fn metadata_expectation(
self,
export: impl Into<String>,
request: Value,
expected: Option<LeanWorkerCapabilityMetadata>,
) -> Self
pub fn metadata_expectation( self, export: impl Into<String>, request: Value, expected: Option<LeanWorkerCapabilityMetadata>, ) -> Self
Add the metadata expectation used to decide safe session reuse.
expected is downstream metadata transported by the generic metadata
envelope. The pool compares it as opaque facts and does not interpret
command names or semantic versions.
Sourcepub fn restart_policy_class(self, class: LeanWorkerRestartPolicyClass) -> Self
pub fn restart_policy_class(self, class: LeanWorkerRestartPolicyClass) -> Self
Set the coarse restart-policy class for this session key.
Sourcepub fn project_root(&self) -> &Path
pub fn project_root(&self) -> &Path
Return the capability Lake project root for this session key.
Sourcepub fn import_workspace_root(&self) -> &Path
pub fn import_workspace_root(&self) -> &Path
Return the target Lake workspace root whose dependency closure the session imports against.
Sourcepub fn import_profile(&self) -> LeanWorkerSessionImportProfile
pub fn import_profile(&self) -> LeanWorkerSessionImportProfile
Return the import profile required by this session key.
Sourcepub fn toolchain_fingerprint(&self) -> &ToolchainFingerprint
pub fn toolchain_fingerprint(&self) -> &ToolchainFingerprint
Return the build-baked Lean toolchain fingerprint used by this key.
Sourcepub fn policy_class(&self) -> LeanWorkerRestartPolicyClass
pub fn policy_class(&self) -> LeanWorkerRestartPolicyClass
Return the restart-policy class used by this key.
Trait Implementations§
Source§impl Clone for LeanWorkerSessionKey
impl Clone for LeanWorkerSessionKey
Source§fn clone(&self) -> LeanWorkerSessionKey
fn clone(&self) -> LeanWorkerSessionKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more