Skip to content

Refactor Plan for ClpIRCursor #50

@20001020ycx

Description

@20001020ycx

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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions