Files
spark/src/lib/md/MemorySegmentUtils.cpp
T
John Colvin 7e5c1218a3 build: Make app-data, shared mem paths configurable via CMake
This allows sparkd and the api server to run simultaneously in the same
docker, w/ independent data (on disk)
2023-03-20 13:26:43 -04:00

50 lines
1.2 KiB
C++

#ifndef NO_CPP0X
#include "MemorySegmentUtils.h"
#include "lib/config/config.h"
#include "lib/config/protos/market_data.pb.h"
using namespace std;
#ifndef SHARED_MEMORY_PREFIX
#define SHARED_MEMORY_PREFIX "sparkd"
#endif
namespace bts {
namespace md {
bool enable_depth(const string &, SecurityType) {
return true;
// return type == api::SECURITYTYPE_FUTURE || type ==
// api::SECURITYTYPE_SPREAD || type == api::SECURITYTYPE_SYNTHETIC;
}
string segment_name(
const string &symbol,
SecurityType type,
Venue exchange,
Platform platform) {
return std::string{SHARED_MEMORY_PREFIX} + "_" +
config::get<md::PublisherNamespace>().shared_memory_namespace() +
"_" + symbol + "_" + api::SecurityType_Name(type) + "_" +
Venue_Name(exchange) + "_" + Platform_Name(platform);
}
std::string hot_segment_name(
const std::string &symbol,
SecurityType type,
Venue exchange,
Platform platform) {
return segment_name(symbol, type, exchange, platform) + "_hot";
}
std::string cold_segment_name(
const std::string &symbol,
SecurityType type,
Venue exchange,
Platform platform) {
return segment_name(symbol, type, exchange, platform) + "_cold";
}
} // namespace md
} // namespace bts
#endif