Skip to content

Commit

Permalink
Serialize ARRAY attributes with thrif type using thrift compact seria…
Browse files Browse the repository at this point in the history
…lizer

Summary:
As described in https://docs.google.com/document/d/1mJPBYrpUkAy2AeRCvQwEK0tS3tehswMsfsAyo4CKI9k/edit, this diff does the following.

IF there is a thrift structure and the IGNORE bit is not set, it will use the NEW thrift serialization flow.

Otherwise, it will use the old JSON serialize flow.

Reviewed By: rushidesai

Differential Revision: D62657548

fbshipit-source-id: f3948705c22f9193d68c33f6c2b3200356b4a5ee
  • Loading branch information
Gordon Huang authored and facebook-github-bot committed Sep 20, 2024
1 parent b6fc704 commit 1776cd1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hphp/runtime/ext/fb/VariantController.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ struct VariantControllerImpl {
map.setIntishCast(idx, k, std::move(v));
}
static int64_t mapSize(const MapType& map) { return map.size(); }
static int64_t mapSize(const_variant_ref map) { return map.toArray().size(); }
static ArrayIter mapIterator(const MapType& map) {
return ArrayIter(map);
}
Expand All @@ -272,6 +273,9 @@ struct VariantControllerImpl {
}
static int64_t vectorSize(const VectorType& vec) {
return vec.size();
}
static int64_t vectorSize(const_variant_ref vec) {
return vec.toArray().size();
}
static void vectorAppend(VectorType& vec, const VariantType& v) {
if constexpr (HackArraysMode == VariantControllerHackArraysMode::OFF) {
Expand Down

0 comments on commit 1776cd1

Please sign in to comment.