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

Method sanityCheckOpenCount

lib/notebox.go:1274–1292  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1272}
1273
1274func (openfile *OpenNotefile) sanityCheckOpenCount() {
1275 count := atomic.LoadInt32(&openfile.openCount)
1276
1277 // Handle the dummy OpenNotefile instance that has nil notefile
1278 // This happens when a notebox was purged while we still hold a reference
1279 notefileID := "(unknown)"
1280 if openfile.notefile != nil {
1281 notefileID = openfile.notefile.notefileID
1282 }
1283
1284 if notefileID == "" {
1285 notefileID = "notebox " + openfile.storage
1286 }
1287 if count < 0 {
1288 logError(context.Background(), "openCount for %s is negative: %d", notefileID, count)
1289 } else if debugBox && count > 1000 {
1290 logWarn(context.Background(), "openCount for %s is unusually high: %d", notefileID, count)
1291 }
1292}
1293
1294// DeleteNotefile deletes a closed Notefile, and releases its storage.
1295func (box *Notebox) DeleteNotefile(ctx context.Context, notefileID string) (err error) {

Callers 3

CloseMethod · 0.95
checkpointMethod · 0.80
CloseMethod · 0.80

Calls 2

logErrorFunction · 0.85
logWarnFunction · 0.85

Tested by

no test coverage detected