}
}
-// This looks for an old (per-thread) snapshot. The first one it finds,
-// it restores from that. Then immediately snapshots with the current thread id,// before removing the old snapshot
-// In this way, we can have per-thread SBFs, but still snapshot and restore.
-// The mutex has to be static because we can't have multiple (i.e. per-thread)
-// instances iterating and writing to the cache dir at the same time
+// This looks for the newest (per-thread) snapshot it can find and it restores from that. Then
+// immediately snapshots with the current thread id, before removing the old snapshot.
+// In this way, we can have per-thread SBFs, but still snapshot and restore. The mutex has to be
+// static because we can't have multiple (i.e. per-thread) instances iterating and writing to the
+// cache dir at the same time
bool PersistentSBF::init(bool ignore_pid)
{
auto log = g_slog->withName("nod");
bool snapshotCurrent(std::thread::id tid); // Write the current file out to disk
void add(const std::string& data)
{
- // The only time this should block is when snapshotting
d_sbf.lock()->add(data);
}
bool test(const std::string& data) { return d_sbf.lock()->test(data); }
bool testAndAdd(const std::string& data)
{
- // The only time this should block is when snapshotting
return d_sbf.lock()->testAndAdd(data);
}