-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Description
Existing problems for the current ClpIRCursor design
Complicated lifecycle of filteredLogEvents_
Currently, filteredLogEvents_ is defined as a std::shared_ptr<std::vector<std::unique_ptr<::clp::ffi::KeyValuePairLogEvent>>>, which allow four classes sharing the same pointer simultaneously, namely, ClpIRCursor, ClpIrUnitHandler, ClpIrJsonStringVectorLoader and ClpIrVectorLoader. These classes are literally the entire classes composing the IR search path.
ClpIRCursor creates an empty pointer, passes it to ClpIrUnitHandler for IR ffi to fill the content in. Then the result are moved towards ClpIrJsonStringVectorLoader and ClpIrVectorLoader, so that these two classes can reference the deserialized log events when constructing vector back to Velox.
This lifecycle is over-complicated as we can simply define a getFilteredLogEvents in ClpIrUnitHandler, and make a const reference for ClpIrJsonStringVectorLoader and ClpIrVectorLoader to read.