bloc- Binary Large Objects with Concurrency

Portabilitynon-portable (requires POSIX)
Safe HaskellNone



This module contains methods related to the garbage collection of the deleted blobs.



startGC :: BlobStore -> IO () Source

Initialize garbage collection for blobs in a given BlobStore.

startGC throws an error if another GC is already running on the same BlobStore.

markAsAccessible :: BlobId -> IO () Source

Mark a blob as accessible during a GC.

You have to ensure that all the blobs which are accessible are marked by markAsAccessible before calling endGC.

Blobs which are created after startGC had finished need not be marked.

endGC :: BlobStore -> IO () Source

Stops the garbage collection.

This will delete all the blobs which have not been marked by markAsAccessible and created before startGC had finished.

markAccessibleBlobs :: BlobStore -> [BlobId] -> IO () Source

markAccessibleBlobs takes a list of BlobId which are still accessible. markAccessibleBlobs deletes the remaining blobs.

It is safer to use this method instead of using startGC and endGC, since if you forget to mark all the accessible blobs using markAsAccessible, endGC might end up deleting accessible blobs.