pub struct LogicalWorkspace { /* private fields */ }Expand description
A logical workspace — the unit of identity for cross-repo / workspace indexing.
Implementations§
Source§impl LogicalWorkspace
impl LogicalWorkspace
Sourcepub fn from_sqry_workspace(path: &Path) -> Result<Self, LogicalWorkspaceError>
pub fn from_sqry_workspace(path: &Path) -> Result<Self, LogicalWorkspaceError>
Construct from a .sqry-workspace registry file.
WorkspaceRegistry::load accepts both v1 (flat repositories
list) and v2 (source_roots, member_folders, exclusions,
project_root_mode) on-disk shapes — v1 is auto-upgraded to v2
in memory. This constructor projects every v2 field into the
resulting LogicalWorkspace:
repositories→source_roots(canonicalized).member_folders→MemberFolder { path, reason }(canonicalized).exclusions→ canonical absolute paths.project_root_mode→ carried verbatim.
STEP_7 codex iter4 fix — pre-iter4 this constructor dropped
member_folders, exclusions, and project_root_mode on the
floor, defeating acceptance criteria 5/6 end-to-end (the redactor
receives an empty LogicalWorkspaceView::exclusions /
member_folders, so redact_excluded_in_passthrough and the
member-folder prefix renderer never fire on real
.sqry-workspace-loaded sessions). The pre-iter4 inline TODO
pointed at “STEP_2 will overhaul the registry layer entirely” —
STEP_2 shipped the registry-side v2 schema but did not update this
projection. Fixed here so STEP_7’s MCP redaction wiring is
observable end-to-end.
§Errors
Returns LogicalWorkspaceError when the registry file cannot be
loaded or any path canonicalization fails irrecoverably.
Sourcepub fn from_code_workspace(
workspace_file: &Path,
heuristic_fn: &dyn Fn(&Path) -> HeuristicVerdict,
) -> Result<Self, LogicalWorkspaceError>
pub fn from_code_workspace( workspace_file: &Path, heuristic_fn: &dyn Fn(&Path) -> HeuristicVerdict, ) -> Result<Self, LogicalWorkspaceError>
Construct from a .code-workspace JSON file.
The heuristic_fn is invoked for every folder that does not carry
an explicit sqry.role, is not in the top-level
sqry.workspace.sourceRoots / .exclusions overrides, and is not
already classified as a member by an explicit
sqry.workspace.memberFolders entry.
§Errors
Returns LogicalWorkspaceError for IO failures, JSON parse
errors, malformed folder entries, or path canonicalization
failures that cannot be recovered via lexical absolutization.
Sourcepub fn anonymous_multi_root(
folders: Vec<PathBuf>,
) -> Result<Self, LogicalWorkspaceError>
pub fn anonymous_multi_root( folders: Vec<PathBuf>, ) -> Result<Self, LogicalWorkspaceError>
Construct an ad-hoc multi-root workspace (every folder is a source root). Folders are sorted lexically before hashing so identity is stable under reorder.
§Errors
Returns LogicalWorkspaceError if any folder cannot be
canonicalized irrecoverably.
Sourcepub fn single_root(path: PathBuf) -> Result<Self, LogicalWorkspaceError>
pub fn single_root(path: PathBuf) -> Result<Self, LogicalWorkspaceError>
Construct a single-root workspace (one source root, no members).
§Errors
Returns LogicalWorkspaceError if path cannot be canonicalized
irrecoverably.
Sourcepub fn workspace_id(&self) -> &WorkspaceId
pub fn workspace_id(&self) -> &WorkspaceId
The stable BLAKE3-256 identity of this workspace.
Sourcepub fn identity(&self) -> &WorkspaceIdentity
pub fn identity(&self) -> &WorkspaceIdentity
The identity inputs that produced Self::workspace_id.
Sourcepub fn source_roots(&self) -> &[SourceRoot]
pub fn source_roots(&self) -> &[SourceRoot]
The auto-indexed source roots.
Sourcepub fn member_folders(&self) -> &[MemberFolder]
pub fn member_folders(&self) -> &[MemberFolder]
The non-indexed member folders.
Sourcepub fn exclusions(&self) -> &[PathBuf]
pub fn exclusions(&self) -> &[PathBuf]
Explicitly excluded paths.
Sourcepub fn project_root_mode(&self) -> ProjectRootMode
pub fn project_root_mode(&self) -> ProjectRootMode
The workspace-level ProjectRootMode.
Sourcepub fn index_root_override(&self) -> Option<&Path>
pub fn index_root_override(&self) -> Option<&Path>
Optional --index-root override.
Sourcepub fn config_fingerprint(&self) -> u64
pub fn config_fingerprint(&self) -> u64
Workspace-level config fingerprint. Populated by the
plugin-selection / cost-tier pipeline via
Self::set_config_fingerprint and consumed by
sqry-daemon::WorkspaceKey so two source roots sharing path
but differing fingerprint stay in distinct cache entries.
Sourcepub fn set_config_fingerprint(&mut self, fingerprint: u64)
pub fn set_config_fingerprint(&mut self, fingerprint: u64)
STEP_11_4 — set the workspace-level config fingerprint computed
via crate::config::compute_workspace_config_fingerprint.
The fingerprint is not part of the WorkspaceId hash
input — it is a separate cache dimension consumed by the
daemon’s WorkspaceKey. Two LogicalWorkspaces with the
same identity but different fingerprints share an identity but
produce distinct daemon cache entries.
Sourcepub fn set_config_fingerprint_with_inheritance(&mut self, fingerprint: u64)
pub fn set_config_fingerprint_with_inheritance(&mut self, fingerprint: u64)
STEP_11_4 — set the workspace-level config fingerprint and
propagate it to every SourceRoot that does not already
carry an explicit per-root override (i.e. whose
config_fingerprint == 0).
This is the typical wiring point: callers compute one
workspace-level fingerprint, then call
set_config_fingerprint_with_inheritance so source roots
without an explicit override inherit the workspace value.
Source roots that carry a non-zero override are left
untouched.
Sourcepub fn populate_classpath_dirs(&mut self) -> Vec<(PathBuf, Error)>
pub fn populate_classpath_dirs(&mut self) -> Vec<(PathBuf, Error)>
STEP_11_4 — populate every SourceRoot::classpath_dir in this
workspace by probing <root>/.sqry/classpath/ for each. Returns
a vector of (source_root, io::Error) pairs for any probe that
failed for a reason other than NotFound; callers typically
fold these into super::cache::WorkspaceWarning::ClasspathProbeFailed.
Sourcepub fn is_source_root(&self, path: &Path) -> bool
pub fn is_source_root(&self, path: &Path) -> bool
Returns true if path matches one of the registered source
roots exactly (not a descendant).
Sourcepub fn classify(&self, path: &Path) -> Classification
pub fn classify(&self, path: &Path) -> Classification
Classify a path against the workspace per §1.4 of the implementation plan.
Trait Implementations§
Source§impl Clone for LogicalWorkspace
impl Clone for LogicalWorkspace
Source§fn clone(&self) -> LogicalWorkspace
fn clone(&self) -> LogicalWorkspace
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LogicalWorkspace
impl Debug for LogicalWorkspace
Source§impl<'de> Deserialize<'de> for LogicalWorkspace
impl<'de> Deserialize<'de> for LogicalWorkspace
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for LogicalWorkspace
impl PartialEq for LogicalWorkspace
Source§fn eq(&self, other: &LogicalWorkspace) -> bool
fn eq(&self, other: &LogicalWorkspace) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for LogicalWorkspace
impl Serialize for LogicalWorkspace
impl Eq for LogicalWorkspace
impl StructuralPartialEq for LogicalWorkspace
Auto Trait Implementations§
impl Freeze for LogicalWorkspace
impl RefUnwindSafe for LogicalWorkspace
impl Send for LogicalWorkspace
impl Sync for LogicalWorkspace
impl Unpin for LogicalWorkspace
impl UnsafeUnpin for LogicalWorkspace
impl UnwindSafe for LogicalWorkspace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read more