mirror of
https://github.com/XTXMarkets/ternfs.git
synced 2026-01-05 18:40:16 -06:00
Port kmod to new FullReadDir request
This commit is contained in:
@@ -220,6 +220,9 @@ std::ostream& operator<<(std::ostream& out, ShardMessageKind kind) {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
out << "ADD_INLINE_SPAN";
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << "FULL_READ_DIR";
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
out << "STAT_TRANSIENT_FILE";
|
||||
break;
|
||||
@@ -238,9 +241,6 @@ std::ostream& operator<<(std::ostream& out, ShardMessageKind kind) {
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
out << "VISIT_TRANSIENT_FILES";
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << "FULL_READ_DIR";
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
out << "REMOVE_NON_OWNED_EDGE";
|
||||
break;
|
||||
@@ -794,32 +794,6 @@ std::ostream& operator<<(std::ostream& out, const BlacklistEntry& x) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void TransientFile::pack(BincodeBuf& buf) const {
|
||||
id.pack(buf);
|
||||
buf.packFixedBytes<8>(cookie);
|
||||
deadlineTime.pack(buf);
|
||||
}
|
||||
void TransientFile::unpack(BincodeBuf& buf) {
|
||||
id.unpack(buf);
|
||||
buf.unpackFixedBytes<8>(cookie);
|
||||
deadlineTime.unpack(buf);
|
||||
}
|
||||
void TransientFile::clear() {
|
||||
id = InodeId();
|
||||
cookie.clear();
|
||||
deadlineTime = EggsTime();
|
||||
}
|
||||
bool TransientFile::operator==(const TransientFile& rhs) const {
|
||||
if ((InodeId)this->id != (InodeId)rhs.id) { return false; };
|
||||
if (cookie != rhs.cookie) { return false; };
|
||||
if ((EggsTime)this->deadlineTime != (EggsTime)rhs.deadlineTime) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const TransientFile& x) {
|
||||
out << "TransientFile(" << "Id=" << x.id << ", " << "Cookie=" << x.cookie << ", " << "DeadlineTime=" << x.deadlineTime << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void Edge::pack(BincodeBuf& buf) const {
|
||||
buf.packScalar<bool>(current);
|
||||
targetId.pack(buf);
|
||||
@@ -880,6 +854,32 @@ std::ostream& operator<<(std::ostream& out, const FullReadDirCursor& x) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void TransientFile::pack(BincodeBuf& buf) const {
|
||||
id.pack(buf);
|
||||
buf.packFixedBytes<8>(cookie);
|
||||
deadlineTime.pack(buf);
|
||||
}
|
||||
void TransientFile::unpack(BincodeBuf& buf) {
|
||||
id.unpack(buf);
|
||||
buf.unpackFixedBytes<8>(cookie);
|
||||
deadlineTime.unpack(buf);
|
||||
}
|
||||
void TransientFile::clear() {
|
||||
id = InodeId();
|
||||
cookie.clear();
|
||||
deadlineTime = EggsTime();
|
||||
}
|
||||
bool TransientFile::operator==(const TransientFile& rhs) const {
|
||||
if ((InodeId)this->id != (InodeId)rhs.id) { return false; };
|
||||
if (cookie != rhs.cookie) { return false; };
|
||||
if ((EggsTime)this->deadlineTime != (EggsTime)rhs.deadlineTime) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const TransientFile& x) {
|
||||
out << "TransientFile(" << "Id=" << x.id << ", " << "Cookie=" << x.cookie << ", " << "DeadlineTime=" << x.deadlineTime << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void EntryNewBlockInfo::pack(BincodeBuf& buf) const {
|
||||
blockServiceId.pack(buf);
|
||||
crc.pack(buf);
|
||||
@@ -1660,6 +1660,66 @@ std::ostream& operator<<(std::ostream& out, const AddInlineSpanResp& x) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void FullReadDirReq::pack(BincodeBuf& buf) const {
|
||||
dirId.pack(buf);
|
||||
buf.packScalar<uint8_t>(flags);
|
||||
buf.packBytes(startName);
|
||||
startTime.pack(buf);
|
||||
buf.packScalar<uint16_t>(limit);
|
||||
buf.packScalar<uint16_t>(mtu);
|
||||
}
|
||||
void FullReadDirReq::unpack(BincodeBuf& buf) {
|
||||
dirId.unpack(buf);
|
||||
flags = buf.unpackScalar<uint8_t>();
|
||||
buf.unpackBytes(startName);
|
||||
startTime.unpack(buf);
|
||||
limit = buf.unpackScalar<uint16_t>();
|
||||
mtu = buf.unpackScalar<uint16_t>();
|
||||
}
|
||||
void FullReadDirReq::clear() {
|
||||
dirId = InodeId();
|
||||
flags = uint8_t(0);
|
||||
startName.clear();
|
||||
startTime = EggsTime();
|
||||
limit = uint16_t(0);
|
||||
mtu = uint16_t(0);
|
||||
}
|
||||
bool FullReadDirReq::operator==(const FullReadDirReq& rhs) const {
|
||||
if ((InodeId)this->dirId != (InodeId)rhs.dirId) { return false; };
|
||||
if ((uint8_t)this->flags != (uint8_t)rhs.flags) { return false; };
|
||||
if (startName != rhs.startName) { return false; };
|
||||
if ((EggsTime)this->startTime != (EggsTime)rhs.startTime) { return false; };
|
||||
if ((uint16_t)this->limit != (uint16_t)rhs.limit) { return false; };
|
||||
if ((uint16_t)this->mtu != (uint16_t)rhs.mtu) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirReq& x) {
|
||||
out << "FullReadDirReq(" << "DirId=" << x.dirId << ", " << "Flags=" << (int)x.flags << ", " << "StartName=" << GoLangQuotedStringFmt(x.startName.data(), x.startName.size()) << ", " << "StartTime=" << x.startTime << ", " << "Limit=" << x.limit << ", " << "Mtu=" << x.mtu << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void FullReadDirResp::pack(BincodeBuf& buf) const {
|
||||
next.pack(buf);
|
||||
buf.packList<Edge>(results);
|
||||
}
|
||||
void FullReadDirResp::unpack(BincodeBuf& buf) {
|
||||
next.unpack(buf);
|
||||
buf.unpackList<Edge>(results);
|
||||
}
|
||||
void FullReadDirResp::clear() {
|
||||
next.clear();
|
||||
results.clear();
|
||||
}
|
||||
bool FullReadDirResp::operator==(const FullReadDirResp& rhs) const {
|
||||
if (next != rhs.next) { return false; };
|
||||
if (results != rhs.results) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirResp& x) {
|
||||
out << "FullReadDirResp(" << "Next=" << x.next << ", " << "Results=" << x.results << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void StatTransientFileReq::pack(BincodeBuf& buf) const {
|
||||
id.pack(buf);
|
||||
}
|
||||
@@ -1904,66 +1964,6 @@ std::ostream& operator<<(std::ostream& out, const VisitTransientFilesResp& x) {
|
||||
return out;
|
||||
}
|
||||
|
||||
void FullReadDirReq::pack(BincodeBuf& buf) const {
|
||||
dirId.pack(buf);
|
||||
buf.packScalar<uint8_t>(flags);
|
||||
buf.packBytes(startName);
|
||||
startTime.pack(buf);
|
||||
buf.packScalar<uint16_t>(limit);
|
||||
buf.packScalar<uint16_t>(mtu);
|
||||
}
|
||||
void FullReadDirReq::unpack(BincodeBuf& buf) {
|
||||
dirId.unpack(buf);
|
||||
flags = buf.unpackScalar<uint8_t>();
|
||||
buf.unpackBytes(startName);
|
||||
startTime.unpack(buf);
|
||||
limit = buf.unpackScalar<uint16_t>();
|
||||
mtu = buf.unpackScalar<uint16_t>();
|
||||
}
|
||||
void FullReadDirReq::clear() {
|
||||
dirId = InodeId();
|
||||
flags = uint8_t(0);
|
||||
startName.clear();
|
||||
startTime = EggsTime();
|
||||
limit = uint16_t(0);
|
||||
mtu = uint16_t(0);
|
||||
}
|
||||
bool FullReadDirReq::operator==(const FullReadDirReq& rhs) const {
|
||||
if ((InodeId)this->dirId != (InodeId)rhs.dirId) { return false; };
|
||||
if ((uint8_t)this->flags != (uint8_t)rhs.flags) { return false; };
|
||||
if (startName != rhs.startName) { return false; };
|
||||
if ((EggsTime)this->startTime != (EggsTime)rhs.startTime) { return false; };
|
||||
if ((uint16_t)this->limit != (uint16_t)rhs.limit) { return false; };
|
||||
if ((uint16_t)this->mtu != (uint16_t)rhs.mtu) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirReq& x) {
|
||||
out << "FullReadDirReq(" << "DirId=" << x.dirId << ", " << "Flags=" << (int)x.flags << ", " << "StartName=" << GoLangQuotedStringFmt(x.startName.data(), x.startName.size()) << ", " << "StartTime=" << x.startTime << ", " << "Limit=" << x.limit << ", " << "Mtu=" << x.mtu << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void FullReadDirResp::pack(BincodeBuf& buf) const {
|
||||
next.pack(buf);
|
||||
buf.packList<Edge>(results);
|
||||
}
|
||||
void FullReadDirResp::unpack(BincodeBuf& buf) {
|
||||
next.unpack(buf);
|
||||
buf.unpackList<Edge>(results);
|
||||
}
|
||||
void FullReadDirResp::clear() {
|
||||
next.clear();
|
||||
results.clear();
|
||||
}
|
||||
bool FullReadDirResp::operator==(const FullReadDirResp& rhs) const {
|
||||
if (next != rhs.next) { return false; };
|
||||
if (results != rhs.results) { return false; };
|
||||
return true;
|
||||
}
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirResp& x) {
|
||||
out << "FullReadDirResp(" << "Next=" << x.next << ", " << "Results=" << x.results << ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
void RemoveNonOwnedEdgeReq::pack(BincodeBuf& buf) const {
|
||||
dirId.pack(buf);
|
||||
targetId.pack(buf);
|
||||
@@ -3480,72 +3480,72 @@ AddInlineSpanReq& ShardReqContainer::setAddInlineSpan() {
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const FullReadDirReq& ShardReqContainer::getFullReadDir() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::FULL_READ_DIR, "%s != %s", _kind, ShardMessageKind::FULL_READ_DIR);
|
||||
return std::get<12>(_data);
|
||||
}
|
||||
FullReadDirReq& ShardReqContainer::setFullReadDir() {
|
||||
_kind = ShardMessageKind::FULL_READ_DIR;
|
||||
auto& x = std::get<12>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const StatTransientFileReq& ShardReqContainer::getStatTransientFile() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::STAT_TRANSIENT_FILE, "%s != %s", _kind, ShardMessageKind::STAT_TRANSIENT_FILE);
|
||||
return std::get<12>(_data);
|
||||
return std::get<13>(_data);
|
||||
}
|
||||
StatTransientFileReq& ShardReqContainer::setStatTransientFile() {
|
||||
_kind = ShardMessageKind::STAT_TRANSIENT_FILE;
|
||||
auto& x = std::get<12>(_data);
|
||||
auto& x = std::get<13>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const SetDirectoryInfoReq& ShardReqContainer::getSetDirectoryInfo() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::SET_DIRECTORY_INFO, "%s != %s", _kind, ShardMessageKind::SET_DIRECTORY_INFO);
|
||||
return std::get<13>(_data);
|
||||
return std::get<14>(_data);
|
||||
}
|
||||
SetDirectoryInfoReq& ShardReqContainer::setSetDirectoryInfo() {
|
||||
_kind = ShardMessageKind::SET_DIRECTORY_INFO;
|
||||
auto& x = std::get<13>(_data);
|
||||
auto& x = std::get<14>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const ExpireTransientFileReq& ShardReqContainer::getExpireTransientFile() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::EXPIRE_TRANSIENT_FILE, "%s != %s", _kind, ShardMessageKind::EXPIRE_TRANSIENT_FILE);
|
||||
return std::get<14>(_data);
|
||||
return std::get<15>(_data);
|
||||
}
|
||||
ExpireTransientFileReq& ShardReqContainer::setExpireTransientFile() {
|
||||
_kind = ShardMessageKind::EXPIRE_TRANSIENT_FILE;
|
||||
auto& x = std::get<14>(_data);
|
||||
auto& x = std::get<15>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitDirectoriesReq& ShardReqContainer::getVisitDirectories() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_DIRECTORIES, "%s != %s", _kind, ShardMessageKind::VISIT_DIRECTORIES);
|
||||
return std::get<15>(_data);
|
||||
return std::get<16>(_data);
|
||||
}
|
||||
VisitDirectoriesReq& ShardReqContainer::setVisitDirectories() {
|
||||
_kind = ShardMessageKind::VISIT_DIRECTORIES;
|
||||
auto& x = std::get<15>(_data);
|
||||
auto& x = std::get<16>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitFilesReq& ShardReqContainer::getVisitFiles() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_FILES, "%s != %s", _kind, ShardMessageKind::VISIT_FILES);
|
||||
return std::get<16>(_data);
|
||||
return std::get<17>(_data);
|
||||
}
|
||||
VisitFilesReq& ShardReqContainer::setVisitFiles() {
|
||||
_kind = ShardMessageKind::VISIT_FILES;
|
||||
auto& x = std::get<16>(_data);
|
||||
auto& x = std::get<17>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitTransientFilesReq& ShardReqContainer::getVisitTransientFiles() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_TRANSIENT_FILES, "%s != %s", _kind, ShardMessageKind::VISIT_TRANSIENT_FILES);
|
||||
return std::get<17>(_data);
|
||||
return std::get<18>(_data);
|
||||
}
|
||||
VisitTransientFilesReq& ShardReqContainer::setVisitTransientFiles() {
|
||||
_kind = ShardMessageKind::VISIT_TRANSIENT_FILES;
|
||||
auto& x = std::get<17>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const FullReadDirReq& ShardReqContainer::getFullReadDir() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::FULL_READ_DIR, "%s != %s", _kind, ShardMessageKind::FULL_READ_DIR);
|
||||
return std::get<18>(_data);
|
||||
}
|
||||
FullReadDirReq& ShardReqContainer::setFullReadDir() {
|
||||
_kind = ShardMessageKind::FULL_READ_DIR;
|
||||
auto& x = std::get<18>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
@@ -3726,19 +3726,19 @@ size_t ShardReqContainer::packedSize() const {
|
||||
return std::get<10>(_data).packedSize();
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
return std::get<11>(_data).packedSize();
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
return std::get<12>(_data).packedSize();
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
return std::get<13>(_data).packedSize();
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
return std::get<14>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
return std::get<15>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
return std::get<16>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
return std::get<17>(_data).packedSize();
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
return std::get<12>(_data).packedSize();
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
return std::get<13>(_data).packedSize();
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
return std::get<14>(_data).packedSize();
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
return std::get<15>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
return std::get<16>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
return std::get<17>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
return std::get<18>(_data).packedSize();
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
return std::get<19>(_data).packedSize();
|
||||
@@ -3813,25 +3813,25 @@ void ShardReqContainer::pack(BincodeBuf& buf) const {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
std::get<11>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
std::get<12>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
std::get<13>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
std::get<14>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
std::get<15>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
std::get<16>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
std::get<17>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
std::get<18>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
@@ -3923,25 +3923,25 @@ void ShardReqContainer::unpack(BincodeBuf& buf, ShardMessageKind kind) {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
std::get<11>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
std::get<12>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
std::get<13>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
std::get<14>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
std::get<15>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
std::get<16>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
std::get<17>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
std::get<18>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
@@ -4032,6 +4032,9 @@ std::ostream& operator<<(std::ostream& out, const ShardReqContainer& x) {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
out << x.getAddInlineSpan();
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << x.getFullReadDir();
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
out << x.getStatTransientFile();
|
||||
break;
|
||||
@@ -4050,9 +4053,6 @@ std::ostream& operator<<(std::ostream& out, const ShardReqContainer& x) {
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
out << x.getVisitTransientFiles();
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << x.getFullReadDir();
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
out << x.getRemoveNonOwnedEdge();
|
||||
break;
|
||||
@@ -4224,72 +4224,72 @@ AddInlineSpanResp& ShardRespContainer::setAddInlineSpan() {
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const FullReadDirResp& ShardRespContainer::getFullReadDir() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::FULL_READ_DIR, "%s != %s", _kind, ShardMessageKind::FULL_READ_DIR);
|
||||
return std::get<12>(_data);
|
||||
}
|
||||
FullReadDirResp& ShardRespContainer::setFullReadDir() {
|
||||
_kind = ShardMessageKind::FULL_READ_DIR;
|
||||
auto& x = std::get<12>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const StatTransientFileResp& ShardRespContainer::getStatTransientFile() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::STAT_TRANSIENT_FILE, "%s != %s", _kind, ShardMessageKind::STAT_TRANSIENT_FILE);
|
||||
return std::get<12>(_data);
|
||||
return std::get<13>(_data);
|
||||
}
|
||||
StatTransientFileResp& ShardRespContainer::setStatTransientFile() {
|
||||
_kind = ShardMessageKind::STAT_TRANSIENT_FILE;
|
||||
auto& x = std::get<12>(_data);
|
||||
auto& x = std::get<13>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const SetDirectoryInfoResp& ShardRespContainer::getSetDirectoryInfo() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::SET_DIRECTORY_INFO, "%s != %s", _kind, ShardMessageKind::SET_DIRECTORY_INFO);
|
||||
return std::get<13>(_data);
|
||||
return std::get<14>(_data);
|
||||
}
|
||||
SetDirectoryInfoResp& ShardRespContainer::setSetDirectoryInfo() {
|
||||
_kind = ShardMessageKind::SET_DIRECTORY_INFO;
|
||||
auto& x = std::get<13>(_data);
|
||||
auto& x = std::get<14>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const ExpireTransientFileResp& ShardRespContainer::getExpireTransientFile() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::EXPIRE_TRANSIENT_FILE, "%s != %s", _kind, ShardMessageKind::EXPIRE_TRANSIENT_FILE);
|
||||
return std::get<14>(_data);
|
||||
return std::get<15>(_data);
|
||||
}
|
||||
ExpireTransientFileResp& ShardRespContainer::setExpireTransientFile() {
|
||||
_kind = ShardMessageKind::EXPIRE_TRANSIENT_FILE;
|
||||
auto& x = std::get<14>(_data);
|
||||
auto& x = std::get<15>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitDirectoriesResp& ShardRespContainer::getVisitDirectories() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_DIRECTORIES, "%s != %s", _kind, ShardMessageKind::VISIT_DIRECTORIES);
|
||||
return std::get<15>(_data);
|
||||
return std::get<16>(_data);
|
||||
}
|
||||
VisitDirectoriesResp& ShardRespContainer::setVisitDirectories() {
|
||||
_kind = ShardMessageKind::VISIT_DIRECTORIES;
|
||||
auto& x = std::get<15>(_data);
|
||||
auto& x = std::get<16>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitFilesResp& ShardRespContainer::getVisitFiles() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_FILES, "%s != %s", _kind, ShardMessageKind::VISIT_FILES);
|
||||
return std::get<16>(_data);
|
||||
return std::get<17>(_data);
|
||||
}
|
||||
VisitFilesResp& ShardRespContainer::setVisitFiles() {
|
||||
_kind = ShardMessageKind::VISIT_FILES;
|
||||
auto& x = std::get<16>(_data);
|
||||
auto& x = std::get<17>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const VisitTransientFilesResp& ShardRespContainer::getVisitTransientFiles() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::VISIT_TRANSIENT_FILES, "%s != %s", _kind, ShardMessageKind::VISIT_TRANSIENT_FILES);
|
||||
return std::get<17>(_data);
|
||||
return std::get<18>(_data);
|
||||
}
|
||||
VisitTransientFilesResp& ShardRespContainer::setVisitTransientFiles() {
|
||||
_kind = ShardMessageKind::VISIT_TRANSIENT_FILES;
|
||||
auto& x = std::get<17>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
}
|
||||
const FullReadDirResp& ShardRespContainer::getFullReadDir() const {
|
||||
ALWAYS_ASSERT(_kind == ShardMessageKind::FULL_READ_DIR, "%s != %s", _kind, ShardMessageKind::FULL_READ_DIR);
|
||||
return std::get<18>(_data);
|
||||
}
|
||||
FullReadDirResp& ShardRespContainer::setFullReadDir() {
|
||||
_kind = ShardMessageKind::FULL_READ_DIR;
|
||||
auto& x = std::get<18>(_data);
|
||||
x.clear();
|
||||
return x;
|
||||
@@ -4470,19 +4470,19 @@ size_t ShardRespContainer::packedSize() const {
|
||||
return std::get<10>(_data).packedSize();
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
return std::get<11>(_data).packedSize();
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
return std::get<12>(_data).packedSize();
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
return std::get<13>(_data).packedSize();
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
return std::get<14>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
return std::get<15>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
return std::get<16>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
return std::get<17>(_data).packedSize();
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
return std::get<12>(_data).packedSize();
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
return std::get<13>(_data).packedSize();
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
return std::get<14>(_data).packedSize();
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
return std::get<15>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
return std::get<16>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
return std::get<17>(_data).packedSize();
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
return std::get<18>(_data).packedSize();
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
return std::get<19>(_data).packedSize();
|
||||
@@ -4557,25 +4557,25 @@ void ShardRespContainer::pack(BincodeBuf& buf) const {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
std::get<11>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
std::get<12>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
std::get<13>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
std::get<14>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
std::get<15>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
std::get<16>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
std::get<17>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
std::get<18>(_data).pack(buf);
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
@@ -4667,25 +4667,25 @@ void ShardRespContainer::unpack(BincodeBuf& buf, ShardMessageKind kind) {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
std::get<11>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
std::get<12>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
std::get<13>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
case ShardMessageKind::SET_DIRECTORY_INFO:
|
||||
std::get<14>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
case ShardMessageKind::EXPIRE_TRANSIENT_FILE:
|
||||
std::get<15>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
case ShardMessageKind::VISIT_DIRECTORIES:
|
||||
std::get<16>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
case ShardMessageKind::VISIT_FILES:
|
||||
std::get<17>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
std::get<18>(_data).unpack(buf);
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
@@ -4776,6 +4776,9 @@ std::ostream& operator<<(std::ostream& out, const ShardRespContainer& x) {
|
||||
case ShardMessageKind::ADD_INLINE_SPAN:
|
||||
out << x.getAddInlineSpan();
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << x.getFullReadDir();
|
||||
break;
|
||||
case ShardMessageKind::STAT_TRANSIENT_FILE:
|
||||
out << x.getStatTransientFile();
|
||||
break;
|
||||
@@ -4794,9 +4797,6 @@ std::ostream& operator<<(std::ostream& out, const ShardRespContainer& x) {
|
||||
case ShardMessageKind::VISIT_TRANSIENT_FILES:
|
||||
out << x.getVisitTransientFiles();
|
||||
break;
|
||||
case ShardMessageKind::FULL_READ_DIR:
|
||||
out << x.getFullReadDir();
|
||||
break;
|
||||
case ShardMessageKind::REMOVE_NON_OWNED_EDGE:
|
||||
out << x.getRemoveNonOwnedEdge();
|
||||
break;
|
||||
|
||||
@@ -79,13 +79,13 @@ enum class ShardMessageKind : uint8_t {
|
||||
FILE_SPANS = 11,
|
||||
SAME_DIRECTORY_RENAME = 12,
|
||||
ADD_INLINE_SPAN = 16,
|
||||
FULL_READ_DIR = 115,
|
||||
STAT_TRANSIENT_FILE = 3,
|
||||
SET_DIRECTORY_INFO = 13,
|
||||
EXPIRE_TRANSIENT_FILE = 15,
|
||||
VISIT_DIRECTORIES = 112,
|
||||
VISIT_FILES = 113,
|
||||
VISIT_TRANSIENT_FILES = 114,
|
||||
FULL_READ_DIR = 115,
|
||||
REMOVE_NON_OWNED_EDGE = 116,
|
||||
SAME_SHARD_HARD_FILE_UNLINK = 117,
|
||||
REMOVE_SPAN_INITIATE = 118,
|
||||
@@ -619,29 +619,6 @@ struct BlacklistEntry {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const BlacklistEntry& x);
|
||||
|
||||
struct TransientFile {
|
||||
InodeId id;
|
||||
BincodeFixedBytes<8> cookie;
|
||||
EggsTime deadlineTime;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = 8 + BincodeFixedBytes<8>::STATIC_SIZE + 8; // id + cookie + deadlineTime
|
||||
|
||||
TransientFile() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += 8; // id
|
||||
_size += BincodeFixedBytes<8>::STATIC_SIZE; // cookie
|
||||
_size += 8; // deadlineTime
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const TransientFile&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const TransientFile& x);
|
||||
|
||||
struct Edge {
|
||||
bool current;
|
||||
InodeIdExtra targetId;
|
||||
@@ -692,6 +669,29 @@ struct FullReadDirCursor {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirCursor& x);
|
||||
|
||||
struct TransientFile {
|
||||
InodeId id;
|
||||
BincodeFixedBytes<8> cookie;
|
||||
EggsTime deadlineTime;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = 8 + BincodeFixedBytes<8>::STATIC_SIZE + 8; // id + cookie + deadlineTime
|
||||
|
||||
TransientFile() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += 8; // id
|
||||
_size += BincodeFixedBytes<8>::STATIC_SIZE; // cookie
|
||||
_size += 8; // deadlineTime
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const TransientFile&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const TransientFile& x);
|
||||
|
||||
struct EntryNewBlockInfo {
|
||||
BlockServiceId blockServiceId;
|
||||
Crc crc;
|
||||
@@ -1382,6 +1382,56 @@ struct AddInlineSpanResp {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const AddInlineSpanResp& x);
|
||||
|
||||
struct FullReadDirReq {
|
||||
InodeId dirId;
|
||||
uint8_t flags;
|
||||
BincodeBytes startName;
|
||||
EggsTime startTime;
|
||||
uint16_t limit;
|
||||
uint16_t mtu;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = 8 + 1 + BincodeBytes::STATIC_SIZE + 8 + 2 + 2; // dirId + flags + startName + startTime + limit + mtu
|
||||
|
||||
FullReadDirReq() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += 8; // dirId
|
||||
_size += 1; // flags
|
||||
_size += startName.packedSize(); // startName
|
||||
_size += 8; // startTime
|
||||
_size += 2; // limit
|
||||
_size += 2; // mtu
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const FullReadDirReq&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirReq& x);
|
||||
|
||||
struct FullReadDirResp {
|
||||
FullReadDirCursor next;
|
||||
BincodeList<Edge> results;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = FullReadDirCursor::STATIC_SIZE + BincodeList<Edge>::STATIC_SIZE; // next + results
|
||||
|
||||
FullReadDirResp() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += next.packedSize(); // next
|
||||
_size += results.packedSize(); // results
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const FullReadDirResp&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirResp& x);
|
||||
|
||||
struct StatTransientFileReq {
|
||||
InodeId id;
|
||||
|
||||
@@ -1624,56 +1674,6 @@ struct VisitTransientFilesResp {
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const VisitTransientFilesResp& x);
|
||||
|
||||
struct FullReadDirReq {
|
||||
InodeId dirId;
|
||||
uint8_t flags;
|
||||
BincodeBytes startName;
|
||||
EggsTime startTime;
|
||||
uint16_t limit;
|
||||
uint16_t mtu;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = 8 + 1 + BincodeBytes::STATIC_SIZE + 8 + 2 + 2; // dirId + flags + startName + startTime + limit + mtu
|
||||
|
||||
FullReadDirReq() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += 8; // dirId
|
||||
_size += 1; // flags
|
||||
_size += startName.packedSize(); // startName
|
||||
_size += 8; // startTime
|
||||
_size += 2; // limit
|
||||
_size += 2; // mtu
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const FullReadDirReq&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirReq& x);
|
||||
|
||||
struct FullReadDirResp {
|
||||
FullReadDirCursor next;
|
||||
BincodeList<Edge> results;
|
||||
|
||||
static constexpr uint16_t STATIC_SIZE = FullReadDirCursor::STATIC_SIZE + BincodeList<Edge>::STATIC_SIZE; // next + results
|
||||
|
||||
FullReadDirResp() { clear(); }
|
||||
uint16_t packedSize() const {
|
||||
uint16_t _size = 0;
|
||||
_size += next.packedSize(); // next
|
||||
_size += results.packedSize(); // results
|
||||
return _size;
|
||||
}
|
||||
void pack(BincodeBuf& buf) const;
|
||||
void unpack(BincodeBuf& buf);
|
||||
void clear();
|
||||
bool operator==(const FullReadDirResp&rhs) const;
|
||||
};
|
||||
|
||||
std::ostream& operator<<(std::ostream& out, const FullReadDirResp& x);
|
||||
|
||||
struct RemoveNonOwnedEdgeReq {
|
||||
InodeId dirId;
|
||||
InodeId targetId;
|
||||
@@ -3035,7 +3035,7 @@ std::ostream& operator<<(std::ostream& out, const TestWriteResp& x);
|
||||
struct ShardReqContainer {
|
||||
private:
|
||||
ShardMessageKind _kind = (ShardMessageKind)0;
|
||||
std::tuple<LookupReq, StatFileReq, StatDirectoryReq, ReadDirReq, ConstructFileReq, AddSpanInitiateReq, AddSpanCertifyReq, LinkFileReq, SoftUnlinkFileReq, FileSpansReq, SameDirectoryRenameReq, AddInlineSpanReq, StatTransientFileReq, SetDirectoryInfoReq, ExpireTransientFileReq, VisitDirectoriesReq, VisitFilesReq, VisitTransientFilesReq, FullReadDirReq, RemoveNonOwnedEdgeReq, SameShardHardFileUnlinkReq, RemoveSpanInitiateReq, RemoveSpanCertifyReq, SwapBlocksReq, BlockServiceFilesReq, RemoveInodeReq, CreateDirectoryInodeReq, SetDirectoryOwnerReq, RemoveDirectoryOwnerReq, CreateLockedCurrentEdgeReq, LockCurrentEdgeReq, UnlockCurrentEdgeReq, RemoveOwnedSnapshotFileEdgeReq, MakeFileTransientReq> _data;
|
||||
std::tuple<LookupReq, StatFileReq, StatDirectoryReq, ReadDirReq, ConstructFileReq, AddSpanInitiateReq, AddSpanCertifyReq, LinkFileReq, SoftUnlinkFileReq, FileSpansReq, SameDirectoryRenameReq, AddInlineSpanReq, FullReadDirReq, StatTransientFileReq, SetDirectoryInfoReq, ExpireTransientFileReq, VisitDirectoriesReq, VisitFilesReq, VisitTransientFilesReq, RemoveNonOwnedEdgeReq, SameShardHardFileUnlinkReq, RemoveSpanInitiateReq, RemoveSpanCertifyReq, SwapBlocksReq, BlockServiceFilesReq, RemoveInodeReq, CreateDirectoryInodeReq, SetDirectoryOwnerReq, RemoveDirectoryOwnerReq, CreateLockedCurrentEdgeReq, LockCurrentEdgeReq, UnlockCurrentEdgeReq, RemoveOwnedSnapshotFileEdgeReq, MakeFileTransientReq> _data;
|
||||
public:
|
||||
ShardMessageKind kind() const { return _kind; }
|
||||
const LookupReq& getLookup() const;
|
||||
@@ -3062,6 +3062,8 @@ public:
|
||||
SameDirectoryRenameReq& setSameDirectoryRename();
|
||||
const AddInlineSpanReq& getAddInlineSpan() const;
|
||||
AddInlineSpanReq& setAddInlineSpan();
|
||||
const FullReadDirReq& getFullReadDir() const;
|
||||
FullReadDirReq& setFullReadDir();
|
||||
const StatTransientFileReq& getStatTransientFile() const;
|
||||
StatTransientFileReq& setStatTransientFile();
|
||||
const SetDirectoryInfoReq& getSetDirectoryInfo() const;
|
||||
@@ -3074,8 +3076,6 @@ public:
|
||||
VisitFilesReq& setVisitFiles();
|
||||
const VisitTransientFilesReq& getVisitTransientFiles() const;
|
||||
VisitTransientFilesReq& setVisitTransientFiles();
|
||||
const FullReadDirReq& getFullReadDir() const;
|
||||
FullReadDirReq& setFullReadDir();
|
||||
const RemoveNonOwnedEdgeReq& getRemoveNonOwnedEdge() const;
|
||||
RemoveNonOwnedEdgeReq& setRemoveNonOwnedEdge();
|
||||
const SameShardHardFileUnlinkReq& getSameShardHardFileUnlink() const;
|
||||
@@ -3119,7 +3119,7 @@ std::ostream& operator<<(std::ostream& out, const ShardReqContainer& x);
|
||||
struct ShardRespContainer {
|
||||
private:
|
||||
ShardMessageKind _kind = (ShardMessageKind)0;
|
||||
std::tuple<LookupResp, StatFileResp, StatDirectoryResp, ReadDirResp, ConstructFileResp, AddSpanInitiateResp, AddSpanCertifyResp, LinkFileResp, SoftUnlinkFileResp, FileSpansResp, SameDirectoryRenameResp, AddInlineSpanResp, StatTransientFileResp, SetDirectoryInfoResp, ExpireTransientFileResp, VisitDirectoriesResp, VisitFilesResp, VisitTransientFilesResp, FullReadDirResp, RemoveNonOwnedEdgeResp, SameShardHardFileUnlinkResp, RemoveSpanInitiateResp, RemoveSpanCertifyResp, SwapBlocksResp, BlockServiceFilesResp, RemoveInodeResp, CreateDirectoryInodeResp, SetDirectoryOwnerResp, RemoveDirectoryOwnerResp, CreateLockedCurrentEdgeResp, LockCurrentEdgeResp, UnlockCurrentEdgeResp, RemoveOwnedSnapshotFileEdgeResp, MakeFileTransientResp> _data;
|
||||
std::tuple<LookupResp, StatFileResp, StatDirectoryResp, ReadDirResp, ConstructFileResp, AddSpanInitiateResp, AddSpanCertifyResp, LinkFileResp, SoftUnlinkFileResp, FileSpansResp, SameDirectoryRenameResp, AddInlineSpanResp, FullReadDirResp, StatTransientFileResp, SetDirectoryInfoResp, ExpireTransientFileResp, VisitDirectoriesResp, VisitFilesResp, VisitTransientFilesResp, RemoveNonOwnedEdgeResp, SameShardHardFileUnlinkResp, RemoveSpanInitiateResp, RemoveSpanCertifyResp, SwapBlocksResp, BlockServiceFilesResp, RemoveInodeResp, CreateDirectoryInodeResp, SetDirectoryOwnerResp, RemoveDirectoryOwnerResp, CreateLockedCurrentEdgeResp, LockCurrentEdgeResp, UnlockCurrentEdgeResp, RemoveOwnedSnapshotFileEdgeResp, MakeFileTransientResp> _data;
|
||||
public:
|
||||
ShardMessageKind kind() const { return _kind; }
|
||||
const LookupResp& getLookup() const;
|
||||
@@ -3146,6 +3146,8 @@ public:
|
||||
SameDirectoryRenameResp& setSameDirectoryRename();
|
||||
const AddInlineSpanResp& getAddInlineSpan() const;
|
||||
AddInlineSpanResp& setAddInlineSpan();
|
||||
const FullReadDirResp& getFullReadDir() const;
|
||||
FullReadDirResp& setFullReadDir();
|
||||
const StatTransientFileResp& getStatTransientFile() const;
|
||||
StatTransientFileResp& setStatTransientFile();
|
||||
const SetDirectoryInfoResp& getSetDirectoryInfo() const;
|
||||
@@ -3158,8 +3160,6 @@ public:
|
||||
VisitFilesResp& setVisitFiles();
|
||||
const VisitTransientFilesResp& getVisitTransientFiles() const;
|
||||
VisitTransientFilesResp& setVisitTransientFiles();
|
||||
const FullReadDirResp& getFullReadDir() const;
|
||||
FullReadDirResp& setFullReadDir();
|
||||
const RemoveNonOwnedEdgeResp& getRemoveNonOwnedEdge() const;
|
||||
RemoveNonOwnedEdgeResp& setRemoveNonOwnedEdge();
|
||||
const SameShardHardFileUnlinkResp& getSameShardHardFileUnlink() const;
|
||||
|
||||
@@ -1346,6 +1346,13 @@ func main() {
|
||||
reflect.TypeOf(msgs.AddInlineSpanReq{}),
|
||||
reflect.TypeOf(msgs.AddInlineSpanResp{}),
|
||||
},
|
||||
// this was marked as a "private" operation, but we now use it in
|
||||
// the client (to check deleted edges)
|
||||
{
|
||||
0x73,
|
||||
reflect.TypeOf(msgs.FullReadDirReq{}),
|
||||
reflect.TypeOf(msgs.FullReadDirResp{}),
|
||||
},
|
||||
}
|
||||
|
||||
shardReqResps := append(kernelShardReqResps, []reqRespType{
|
||||
@@ -1381,11 +1388,6 @@ func main() {
|
||||
reflect.TypeOf(msgs.VisitTransientFilesReq{}),
|
||||
reflect.TypeOf(msgs.VisitTransientFilesResp{}),
|
||||
},
|
||||
{
|
||||
0x73,
|
||||
reflect.TypeOf(msgs.FullReadDirReq{}),
|
||||
reflect.TypeOf(msgs.FullReadDirResp{}),
|
||||
},
|
||||
{
|
||||
0x74,
|
||||
reflect.TypeOf(msgs.RemoveNonOwnedEdgeReq{}),
|
||||
@@ -1588,12 +1590,12 @@ func main() {
|
||||
reflect.TypeOf(msgs.FetchedInlineSpan{}),
|
||||
reflect.TypeOf(msgs.FetchedBlocksSpan{}),
|
||||
reflect.TypeOf(msgs.BlacklistEntry{}),
|
||||
reflect.TypeOf(msgs.Edge{}),
|
||||
reflect.TypeOf(msgs.FullReadDirCursor{}),
|
||||
}
|
||||
|
||||
extras := append([]reflect.Type{reflect.TypeOf(msgs.FailureDomain{})}, append(kernelExtras, []reflect.Type{
|
||||
reflect.TypeOf(msgs.TransientFile{}),
|
||||
reflect.TypeOf(msgs.Edge{}),
|
||||
reflect.TypeOf(msgs.FullReadDirCursor{}),
|
||||
reflect.TypeOf(msgs.EntryNewBlockInfo{}),
|
||||
reflect.TypeOf(msgs.BlockServiceInfo{}),
|
||||
reflect.TypeOf(msgs.RegisterShardInfo{}),
|
||||
|
||||
@@ -110,7 +110,7 @@ func (c *Client) checkDeletedEdge(
|
||||
return false
|
||||
}
|
||||
oldEdge := resp.Results[1]
|
||||
if oldEdge.TargetId.Extra() != owned || oldEdge.TargetId.Id() != targetId || oldEdge.CreationTime != creationTime {
|
||||
if oldEdge.Current || oldEdge.TargetId.Extra() != owned || oldEdge.TargetId.Id() != targetId || oldEdge.CreationTime != creationTime {
|
||||
logger.Info("got mismatched snapshot edge (%+v), giving up and returning original error", oldEdge)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -321,6 +321,8 @@ func (k ShardMessageKind) String() string {
|
||||
return "SAME_DIRECTORY_RENAME"
|
||||
case 16:
|
||||
return "ADD_INLINE_SPAN"
|
||||
case 115:
|
||||
return "FULL_READ_DIR"
|
||||
case 3:
|
||||
return "STAT_TRANSIENT_FILE"
|
||||
case 13:
|
||||
@@ -333,8 +335,6 @@ func (k ShardMessageKind) String() string {
|
||||
return "VISIT_FILES"
|
||||
case 114:
|
||||
return "VISIT_TRANSIENT_FILES"
|
||||
case 115:
|
||||
return "FULL_READ_DIR"
|
||||
case 116:
|
||||
return "REMOVE_NON_OWNED_EDGE"
|
||||
case 117:
|
||||
@@ -384,13 +384,13 @@ const (
|
||||
FILE_SPANS ShardMessageKind = 0xB
|
||||
SAME_DIRECTORY_RENAME ShardMessageKind = 0xC
|
||||
ADD_INLINE_SPAN ShardMessageKind = 0x10
|
||||
FULL_READ_DIR ShardMessageKind = 0x73
|
||||
STAT_TRANSIENT_FILE ShardMessageKind = 0x3
|
||||
SET_DIRECTORY_INFO ShardMessageKind = 0xD
|
||||
EXPIRE_TRANSIENT_FILE ShardMessageKind = 0xF
|
||||
VISIT_DIRECTORIES ShardMessageKind = 0x70
|
||||
VISIT_FILES ShardMessageKind = 0x71
|
||||
VISIT_TRANSIENT_FILES ShardMessageKind = 0x72
|
||||
FULL_READ_DIR ShardMessageKind = 0x73
|
||||
REMOVE_NON_OWNED_EDGE ShardMessageKind = 0x74
|
||||
SAME_SHARD_HARD_FILE_UNLINK ShardMessageKind = 0x75
|
||||
REMOVE_SPAN_INITIATE ShardMessageKind = 0x76
|
||||
@@ -434,6 +434,8 @@ func MkShardMessage(k string) (ShardRequest, ShardResponse) {
|
||||
return &SameDirectoryRenameReq{}, &SameDirectoryRenameResp{}
|
||||
case k == "ADD_INLINE_SPAN":
|
||||
return &AddInlineSpanReq{}, &AddInlineSpanResp{}
|
||||
case k == "FULL_READ_DIR":
|
||||
return &FullReadDirReq{}, &FullReadDirResp{}
|
||||
case k == "STAT_TRANSIENT_FILE":
|
||||
return &StatTransientFileReq{}, &StatTransientFileResp{}
|
||||
case k == "SET_DIRECTORY_INFO":
|
||||
@@ -446,8 +448,6 @@ func MkShardMessage(k string) (ShardRequest, ShardResponse) {
|
||||
return &VisitFilesReq{}, &VisitFilesResp{}
|
||||
case k == "VISIT_TRANSIENT_FILES":
|
||||
return &VisitTransientFilesReq{}, &VisitTransientFilesResp{}
|
||||
case k == "FULL_READ_DIR":
|
||||
return &FullReadDirReq{}, &FullReadDirResp{}
|
||||
case k == "REMOVE_NON_OWNED_EDGE":
|
||||
return &RemoveNonOwnedEdgeReq{}, &RemoveNonOwnedEdgeResp{}
|
||||
case k == "SAME_SHARD_HARD_FILE_UNLINK":
|
||||
@@ -1402,6 +1402,91 @@ func (v *AddInlineSpanResp) Unpack(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) ShardRequestKind() ShardMessageKind {
|
||||
return FULL_READ_DIR
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, uint64(v.DirId)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint8(v.Flags)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackBytes(w, []byte(v.StartName)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint64(v.StartTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint16(v.Limit)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint16(v.Mtu)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) Unpack(r io.Reader) error {
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.DirId)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint8)(&v.Flags)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackString(r, &v.StartName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.StartTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint16)(&v.Limit)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint16)(&v.Mtu)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) ShardResponseKind() ShardMessageKind {
|
||||
return FULL_READ_DIR
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) Pack(w io.Writer) error {
|
||||
if err := v.Next.Pack(w); err != nil {
|
||||
return err
|
||||
}
|
||||
len1 := len(v.Results)
|
||||
if err := bincode.PackLength(w, len1); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := 0; i < len1; i++ {
|
||||
if err := v.Results[i].Pack(w); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) Unpack(r io.Reader) error {
|
||||
if err := v.Next.Unpack(r); err != nil {
|
||||
return err
|
||||
}
|
||||
var len1 int
|
||||
if err := bincode.UnpackLength(r, &len1); err != nil {
|
||||
return err
|
||||
}
|
||||
bincode.EnsureLength(&v.Results, len1)
|
||||
for i := 0; i < len1; i++ {
|
||||
if err := v.Results[i].Unpack(r); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *StatTransientFileReq) ShardRequestKind() ShardMessageKind {
|
||||
return STAT_TRANSIENT_FILE
|
||||
}
|
||||
@@ -1699,91 +1784,6 @@ func (v *VisitTransientFilesResp) Unpack(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) ShardRequestKind() ShardMessageKind {
|
||||
return FULL_READ_DIR
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, uint64(v.DirId)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint8(v.Flags)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackBytes(w, []byte(v.StartName)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint64(v.StartTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint16(v.Limit)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint16(v.Mtu)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirReq) Unpack(r io.Reader) error {
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.DirId)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint8)(&v.Flags)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackString(r, &v.StartName); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.StartTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint16)(&v.Limit)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint16)(&v.Mtu)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) ShardResponseKind() ShardMessageKind {
|
||||
return FULL_READ_DIR
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) Pack(w io.Writer) error {
|
||||
if err := v.Next.Pack(w); err != nil {
|
||||
return err
|
||||
}
|
||||
len1 := len(v.Results)
|
||||
if err := bincode.PackLength(w, len1); err != nil {
|
||||
return err
|
||||
}
|
||||
for i := 0; i < len1; i++ {
|
||||
if err := v.Results[i].Pack(w); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *FullReadDirResp) Unpack(r io.Reader) error {
|
||||
if err := v.Next.Unpack(r); err != nil {
|
||||
return err
|
||||
}
|
||||
var len1 int
|
||||
if err := bincode.UnpackLength(r, &len1); err != nil {
|
||||
return err
|
||||
}
|
||||
bincode.EnsureLength(&v.Results, len1)
|
||||
for i := 0; i < len1; i++ {
|
||||
if err := v.Results[i].Unpack(r); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *RemoveNonOwnedEdgeReq) ShardRequestKind() ShardMessageKind {
|
||||
return REMOVE_NON_OWNED_EDGE
|
||||
}
|
||||
@@ -3274,32 +3274,6 @@ func (v *BlacklistEntry) Unpack(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *TransientFile) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, uint64(v.Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackFixedBytes(w, 8, v.Cookie[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint64(v.DeadlineTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *TransientFile) Unpack(r io.Reader) error {
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackFixedBytes(r, 8, v.Cookie[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.DeadlineTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *Edge) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, bool(v.Current)); err != nil {
|
||||
return err
|
||||
@@ -3364,6 +3338,32 @@ func (v *FullReadDirCursor) Unpack(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *TransientFile) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, uint64(v.Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackFixedBytes(w, 8, v.Cookie[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.PackScalar(w, uint64(v.DeadlineTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *TransientFile) Unpack(r io.Reader) error {
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.Id)); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackFixedBytes(r, 8, v.Cookie[:]); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := bincode.UnpackScalar(r, (*uint64)(&v.DeadlineTime)); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *EntryNewBlockInfo) Pack(w io.Writer) error {
|
||||
if err := bincode.PackScalar(w, uint64(v.BlockServiceId)); err != nil {
|
||||
return err
|
||||
|
||||
@@ -172,6 +172,10 @@ static const u8 EGGSFS_FLASH_STORAGE = 3;
|
||||
#define EGGSFS_BLOCK_SERVICE_DONT_READ (EGGSFS_BLOCK_SERVICE_STALE | EGGSFS_BLOCK_SERVICE_NO_READ | EGGSFS_BLOCK_SERVICE_DECOMMISSIONED)
|
||||
#define EGGSFS_BLOCK_SERVICE_DONT_WRITE (EGGSFS_BLOCK_SERVICE_STALE | EGGSFS_BLOCK_SERVICE_NO_WRITE | EGGSFS_BLOCK_SERVICE_DECOMMISSIONED)
|
||||
|
||||
#define EGGSFS_FULL_READ_DIR_CURRENT (1u << 0)
|
||||
#define EGGSFS_FULL_READ_DIR_BACKWARDS (1u << 1)
|
||||
#define EGGSFS_FULL_READ_DIR_SAME_NAME (1u << 2)
|
||||
|
||||
#define EGGSFS_MAX_STRIPES 15
|
||||
|
||||
#endif
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <immintrin.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
|
||||
@@ -75,6 +75,7 @@ const char* eggsfs_shard_kind_str(int kind) {
|
||||
case 11: return "FILE_SPANS";
|
||||
case 12: return "SAME_DIRECTORY_RENAME";
|
||||
case 16: return "ADD_INLINE_SPAN";
|
||||
case 115: return "FULL_READ_DIR";
|
||||
default: return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,8 @@ const char* eggsfs_err_str(int err);
|
||||
#define EGGSFS_SHARD_FILE_SPANS 0xB
|
||||
#define EGGSFS_SHARD_SAME_DIRECTORY_RENAME 0xC
|
||||
#define EGGSFS_SHARD_ADD_INLINE_SPAN 0x10
|
||||
#define __print_eggsfs_shard_kind(k) __print_symbolic(k, { 1, "LOOKUP" }, { 2, "STAT_FILE" }, { 4, "STAT_DIRECTORY" }, { 5, "READ_DIR" }, { 6, "CONSTRUCT_FILE" }, { 7, "ADD_SPAN_INITIATE" }, { 8, "ADD_SPAN_CERTIFY" }, { 9, "LINK_FILE" }, { 10, "SOFT_UNLINK_FILE" }, { 11, "FILE_SPANS" }, { 12, "SAME_DIRECTORY_RENAME" }, { 16, "ADD_INLINE_SPAN" })
|
||||
#define EGGSFS_SHARD_FULL_READ_DIR 0x73
|
||||
#define __print_eggsfs_shard_kind(k) __print_symbolic(k, { 1, "LOOKUP" }, { 2, "STAT_FILE" }, { 4, "STAT_DIRECTORY" }, { 5, "READ_DIR" }, { 6, "CONSTRUCT_FILE" }, { 7, "ADD_SPAN_INITIATE" }, { 8, "ADD_SPAN_CERTIFY" }, { 9, "LINK_FILE" }, { 10, "SOFT_UNLINK_FILE" }, { 11, "FILE_SPANS" }, { 12, "SAME_DIRECTORY_RENAME" }, { 16, "ADD_INLINE_SPAN" }, { 115, "FULL_READ_DIR" })
|
||||
const char* eggsfs_shard_kind_str(int kind);
|
||||
|
||||
#define EGGSFS_CDC_MAKE_DIRECTORY 0x1
|
||||
@@ -1598,6 +1599,264 @@ static inline void _eggsfs_blacklist_entry_put_block_service(struct eggsfs_binco
|
||||
{ struct eggsfs_blacklist_entry_block_service* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_blacklist_entry_end* next __attribute__((unused)) = NULL
|
||||
|
||||
#define EGGSFS_EDGE_MAX_SIZE 281
|
||||
struct eggsfs_edge_start;
|
||||
#define eggsfs_edge_get_start(ctx, start) struct eggsfs_edge_start* start = NULL
|
||||
|
||||
struct eggsfs_edge_current { bool x; };
|
||||
static inline void _eggsfs_edge_get_current(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_start** prev, struct eggsfs_edge_current* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = *(bool*)(ctx->buf);
|
||||
ctx->buf += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_edge_get_current(ctx, prev, next) \
|
||||
struct eggsfs_edge_current next; \
|
||||
_eggsfs_edge_get_current(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_edge_target_id { u64 x; };
|
||||
static inline void _eggsfs_edge_get_target_id(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_current* prev, struct eggsfs_edge_target_id* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_edge_get_target_id(ctx, prev, next) \
|
||||
struct eggsfs_edge_target_id next; \
|
||||
_eggsfs_edge_get_target_id(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_edge_name_hash { u64 x; };
|
||||
static inline void _eggsfs_edge_get_name_hash(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_target_id* prev, struct eggsfs_edge_name_hash* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_edge_get_name_hash(ctx, prev, next) \
|
||||
struct eggsfs_edge_name_hash next; \
|
||||
_eggsfs_edge_get_name_hash(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_edge_name { struct eggsfs_bincode_bytes str; };
|
||||
static inline void _eggsfs_edge_get_name(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_name_hash* prev, struct eggsfs_edge_name* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.len = *(u8*)(ctx->buf);
|
||||
ctx->buf++;
|
||||
if (unlikely(ctx->end - ctx->buf < next->str.len)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.buf = ctx->buf;
|
||||
ctx->buf += next->str.len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_edge_get_name(ctx, prev, next) \
|
||||
struct eggsfs_edge_name next; \
|
||||
_eggsfs_edge_get_name(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_edge_creation_time { u64 x; };
|
||||
static inline void _eggsfs_edge_get_creation_time(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_name* prev, struct eggsfs_edge_creation_time* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_edge_get_creation_time(ctx, prev, next) \
|
||||
struct eggsfs_edge_creation_time next; \
|
||||
_eggsfs_edge_get_creation_time(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_edge_end;
|
||||
#define eggsfs_edge_get_end(ctx, prev, next) \
|
||||
{ struct eggsfs_edge_creation_time* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_edge_end* next = NULL
|
||||
|
||||
static inline void eggsfs_edge_get_finish(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_edge_end* end) {
|
||||
if (unlikely(ctx->buf != ctx->end)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define eggsfs_edge_put_start(ctx, start) struct eggsfs_edge_start* start = NULL
|
||||
|
||||
static inline void _eggsfs_edge_put_current(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_edge_start** prev, struct eggsfs_edge_current* next, bool x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 1);
|
||||
*(bool*)(ctx->cursor) = x;
|
||||
ctx->cursor += 1;
|
||||
}
|
||||
#define eggsfs_edge_put_current(ctx, prev, next, x) \
|
||||
struct eggsfs_edge_current next; \
|
||||
_eggsfs_edge_put_current(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_edge_put_target_id(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_edge_current* prev, struct eggsfs_edge_target_id* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_edge_put_target_id(ctx, prev, next, x) \
|
||||
struct eggsfs_edge_target_id next; \
|
||||
_eggsfs_edge_put_target_id(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_edge_put_name_hash(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_edge_target_id* prev, struct eggsfs_edge_name_hash* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_edge_put_name_hash(ctx, prev, next, x) \
|
||||
struct eggsfs_edge_name_hash next; \
|
||||
_eggsfs_edge_put_name_hash(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_edge_put_name(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_edge_name_hash* prev, struct eggsfs_edge_name* next, const char* str, int str_len) {
|
||||
next = NULL;
|
||||
BUG_ON(str_len < 0 || str_len > 255);
|
||||
BUG_ON(ctx->end - ctx->cursor < (1 + str_len));
|
||||
*(u8*)(ctx->cursor) = str_len;
|
||||
memcpy(ctx->cursor + 1, str, str_len);
|
||||
ctx->cursor += 1 + str_len;
|
||||
}
|
||||
#define eggsfs_edge_put_name(ctx, prev, next, str, str_len) \
|
||||
struct eggsfs_edge_name next; \
|
||||
_eggsfs_edge_put_name(ctx, &(prev), &(next), str, str_len)
|
||||
|
||||
static inline void _eggsfs_edge_put_creation_time(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_edge_name* prev, struct eggsfs_edge_creation_time* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_edge_put_creation_time(ctx, prev, next, x) \
|
||||
struct eggsfs_edge_creation_time next; \
|
||||
_eggsfs_edge_put_creation_time(ctx, &(prev), &(next), x)
|
||||
|
||||
#define eggsfs_edge_put_end(ctx, prev, next) \
|
||||
{ struct eggsfs_edge_creation_time* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_edge_end* next __attribute__((unused)) = NULL
|
||||
|
||||
#define EGGSFS_FULL_READ_DIR_CURSOR_MAX_SIZE 265
|
||||
struct eggsfs_full_read_dir_cursor_start;
|
||||
#define eggsfs_full_read_dir_cursor_get_start(ctx, start) struct eggsfs_full_read_dir_cursor_start* start = NULL
|
||||
|
||||
struct eggsfs_full_read_dir_cursor_current { bool x; };
|
||||
static inline void _eggsfs_full_read_dir_cursor_get_current(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_cursor_start** prev, struct eggsfs_full_read_dir_cursor_current* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = *(bool*)(ctx->buf);
|
||||
ctx->buf += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_get_current(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_cursor_current next; \
|
||||
_eggsfs_full_read_dir_cursor_get_current(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_cursor_start_name { struct eggsfs_bincode_bytes str; };
|
||||
static inline void _eggsfs_full_read_dir_cursor_get_start_name(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_cursor_current* prev, struct eggsfs_full_read_dir_cursor_start_name* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.len = *(u8*)(ctx->buf);
|
||||
ctx->buf++;
|
||||
if (unlikely(ctx->end - ctx->buf < next->str.len)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.buf = ctx->buf;
|
||||
ctx->buf += next->str.len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_get_start_name(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_cursor_start_name next; \
|
||||
_eggsfs_full_read_dir_cursor_get_start_name(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_cursor_start_time { u64 x; };
|
||||
static inline void _eggsfs_full_read_dir_cursor_get_start_time(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_cursor_start_name* prev, struct eggsfs_full_read_dir_cursor_start_time* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_get_start_time(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_cursor_start_time next; \
|
||||
_eggsfs_full_read_dir_cursor_get_start_time(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_cursor_end;
|
||||
#define eggsfs_full_read_dir_cursor_get_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_cursor_start_time* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_cursor_end* next = NULL
|
||||
|
||||
static inline void eggsfs_full_read_dir_cursor_get_finish(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_cursor_end* end) {
|
||||
if (unlikely(ctx->buf != ctx->end)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define eggsfs_full_read_dir_cursor_put_start(ctx, start) struct eggsfs_full_read_dir_cursor_start* start = NULL
|
||||
|
||||
static inline void _eggsfs_full_read_dir_cursor_put_current(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_cursor_start** prev, struct eggsfs_full_read_dir_cursor_current* next, bool x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 1);
|
||||
*(bool*)(ctx->cursor) = x;
|
||||
ctx->cursor += 1;
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_put_current(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_cursor_current next; \
|
||||
_eggsfs_full_read_dir_cursor_put_current(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_cursor_put_start_name(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_cursor_current* prev, struct eggsfs_full_read_dir_cursor_start_name* next, const char* str, int str_len) {
|
||||
next = NULL;
|
||||
BUG_ON(str_len < 0 || str_len > 255);
|
||||
BUG_ON(ctx->end - ctx->cursor < (1 + str_len));
|
||||
*(u8*)(ctx->cursor) = str_len;
|
||||
memcpy(ctx->cursor + 1, str, str_len);
|
||||
ctx->cursor += 1 + str_len;
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_put_start_name(ctx, prev, next, str, str_len) \
|
||||
struct eggsfs_full_read_dir_cursor_start_name next; \
|
||||
_eggsfs_full_read_dir_cursor_put_start_name(ctx, &(prev), &(next), str, str_len)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_cursor_put_start_time(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_cursor_start_name* prev, struct eggsfs_full_read_dir_cursor_start_time* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_full_read_dir_cursor_put_start_time(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_cursor_start_time next; \
|
||||
_eggsfs_full_read_dir_cursor_put_start_time(ctx, &(prev), &(next), x)
|
||||
|
||||
#define eggsfs_full_read_dir_cursor_put_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_cursor_start_time* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_cursor_end* next __attribute__((unused)) = NULL
|
||||
|
||||
#define EGGSFS_LOOKUP_REQ_MAX_SIZE 264
|
||||
struct eggsfs_lookup_req_start;
|
||||
#define eggsfs_lookup_req_get_start(ctx, start) struct eggsfs_lookup_req_start* start = NULL
|
||||
@@ -3802,6 +4061,237 @@ static inline void eggsfs_add_inline_span_resp_get_finish(struct eggsfs_bincode_
|
||||
{ struct eggsfs_add_inline_span_resp_start** __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_add_inline_span_resp_end* next __attribute__((unused)) = NULL
|
||||
|
||||
#define EGGSFS_FULL_READ_DIR_REQ_MAX_SIZE 277
|
||||
struct eggsfs_full_read_dir_req_start;
|
||||
#define eggsfs_full_read_dir_req_get_start(ctx, start) struct eggsfs_full_read_dir_req_start* start = NULL
|
||||
|
||||
struct eggsfs_full_read_dir_req_dir_id { u64 x; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_dir_id(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_start** prev, struct eggsfs_full_read_dir_req_dir_id* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_dir_id(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_dir_id next; \
|
||||
_eggsfs_full_read_dir_req_get_dir_id(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_flags { u8 x; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_flags(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_dir_id* prev, struct eggsfs_full_read_dir_req_flags* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = *(u8*)(ctx->buf);
|
||||
ctx->buf += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_flags(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_flags next; \
|
||||
_eggsfs_full_read_dir_req_get_flags(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_start_name { struct eggsfs_bincode_bytes str; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_start_name(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_flags* prev, struct eggsfs_full_read_dir_req_start_name* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 1)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.len = *(u8*)(ctx->buf);
|
||||
ctx->buf++;
|
||||
if (unlikely(ctx->end - ctx->buf < next->str.len)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->str.buf = ctx->buf;
|
||||
ctx->buf += next->str.len;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_start_name(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_start_name next; \
|
||||
_eggsfs_full_read_dir_req_get_start_name(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_start_time { u64 x; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_start_time(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_start_name* prev, struct eggsfs_full_read_dir_req_start_time* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 8)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le64(ctx->buf);
|
||||
ctx->buf += 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_start_time(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_start_time next; \
|
||||
_eggsfs_full_read_dir_req_get_start_time(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_limit { u16 x; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_limit(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_start_time* prev, struct eggsfs_full_read_dir_req_limit* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 2)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le16(ctx->buf);
|
||||
ctx->buf += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_limit(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_limit next; \
|
||||
_eggsfs_full_read_dir_req_get_limit(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_mtu { u16 x; };
|
||||
static inline void _eggsfs_full_read_dir_req_get_mtu(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_limit* prev, struct eggsfs_full_read_dir_req_mtu* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 2)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->x = get_unaligned_le16(ctx->buf);
|
||||
ctx->buf += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_get_mtu(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_req_mtu next; \
|
||||
_eggsfs_full_read_dir_req_get_mtu(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_req_end;
|
||||
#define eggsfs_full_read_dir_req_get_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_req_mtu* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_req_end* next = NULL
|
||||
|
||||
static inline void eggsfs_full_read_dir_req_get_finish(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_req_end* end) {
|
||||
if (unlikely(ctx->buf != ctx->end)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define eggsfs_full_read_dir_req_put_start(ctx, start) struct eggsfs_full_read_dir_req_start* start = NULL
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_dir_id(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_start** prev, struct eggsfs_full_read_dir_req_dir_id* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_dir_id(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_req_dir_id next; \
|
||||
_eggsfs_full_read_dir_req_put_dir_id(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_flags(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_dir_id* prev, struct eggsfs_full_read_dir_req_flags* next, u8 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 1);
|
||||
*(u8*)(ctx->cursor) = x;
|
||||
ctx->cursor += 1;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_flags(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_req_flags next; \
|
||||
_eggsfs_full_read_dir_req_put_flags(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_start_name(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_flags* prev, struct eggsfs_full_read_dir_req_start_name* next, const char* str, int str_len) {
|
||||
next = NULL;
|
||||
BUG_ON(str_len < 0 || str_len > 255);
|
||||
BUG_ON(ctx->end - ctx->cursor < (1 + str_len));
|
||||
*(u8*)(ctx->cursor) = str_len;
|
||||
memcpy(ctx->cursor + 1, str, str_len);
|
||||
ctx->cursor += 1 + str_len;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_start_name(ctx, prev, next, str, str_len) \
|
||||
struct eggsfs_full_read_dir_req_start_name next; \
|
||||
_eggsfs_full_read_dir_req_put_start_name(ctx, &(prev), &(next), str, str_len)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_start_time(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_start_name* prev, struct eggsfs_full_read_dir_req_start_time* next, u64 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 8);
|
||||
put_unaligned_le64(x, ctx->cursor);
|
||||
ctx->cursor += 8;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_start_time(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_req_start_time next; \
|
||||
_eggsfs_full_read_dir_req_put_start_time(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_limit(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_start_time* prev, struct eggsfs_full_read_dir_req_limit* next, u16 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 2);
|
||||
put_unaligned_le16(x, ctx->cursor);
|
||||
ctx->cursor += 2;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_limit(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_req_limit next; \
|
||||
_eggsfs_full_read_dir_req_put_limit(ctx, &(prev), &(next), x)
|
||||
|
||||
static inline void _eggsfs_full_read_dir_req_put_mtu(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_req_limit* prev, struct eggsfs_full_read_dir_req_mtu* next, u16 x) {
|
||||
next = NULL;
|
||||
BUG_ON(ctx->end - ctx->cursor < 2);
|
||||
put_unaligned_le16(x, ctx->cursor);
|
||||
ctx->cursor += 2;
|
||||
}
|
||||
#define eggsfs_full_read_dir_req_put_mtu(ctx, prev, next, x) \
|
||||
struct eggsfs_full_read_dir_req_mtu next; \
|
||||
_eggsfs_full_read_dir_req_put_mtu(ctx, &(prev), &(next), x)
|
||||
|
||||
#define eggsfs_full_read_dir_req_put_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_req_mtu* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_req_end* next __attribute__((unused)) = NULL
|
||||
|
||||
struct eggsfs_full_read_dir_resp_start;
|
||||
#define eggsfs_full_read_dir_resp_get_start(ctx, start) struct eggsfs_full_read_dir_resp_start* start = NULL
|
||||
|
||||
#define eggsfs_full_read_dir_resp_get_next(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_resp_start** __dummy __attribute__((unused)) = &(prev); }; \
|
||||
struct eggsfs_full_read_dir_cursor_start* next = NULL
|
||||
|
||||
struct eggsfs_full_read_dir_resp_results { u16 len; };
|
||||
static inline void _eggsfs_full_read_dir_resp_get_results(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_cursor_end** prev, struct eggsfs_full_read_dir_resp_results* next) {
|
||||
if (likely(ctx->err == 0)) {
|
||||
if (unlikely(ctx->end - ctx->buf < 2)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
} else {
|
||||
next->len = get_unaligned_le16(ctx->buf);
|
||||
ctx->buf += 2;
|
||||
}
|
||||
} else {
|
||||
next->len = 0;
|
||||
}
|
||||
}
|
||||
#define eggsfs_full_read_dir_resp_get_results(ctx, prev, next) \
|
||||
struct eggsfs_full_read_dir_resp_results next; \
|
||||
_eggsfs_full_read_dir_resp_get_results(ctx, &(prev), &(next))
|
||||
|
||||
struct eggsfs_full_read_dir_resp_end;
|
||||
#define eggsfs_full_read_dir_resp_get_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_resp_results* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_resp_end* next = NULL
|
||||
|
||||
static inline void eggsfs_full_read_dir_resp_get_finish(struct eggsfs_bincode_get_ctx* ctx, struct eggsfs_full_read_dir_resp_end* end) {
|
||||
if (unlikely(ctx->buf != ctx->end)) {
|
||||
ctx->err = EGGSFS_ERR_MALFORMED_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
||||
#define eggsfs_full_read_dir_resp_put_start(ctx, start) struct eggsfs_full_read_dir_resp_start* start = NULL
|
||||
|
||||
static inline void _eggsfs_full_read_dir_resp_put_results(struct eggsfs_bincode_put_ctx* ctx, struct eggsfs_full_read_dir_resp_start** prev, struct eggsfs_full_read_dir_resp_results* next, int len) {
|
||||
next = NULL;
|
||||
BUG_ON(len < 0 || len >= 1<<16);
|
||||
BUG_ON(ctx->end - ctx->cursor < 2);
|
||||
put_unaligned_le16(len, ctx->cursor);
|
||||
ctx->cursor += 2;
|
||||
}
|
||||
#define eggsfs_full_read_dir_resp_put_results(ctx, prev, next, len) \
|
||||
struct eggsfs_full_read_dir_resp_results next; \
|
||||
_eggsfs_full_read_dir_resp_put_results(ctx, &(prev), &(next), len)
|
||||
|
||||
#define eggsfs_full_read_dir_resp_put_end(ctx, prev, next) \
|
||||
{ struct eggsfs_full_read_dir_resp_results* __dummy __attribute__((unused)) = &(prev); }\
|
||||
struct eggsfs_full_read_dir_resp_end* next __attribute__((unused)) = NULL
|
||||
|
||||
#define EGGSFS_MAKE_DIRECTORY_REQ_MAX_SIZE 264
|
||||
struct eggsfs_make_directory_req_start;
|
||||
#define eggsfs_make_directory_req_get_start(ctx, start) struct eggsfs_make_directory_req_start* start = NULL
|
||||
|
||||
@@ -216,17 +216,21 @@ int eggsfs_shard_readdir(struct eggsfs_fs_info* info, u64 dir, u64 start_pos, vo
|
||||
static bool check_deleted_edge(
|
||||
struct eggsfs_fs_info* info, u64 dir, u64 target, const char* name, int name_len, u64 creation_time, bool owned
|
||||
) {
|
||||
int i;
|
||||
struct sk_buff* skb;
|
||||
u32 attempts;
|
||||
u64 req_id = alloc_request_id();
|
||||
u8 kind = EGGSFS_SHARD_SNAPSHOT_LOOKUP;
|
||||
u8 kind = EGGSFS_SHARD_FULL_READ_DIR;
|
||||
{
|
||||
PREPARE_SHARD_REQ_CTX(EGGSFS_SNAPSHOT_LOOKUP_REQ_MAX_SIZE);
|
||||
eggsfs_snapshot_lookup_req_put_start(&ctx, start);
|
||||
eggsfs_snapshot_lookup_req_put_dir_id(&ctx, start, dir_req, dir);
|
||||
eggsfs_snapshot_lookup_req_put_name(&ctx, dir_req, name_req, name, name_len);
|
||||
eggsfs_snapshot_lookup_req_put_start_from(&ctx, name_req, start_from, creation_time);
|
||||
eggsfs_snapshot_lookup_req_put_end(&ctx, start_from, end);
|
||||
PREPARE_SHARD_REQ_CTX(EGGSFS_FULL_READ_DIR_REQ_MAX_SIZE);
|
||||
eggsfs_full_read_dir_req_put_start(&ctx, start);
|
||||
eggsfs_full_read_dir_req_put_dir_id(&ctx, start, dir_req, dir);
|
||||
eggsfs_full_read_dir_req_put_flags(&ctx, dir_req, flags, EGGSFS_FULL_READ_DIR_BACKWARDS|EGGSFS_FULL_READ_DIR_CURRENT|EGGSFS_FULL_READ_DIR_SAME_NAME);
|
||||
eggsfs_full_read_dir_req_put_start_name(&ctx, flags, name_req, name, name_len);
|
||||
eggsfs_full_read_dir_req_put_start_time(&ctx, name_req, start_time, 0);
|
||||
eggsfs_full_read_dir_req_put_limit(&ctx, start_time, limit, 2);
|
||||
eggsfs_full_read_dir_req_put_mtu(&ctx, limit, mtu, 0);
|
||||
eggsfs_full_read_dir_req_put_end(&ctx, mtu, end);
|
||||
skb = eggsfs_send_shard_req(info, eggsfs_inode_shard(dir), req_id, &ctx, &attempts);
|
||||
if (IS_ERR(skb)) { return false; }
|
||||
}
|
||||
@@ -234,21 +238,28 @@ static bool check_deleted_edge(
|
||||
bool good = true;
|
||||
{
|
||||
PREPARE_SHARD_RESP_CTX();
|
||||
eggsfs_snapshot_lookup_resp_get_start(&ctx, start);
|
||||
eggsfs_snapshot_lookup_resp_get_next_time(&ctx, start, next_time);
|
||||
eggsfs_snapshot_lookup_resp_get_edges(&ctx, next_time, edges);
|
||||
if (edges.len != 2) { good = false; }
|
||||
int i;
|
||||
for (i = 0; i < edges.len; i++) {
|
||||
eggsfs_snapshot_lookup_edge_get_start(&ctx, start);
|
||||
eggsfs_snapshot_lookup_edge_get_target_id(&ctx, start, edge_target);
|
||||
eggsfs_snapshot_lookup_edge_get_creation_time(&ctx, edge_target, edge_creation_time);
|
||||
eggsfs_snapshot_lookup_edge_get_end(&ctx, edge_creation_time, end);
|
||||
eggsfs_full_read_dir_resp_get_start(&ctx, start);
|
||||
eggsfs_full_read_dir_resp_get_next(&ctx, start, cursor);
|
||||
eggsfs_full_read_dir_cursor_get_current(&ctx, cursor, cur_current);
|
||||
eggsfs_full_read_dir_cursor_get_start_name(&ctx, cur_current, cur_start_name);
|
||||
eggsfs_full_read_dir_cursor_get_start_time(&ctx, cur_start_name, cur_start_time);
|
||||
eggsfs_full_read_dir_cursor_get_end(&ctx, cur_start_time, cur_end);
|
||||
eggsfs_full_read_dir_resp_get_results(&ctx, cur_end, results_len);
|
||||
if (results_len.len != 2) { good = false; }
|
||||
for (i = 0; i < results_len.len; i++) {
|
||||
eggsfs_edge_get_start(&ctx, start);
|
||||
eggsfs_edge_get_current(&ctx, start, edge_current);
|
||||
eggsfs_edge_get_target_id(&ctx, edge_current, edge_target);
|
||||
eggsfs_edge_get_name_hash(&ctx, edge_target, edge_name_hash);
|
||||
eggsfs_edge_get_name(&ctx, edge_name_hash, edge_name);
|
||||
eggsfs_edge_get_creation_time(&ctx, edge_name, edge_creation_time);
|
||||
eggsfs_edge_get_end(&ctx, edge_creation_time, end);
|
||||
eggsfs_bincode_get_finish_list_el(end);
|
||||
if (
|
||||
likely(ctx.err == 0) &&
|
||||
i == 0 && // this is the old edge
|
||||
i == 1 && // this is the old edge
|
||||
(
|
||||
edge_current.x ||
|
||||
EGGSFS_GET_EXTRA(edge_target.x) != owned ||
|
||||
EGGSFS_GET_EXTRA_ID(edge_target.x) != target ||
|
||||
edge_creation_time.x != creation_time
|
||||
@@ -258,14 +269,14 @@ static bool check_deleted_edge(
|
||||
}
|
||||
if (
|
||||
likely(ctx.err == 0) &&
|
||||
i == 1 && // this is the deleted edge
|
||||
i == 0 && // this is the deleted edge
|
||||
EGGSFS_GET_EXTRA_ID(edge_target.x) != 0
|
||||
) {
|
||||
good = false;
|
||||
}
|
||||
}
|
||||
eggsfs_snapshot_lookup_resp_get_end(&ctx, edges, end);
|
||||
eggsfs_snapshot_lookup_resp_get_finish(&ctx, end);
|
||||
eggsfs_full_read_dir_resp_get_end(&ctx, results_len, end);
|
||||
eggsfs_full_read_dir_resp_get_finish(&ctx, end);
|
||||
consume_skb(skb);
|
||||
if (ctx.err != 0) { return false; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user