Skip to content

Commit

Permalink
add optional exptime in get reply; add flags in metaget request
Browse files Browse the repository at this point in the history
Summary:
Updating the protocol.
1. Add optional exptime in get reply to avoid needing to send metagets just for this.
2. Add flags in metaget request

Reviewed By: stuclar

Differential Revision: D64145437

fbshipit-source-id: 844b98fd3d4e3902447ba9cf471312f3280be094
  • Loading branch information
Lenar Fatikhov authored and facebook-github-bot committed Oct 10, 2024
1 parent 86e67bb commit e7b25d3
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mcrouter/lib/network/Memcache.idl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ reply McGetReply with 1: MemcacheReplyCommon {
3: uint64_t flags;
4: std::string message;
5: int16_t appSpecificErrorCode;
6: optional int32_t exptime;
};

request McSetRequest with 1: MemcacheRequestCommon {
Expand Down Expand Up @@ -127,6 +128,7 @@ reply McLeaseGetReply with 1: MemcacheReplyCommon {
4: uint64_t flags;
5: std::string message;
6: int16_t appSpecificErrorCode;
7: optional int32_t exptime;
};

request McLeaseSetRequest with 1: MemcacheRequestCommon {
Expand Down Expand Up @@ -298,6 +300,7 @@ request McMetagetRequest with 1: MemcacheRequestCommon {
reply: McMetagetReply;

1: carbon::Keys<folly::IOBuf> key;
2: uint64_t flags;
};

reply McMetagetReply with 1: MemcacheReplyCommon {
Expand Down
3 changes: 3 additions & 0 deletions mcrouter/lib/network/gen/Memcache.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ struct McGetReply {
3: i64_8073 flags
4: string message
5: i16 appSpecificErrorCode
6: optional i32 exptime
}(cpp.methods = "
template <class V>
void visitFields(V&& v);
Expand Down Expand Up @@ -202,6 +203,7 @@ struct McLeaseGetReply {
4: i64_8073 flags
5: string message
6: i16 appSpecificErrorCode
7: optional i32 exptime
}(cpp.methods = "
template <class V>
void visitFields(V&& v);
Expand Down Expand Up @@ -493,6 +495,7 @@ cpp.virtual
struct McMetagetRequest {
-1: MemcacheRequestCommon memcacheRequestCommon (cpp.mixin)
1: carbon.IOBufKey key
2: i64_8073 flags
}(cpp.methods = "
template <class V>
void visitFields(V&& v);
Expand Down
21 changes: 21 additions & 0 deletions mcrouter/lib/network/gen/MemcacheMessages-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ void McGetReply::serialize(Writer&& writer) const {
writer.writeField(3 /* field id */, flags_ref());
writer.writeField(4 /* field id */, message_ref());
writer.writeField(5 /* field id */, appSpecificErrorCode_ref());
writer.writeField(6 /* field id */, exptime_ref());
writer.writeFieldStop();
writer.writeStructEnd();
}
Expand Down Expand Up @@ -174,6 +175,9 @@ void McGetReply::visitFields(V&& v) {
if (!v.visitField(5, "appSpecificErrorCode", *this->appSpecificErrorCode_ref())) {
return;
}
if (!v.visitField(6, "exptime", this->exptime_ref())) {
return;
}
}

template <class V>
Expand All @@ -199,6 +203,9 @@ void McGetReply::visitFields(V&& v) const {
if (!v.visitField(5, "appSpecificErrorCode", *this->appSpecificErrorCode_ref())) {
return;
}
if (!v.visitField(6, "exptime", this->exptime_ref())) {
return;
}
}

template <class Writer>
Expand Down Expand Up @@ -498,6 +505,7 @@ void McLeaseGetReply::serialize(Writer&& writer) const {
writer.writeField(4 /* field id */, flags_ref());
writer.writeField(5 /* field id */, message_ref());
writer.writeField(6 /* field id */, appSpecificErrorCode_ref());
writer.writeField(7 /* field id */, exptime_ref());
writer.writeFieldStop();
writer.writeStructEnd();
}
Expand Down Expand Up @@ -528,6 +536,9 @@ void McLeaseGetReply::visitFields(V&& v) {
if (!v.visitField(6, "appSpecificErrorCode", *this->appSpecificErrorCode_ref())) {
return;
}
if (!v.visitField(7, "exptime", this->exptime_ref())) {
return;
}
}

template <class V>
Expand Down Expand Up @@ -556,6 +567,9 @@ void McLeaseGetReply::visitFields(V&& v) const {
if (!v.visitField(6, "appSpecificErrorCode", *this->appSpecificErrorCode_ref())) {
return;
}
if (!v.visitField(7, "exptime", this->exptime_ref())) {
return;
}
}

template <class Writer>
Expand Down Expand Up @@ -1305,6 +1319,7 @@ void McMetagetRequest::serialize(Writer&& writer) const {
writer.writeStructBegin();
writer.writeField(-1 /* field id */, memcacheRequestCommon_ref());
writer.writeField(1 /* field id */, key_ref());
writer.writeField(2 /* field id */, flags_ref());
writer.writeFieldStop();
writer.writeStructEnd();
}
Expand All @@ -1320,6 +1335,9 @@ void McMetagetRequest::visitFields(V&& v) {
if (!v.visitField(1, "key", *this->key_ref())) {
return;
}
if (!v.visitField(2, "flags", *this->flags_ref())) {
return;
}
}

template <class V>
Expand All @@ -1333,6 +1351,9 @@ void McMetagetRequest::visitFields(V&& v) const {
if (!v.visitField(1, "key", *this->key_ref())) {
return;
}
if (!v.visitField(2, "flags", *this->flags_ref())) {
return;
}
}

template <class Writer>
Expand Down
12 changes: 12 additions & 0 deletions mcrouter/lib/network/gen/MemcacheMessagesThrift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ void McGetReply::deserialize(carbon::CarbonProtocolReader& reader) {
reader.readField(appSpecificErrorCode_ref(), fieldType);
break;
}
case 6: {
reader.readField(exptime_ref(), fieldType);
break;
}
default: {
reader.skip(fieldType);
break;
Expand Down Expand Up @@ -417,6 +421,10 @@ void McLeaseGetReply::deserialize(carbon::CarbonProtocolReader& reader) {
reader.readField(appSpecificErrorCode_ref(), fieldType);
break;
}
case 7: {
reader.readField(exptime_ref(), fieldType);
break;
}
default: {
reader.skip(fieldType);
break;
Expand Down Expand Up @@ -996,6 +1004,10 @@ void McMetagetRequest::deserialize(carbon::CarbonProtocolReader& reader) {
reader.readField(key_ref(), fieldType);
break;
}
case 2: {
reader.readField(flags_ref(), fieldType);
break;
}
default: {
reader.skip(fieldType);
break;
Expand Down

0 comments on commit e7b25d3

Please sign in to comment.