Files
ternfs-XTXMarkets/cpp/shard/ShardDBData.cpp
Francesco Mazzoli 110705db8d EggsFS -> TernFS rename
Things not done because probably disruptive:

* kmod filesystem string
* sysctl/debugfs/trace
* metrics names
* xmon instance names

Some of these might be renamed too, but starting with a relatively
safe set.
2025-09-03 09:29:53 +01:00

40 lines
1.1 KiB
C++

#include "ShardDBData.hpp"
#include <xxhash.h>
std::ostream& operator<<(std::ostream& out, SpanState state) {
switch (state) {
case SpanState::CLEAN:
out << "CLEAN";
break;
case SpanState::DIRTY:
out << "DIRTY";
break;
case SpanState::CONDEMNED:
out << "CONDEMNED";
break;
default:
out << "SpanState(" << ((int)state) << ")";
break;
}
return out;
}
std::ostream& operator<<(std::ostream& out, const EdgeKey& edgeKey) {
out << "EdgeKey(dirId=" << edgeKey.dirId() << ", current=" << (int)edgeKey.current() << ", nameHash=" << edgeKey.nameHash() << ", name=" << edgeKey.name();
if (!edgeKey.current()) {
out << ", creationTime=" << edgeKey.creationTime();
}
out << ")";
return out;
}
uint64_t EdgeKey::computeNameHash(HashMode mode, const BincodeBytesRef& bytes) {
switch (mode) {
case HashMode::XXH3_63:
return XXH3_64bits(bytes.data(), bytes.size()) & ~(1ull<<63);
default:
throw TERN_EXCEPTION("bad hash mode %s", (int)mode);
}
}