Add concurrency handling implementation with ticket management and file locking
This commit is contained in:
30
cpp/src/Public/sweepstore/concurrency.h
Normal file
30
cpp/src/Public/sweepstore/concurrency.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <thread>
|
||||
|
||||
#define STALE_HEARTBEAT_THRESHOLD_MS 5000
|
||||
|
||||
enum SweepstoreTicketOperation : int;
|
||||
|
||||
namespace SweepstoreConcurrency {
|
||||
|
||||
void spawnTicket(std::string filePath,
|
||||
const SweepstoreTicketOperation& operation,
|
||||
const uint32_t keyHash,
|
||||
const uint32_t targetSize,
|
||||
const std::function<void()> onApproved,
|
||||
std::string debugLabel = ""
|
||||
);
|
||||
|
||||
void initialiseMaster(std::string filePath);
|
||||
|
||||
inline void initialiseMasterAsync(std::string filePath) {
|
||||
std::thread([&filePath]() {
|
||||
initialiseMaster(filePath);
|
||||
}).detach();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user