Files
SweepStore/cpp/src/Public/sweepstore/concurrency.h

35 lines
805 B
C++

#pragma once
#include <cstdint>
#include <functional>
#include <string>
#include <thread>
#include <memory>
#include "sweepstore/utils/timing.h"
#define STALE_HEARTBEAT_THRESHOLD_MS 5000
enum SweepstoreTicketOperation : int;
class SweepstoreFileHandle;
namespace SweepstoreConcurrency {
void spawnTicket(SweepstoreFileHandle* file,
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) {
SWEEPSTORE_TIME_FUNCTION();
std::thread([filePath]() {
initialiseMaster(filePath);
}).detach();
}
}