MCPcopy Create free account
hub / github.com/blues/note / deletionForbidden

Function deletionForbidden

lib/file.go:179–189  ·  view source on GitHub ↗

It is quite catastrophic if we attempt to delete the entire file storage root, because for NTN recovery is simply impossible. As such, we treat this like a 'bug check' and forbid the operation.

(ctx context.Context, path string)

Source from the content-addressed store, hash-verified

177// It is quite catastrophic if we attempt to delete the entire file storage root, because for NTN
178// recovery is simply impossible. As such, we treat this like a 'bug check' and forbid the operation.
179func deletionForbidden(ctx context.Context, path string) bool {
180
181 // If the path ends in our default storage extension, this must be a file storage object
182 if !strings.HasSuffix(path, defaultFileStorageName+defaultFileStorageExt) {
183 return false
184 }
185
186 // This should be so incredibly rare that if it does happen we want to see exactly why we are here
187 logError(ctx, "[dbwarn] attempt to delete file storage root via:\n%s", debug.Stack())
188 return true
189}

Callers 3

createMethod · 0.85
createObjectMethod · 0.85
deleteMethod · 0.85

Calls 1

logErrorFunction · 0.85

Tested by

no test coverage detected