| name | cpp-coding |
| description | Write or review Timeplus/Proton C++20 code covering naming conventions, Proton fences, clang-format, IProcessor patterns, and checkpointing. Make sure to use this skill for any C++ code changes, additions, or reviews in this codebase, including small fixes, new functions, refactoring, or style questions, even if the user doesn't explicitly mention coding conventions. |
C++ Coding
Language
C++20. Prefer standard library over custom implementations when appropriate.
Naming conventions
| Element | Style | Example |
|---|
| Functions | lowerCamelCase | processStreamData(), handleWindowClose() |
| Variables | lowercase_with_underscores | event_count, window_start |
| Classes | PascalCase | StorageStream, AggregatedDataVariants |
| Constants | PascalCase or UPPER_CASE | Per existing codebase convention |
| Namespaces | PascalCase | DB::Streaming |
Proton fences
if (isStreamingQuery()) { handleStreamingPath(); }
IProcessor pattern (streaming transforms)
All streaming transforms in src/Processors/Transforms/Streaming/ follow:
class MyTransform : public IProcessor {
Status prepare() override;
void work() override;
};
Stateful processors MUST also implement:
Formatting
Only formats changed code blocks (not entire files). Uses .clang-format config at repo root.
The configured brace style is Allman-like: opening braces normally go on a new line.
git clang-format
git clang-format --staged
git clang-format --diff
git clang-format <commit>
Comments
Use ///. Explain why, not what:
watermark_delay = 10;