()
| 1272 | } |
| 1273 | |
| 1274 | func (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. |
| 1295 | func (box *Notebox) DeleteNotefile(ctx context.Context, notefileID string) (err error) { |
no test coverage detected