MCPcopy
hub / github.com/opencloud-eu/opencloud / fixSpaceID

Function fixSpaceID

opencloud/pkg/command/posixfs.go:371–397  ·  view source on GitHub ↗
(spacePath string, obsoleteIDs []string, targetID string, entries []EntryInfo)

Source from the content-addressed store, hash-verified

369}
370
371func fixSpaceID(spacePath string, obsoleteIDs []string, targetID string, entries []EntryInfo) {
372 // Set all parentid attributes to the proper space ID
373 err := setAllParentIDAttributes(entries, targetID)
374 if err != nil {
375 logFailure("an error occurred during file attribute update: %v", err)
376 return
377 }
378
379 // Update space ID itself
380 fmt.Printf(" Updating directory '%s' with attribute '%s' -> %s\n", filepath.Base(spacePath), idAttrName, targetID)
381 err = xattr.Set(spacePath, idAttrName, []byte(targetID))
382 if err != nil {
383 logFailure("Failed to set attribute on directory '%s': %v", spacePath, err)
384 return
385 }
386 err = xattr.Set(spacePath, spaceIDAttrName, []byte(targetID))
387 if err != nil {
388 logFailure("Failed to set attribute on directory '%s': %v", spacePath, err)
389 return
390 }
391
392 // update the index
393 err = updateOwnerIndexFile(spacePath, obsoleteIDs)
394 if err != nil {
395 logFailure("Could not update the owner index file: %v", err)
396 }
397}
398
399func gatherAttributes(path string) ([]EntryInfo, map[string]struct{}, EntryInfo, error) {
400 dirEntries, err := os.ReadDir(path)

Callers 1

checkSpaceIDFunction · 0.85

Calls 4

setAllParentIDAttributesFunction · 0.85
logFailureFunction · 0.85
updateOwnerIndexFileFunction · 0.85
SetMethod · 0.80

Tested by

no test coverage detected