Skip to content

Commit

Permalink
Integrate the mongo stitcher with the upstream map stitching interface (
Browse files Browse the repository at this point in the history
#1763)

Summary: This PR integrates the mongo stitcher with the new upstream
stitching interface using a map of `streamID` and deque of frames.

Related issues: #640

Type of change: /kind feature

Test Plan: Tested these changes with the upcoming BPF test.

Signed-off-by: Kartik Pattaswamy <[email protected]>
  • Loading branch information
kpattaswamy authored Nov 9, 2023
1 parent 0648947 commit accb1dd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ size_t FindFrameBoundary<mongodb::Frame>(message_type_t, std::string_view, size_
return std::string::npos;
}

template <>
mongodb::stream_id_t GetStreamID(mongodb::Frame* frame) {
if (frame->response_to == 0) {
return frame->request_id;
}

return frame->response_to;
}

} // namespace protocols
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ template <>
size_t FindFrameBoundary<mongodb::Frame>(message_type_t type, std::string_view buf,
size_t start_pos, NoState*);

template <>
mongodb::stream_id_t GetStreamID(mongodb::Frame* frame);

} // namespace protocols
} // namespace stirling
} // namespace px
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ struct ProtocolTraits : public BaseProtocolTraits<Record> {
using record_type = Record;
using state_type = StateWrapper;
using key_type = stream_id_t;
static constexpr StreamSupport stream_support = BaseProtocolTraits<Record>::UseStream;
};

} // namespace mongodb
Expand Down

0 comments on commit accb1dd

Please sign in to comment.