MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / profile_sharded_layout

Function profile_sharded_layout

src/storage.rs:206–239  ·  view source on GitHub ↗
(
    project_root: &Path,
    profile_root: &Path,
    marker: &EnrollmentMarker,
)

Source from the content-addressed store, hash-verified

204}
205
206pub fn profile_sharded_layout(
207 project_root: &Path,
208 profile_root: &Path,
209 marker: &EnrollmentMarker,
210) -> Result<StoreLayout> {
211 if marker.storage_mode != StorageMode::ProfileSharded {
212 return Err(TraceDecayError::Config {
213 message: format!(
214 "enrollment marker for '{}' uses storage_mode={:?}, not profile_sharded",
215 project_root.display(),
216 marker.storage_mode
217 ),
218 });
219 }
220 validate_project_id(&marker.project_id).map_err(|message| TraceDecayError::Config {
221 message: format!(
222 "invalid enrollment marker for '{}': {message}",
223 project_root.display()
224 ),
225 })?;
226 let data_root = profile_sharded_data_root(profile_root, &marker.project_id);
227 Ok(StoreLayout::new(
228 ProjectIdentity {
229 project_id: Some(marker.project_id.clone()),
230 display_root: project_root.to_path_buf(),
231 primary_alias: project_root.to_path_buf(),
232 },
233 StoreKind::CodeProject,
234 StorageMode::ProfileSharded,
235 project_root.to_path_buf(),
236 data_root,
237 Some(STORE_MANIFEST_FILENAME),
238 ))
239}
240
241pub fn resolve_layout(project_root: &Path, profile_root: &Path) -> Result<StoreLayout> {
242 match read_enrollment_marker(project_root)? {

Calls 2

validate_project_idFunction · 0.85