Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
f2dc0d7
update gcc to 14.2.0
cherep58 Mar 23, 2026
76f1d93
update clang-tidy to 21.1.8
cherep58 Mar 23, 2026
5109b0b
added clang-tidy bugprone-* diagnostics
cherep58 Mar 24, 2026
685fe57
changed logic of IntervalDecodeIterator
cherep58 Dec 3, 2025
4bae01e
added downsamplingMs parameter into Go-bindings
cherep58 Dec 3, 2025
b41272d
added GO-test for downsampling
cherep58 Dec 4, 2025
e1876b3
optimized IntervalDecodeIterator
cherep58 Dec 4, 2025
2ab9506
renamed IntervalDecodeIterator to DownsamplingDecodeIterator
cherep58 Dec 5, 2025
1a52eb2
optimized DownsamplingDecodeIterator
cherep58 Dec 5, 2025
8e75529
review fixes
cherep58 Dec 5, 2025
3802273
review fixes
cherep58 Dec 8, 2025
518e1f8
added downsampling feature in ChunkRecoder
cherep58 Jan 13, 2026
947e996
fixed compilation error
cherep58 Jan 13, 2026
d168fa5
added SelectHints to Go-binding
cherep58 Jan 27, 2026
eb872f1
refactored DownsamplingDecodeIterator
cherep58 Jan 27, 2026
6d46395
created DecodeIterator for Go-bindings
cherep58 Jan 28, 2026
17c94f8
created MinOverTimeIterator
cherep58 Jan 28, 2026
7768c98
created MaxOverTimeIterator
cherep58 Jan 29, 2026
17020f2
created LastOverTimeIterator
cherep58 Jan 29, 2026
7a1d865
created SumOverTimeIterator
cherep58 Jan 29, 2026
93bb6df
refactored over_time_func iterators
cherep58 Jan 29, 2026
3ec6f5c
removed test metrics
cherep58 Jan 30, 2026
70185e9
reformatted
cherep58 Jan 30, 2026
62335ca
removed invalid test case
cherep58 Jan 30, 2026
8a9d5e5
created DecodeIteratorTrait::seek_to method and used it in OverTimeFu…
cherep58 Feb 4, 2026
122cb6f
created RateIterator
cherep58 Feb 5, 2026
1962d02
created ChangesIterator
cherep58 Feb 5, 2026
e072ec6
created DeltaIterator
cherep58 Feb 5, 2026
b43e26f
added increase promql function handling
cherep58 Feb 6, 2026
afe8d8c
created IRateIterator
cherep58 Feb 6, 2026
858c5bd
added idelta promql function handling
cherep58 Feb 6, 2026
c4ad46d
created ResetsIterator
cherep58 Feb 6, 2026
dc84a0e
renamed struct
cherep58 Feb 6, 2026
f4deb6d
created create_decode_iterator method
cherep58 Feb 6, 2026
23e4acb
created perfect hash for promql functions names by gperf tool
cherep58 Feb 9, 2026
6f52537
Merge branch 'pp' of https://github.com/deckhouse/prompp into gcc-14_…
cherep58 Mar 24, 2026
e2a8137
added metrics folder to clang-tidy check
cherep58 Mar 24, 2026
5786af1
fixes after merge
cherep58 Mar 24, 2026
16adb02
commit for test pipeline
cherep58 Mar 25, 2026
de3ec10
added promql op_* functions
cherep58 Mar 25, 2026
a62d90b
Separate CI image for tests
scaps1 Mar 25, 2026
3e69466
fix queue
scaps1 Mar 25, 2026
5da2345
Merge branch 'pp' of https://github.com/deckhouse/prompp into gcc-14_…
cherep58 Mar 25, 2026
8fe83d2
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Mar 25, 2026
7415dd7
Merge branch 'gcc-14_clang-tidy-20' of https://github.com/deckhouse/p…
cherep58 Mar 25, 2026
3c36392
fixed compilation error
cherep58 Mar 25, 2026
5b02ce4
Merge branch 'gcc-14_clang-tidy-20' of https://github.com/deckhouse/p…
cherep58 Mar 25, 2026
53fe19c
review fixes
cherep58 Mar 26, 2026
0176863
added function name validation before aggregate iterator creation
cherep58 Mar 30, 2026
9013b8e
created WindowFunctionIterator
cherep58 Apr 1, 2026
fcb0f3e
wrap iterators into WindowFunctionIterator
cherep58 Apr 2, 2026
0a12532
created WindowFunctionParameters
cherep58 Apr 2, 2026
f09ddd4
renamed parameters in WindowFunctionParameters
cherep58 Apr 2, 2026
86667b8
removed std::visit for sample getter in UniversalDecodeIterator
cherep58 Apr 3, 2026
a2f96e2
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Apr 3, 2026
7c33eef
created WindowFunction enum
cherep58 Apr 3, 2026
5163bcc
fixed clang-tidy warnings
cherep58 Apr 3, 2026
07af82c
fixed golint error
cherep58 Apr 3, 2026
aa756c5
fixed gcc false-positive warning
cherep58 Apr 6, 2026
5eaa9bb
Merge branch 'pp' into promql_cpp
cherep58 Apr 8, 2026
9ddb76a
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Apr 14, 2026
44d0566
added continue after reset iterator unit test for WindowFunctionIterator
cherep58 Apr 15, 2026
85c4275
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Apr 15, 2026
7d3ee73
fixed clang-tidy warning
cherep58 Apr 15, 2026
cf2ce92
changed logic of SumOfElements
cherep58 Apr 15, 2026
eaf1362
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Apr 29, 2026
a69c5f2
refactoring after merge
cherep58 Apr 29, 2026
ad613ac
created benchmark ChunkRecoderWithDownsampling
cherep58 Apr 29, 2026
803a812
removed ChunkRecoder test from performance tests
cherep58 Apr 29, 2026
1d197de
fixed clang-tidy warnings
cherep58 Apr 29, 2026
dd7ea66
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Apr 30, 2026
9d811ca
review fixes
cherep58 May 5, 2026
d658a41
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 5, 2026
8bf47cf
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 7, 2026
19cdeaf
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 8, 2026
e0e7918
fixed bug in WindowFunctionIterator when range == 0 in
cherep58 May 8, 2026
f221c24
created SumOverTimeWindowFunctionIterator unit test fixture
cherep58 May 8, 2026
b95074b
created WindowBoundaryCalculator
cherep58 May 13, 2026
1b7b7bd
added unit test for PR comment
cherep58 May 13, 2026
36d3d19
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 13, 2026
fbed79d
fixed tests
cherep58 May 13, 2026
0ba94d4
added unit tests for WindowBoundaryCalculator
cherep58 May 13, 2026
64128c2
fixed build and unit tests in Go
cherep58 May 13, 2026
3aa7288
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 13, 2026
7a9e7c6
created CountOverTimeIterator
cherep58 May 13, 2026
0e420a4
added hints nullptr validation
cherep58 May 13, 2026
2de5782
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 13, 2026
8b513a0
fixed golangci-lint error
cherep58 May 13, 2026
f26932c
fixed bug with empty windows in constant decoders
cherep58 May 14, 2026
467666d
fixed formatting
cherep58 May 14, 2026
6a55187
refactoring
cherep58 May 14, 2026
31aa19a
WIP: add to engine last_over_step
u-veles-a May 15, 2026
9511677
changed logic for ts calculation in CountOverTimeIterator and SumOver…
cherep58 May 15, 2026
5992c11
created LastOverStepIterator
cherep58 May 15, 2026
27a00bf
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 15, 2026
3cc0d51
WIP: add switchFuncOptimize
u-veles-a May 18, 2026
8e44ace
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 18, 2026
44956c4
WIP: clear
u-veles-a May 18, 2026
2a548b4
created WindowBoundaryCalculatorInterface
cherep58 May 18, 2026
c0137be
Merge branch 'promql_cpp' of https://github.com/deckhouse/prompp into…
cherep58 May 18, 2026
42d9150
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 18, 2026
843d019
WIP: rebuld select_func_optimization
u-veles-a May 18, 2026
bb76469
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 18, 2026
88ccf21
changed logic of IRateIterator
cherep58 May 19, 2026
e6bf265
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 19, 2026
da9a075
changed iterator logic due to changes in the logic of calculating win…
cherep58 May 20, 2026
9ccd8da
WIP: add to hints LookbackDelta
u-veles-a May 20, 2026
5159c5c
used StepLookbackDeltaWindowCalculator in LastOverStepIterator
cherep58 May 20, 2026
a3875aa
optimized CountOverTime and SumOwerTime functions
cherep58 May 20, 2026
18d8fa4
added unit tests for StepLookbackDeltaWindowCalculatorFixture
cherep58 May 20, 2026
4d4696c
created prompp_get_promql_optimized_functions go-binding
cherep58 May 20, 2026
e7d3ac5
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 20, 2026
70cc43c
changed last_over_step function type
cherep58 May 20, 2026
c8295e7
removed kCrossSeriesThinning function type
cherep58 May 21, 2026
41a961f
WIP: small fix
u-veles-a May 21, 2026
7b2a3d3
fixed clang-tidy warning
cherep58 May 21, 2026
1319ff9
Merge branch 'promql_cpp' of https://github.com/deckhouse/prompp into…
cherep58 May 21, 2026
0cc1312
fixed clang-tidy warning
cherep58 May 21, 2026
11df812
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 22, 2026
a3e0df1
removed CountOverTimeIterator
cherep58 May 22, 2026
0f6bea1
WIP: add test QuerierOptimize
u-veles-a May 22, 2026
b4ce45b
changed decorators hierarchy WindowFunctionIterator -> FunctionIterat…
cherep58 May 22, 2026
7eda51a
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 22, 2026
edf64cb
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 22, 2026
1ca2a57
fixed bug in RateIterator
cherep58 May 25, 2026
c2d7532
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 25, 2026
e2b2c6c
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 25, 2026
6f027c0
fixed bug in ChangesIterator
cherep58 May 25, 2026
b8c68d7
added bit validation in BareBones::build_bitmask
cherep58 May 25, 2026
e457c46
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 25, 2026
5a0ba84
WIP: add test
u-veles-a May 26, 2026
deb7f47
WIP: fix subquery
u-veles-a May 26, 2026
d6ea92f
disabled non tested optimized promql functions
cherep58 May 26, 2026
9cb357c
fixed resets promql iterator
cherep58 May 26, 2026
33e6cbe
disabled resets promql function
cherep58 May 26, 2026
9d855fb
WIP: fix test
u-veles-a May 26, 2026
a322041
WIP: fix test SwitchFuncOptimizeSuite
u-veles-a May 27, 2026
7687760
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 27, 2026
b60c266
WIP: tuning asan test
u-veles-a May 28, 2026
1dca964
Merge branch 'pp' into promql_cpp
u-veles-a May 28, 2026
922212e
added kExtrapolatedRate promql function type
cherep58 May 28, 2026
c90937d
WIP: fix nil hints
u-veles-a May 29, 2026
9692813
WIP: fix test LookbackDelta
u-veles-a May 29, 2026
5bf357e
fixed bug in SumOfElements
cherep58 May 29, 2026
fef8263
Merge branch 'promql_cpp' of github.com:deckhouse/prompp into promql_cpp
u-veles-a May 29, 2026
f9d5345
WIP: rebuild subquery flag, fix test
u-veles-a May 29, 2026
aec2f69
WIP: fix test SwitchFuncOptimizeSuite
u-veles-a May 29, 2026
ef20f56
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 May 29, 2026
f32f3cf
WIP: tuning asan test
u-veles-a May 30, 2026
0e7268f
created DecodeIteratorData
cherep58 Jun 1, 2026
e85d239
created DecodeIteratorDataWithTimestampDecoder
cherep58 Jun 1, 2026
bd4694c
Merge branch 'pp' of https://github.com/deckhouse/prompp into promql_cpp
cherep58 Jun 2, 2026
5aced52
created DecodeIteratorData for any DecodeIterator
cherep58 Jun 2, 2026
1c148ab
fixed SeriesSet benchmark
cherep58 Jun 2, 2026
b410ac0
fixed clang-tidy error
cherep58 Jun 2, 2026
a5ae59f
Merge branch 'pp' of https://github.com/deckhouse/prompp into decode_…
cherep58 Jun 2, 2026
622b4a2
optimized TwoDoubleConstantDecodeIterator
cherep58 Jun 2, 2026
475be55
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 2, 2026
547ccbd
reverted TwoDoubleConstantDecodeIterator size optimization
cherep58 Jun 2, 2026
00b3815
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 2, 2026
d9dcbff
optimized default decode iterator creation
cherep58 Jun 2, 2026
cbb168a
reduced SeriesIterator sizeof
cherep58 Jun 2, 2026
9d4178e
simplified SeriesIterator
cherep58 Jun 2, 2026
054f8ff
Merge branch 'promql_cpp' of https://github.com/deckhouse/prompp into…
cherep58 Jun 2, 2026
5adb45a
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 2, 2026
e3733fe
created UniversalDecodeIterator::visit method
cherep58 Jun 2, 2026
e392899
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 2, 2026
44dec5b
moved common methods into DecodeIteratorTrait
cherep58 Jun 3, 2026
68e08f3
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 3, 2026
852cabf
optimized ChunkIterator::Next
cherep58 Jun 4, 2026
90af587
optimized UniversalDecodeIterator
cherep58 Jun 4, 2026
15d9b3b
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 4, 2026
d1be9ab
created AggregationIterator bindings
cherep58 Jun 5, 2026
17edc27
rewritten AggregationIterator from std::varint to union
cherep58 Jun 5, 2026
97a8707
fixed return type for UniversalDecodeIterator::visit
cherep58 Jun 5, 2026
537566b
Merge branch 'pp' of https://github.com/deckhouse/prompp into decode_…
cherep58 Jun 5, 2026
e393cf3
created SeriesIterator::seek_to method
cherep58 Jun 5, 2026
8a6e856
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 5, 2026
cc320dd
add aggr_series_set
u-veles-a Jun 5, 2026
1362221
removed prompp_series_data_serialization_serialized_data_aggregation_…
cherep58 Jun 5, 2026
d43b892
fix test
u-veles-a Jun 5, 2026
9894165
Merge branch 'promql_cpp' of https://github.com/deckhouse/prompp into…
cherep58 Jun 5, 2026
bf6f643
fixed return type in visit method
cherep58 Jun 8, 2026
e22e311
Merge branch 'decode_iterator_size_optimizing' of https://github.com/…
cherep58 Jun 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions cmd/prometheus/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,20 @@ func readPromPPFeatures(logger log.Logger) {
case "shrink_shard_copier":
pp_storage.ShrinkShardCopier = true
_ = level.Info(logger).Log("msg", "[FEATURE] Shrink shard copier is enabled.")

case "select_func_optimization":
if err := querier.SetSelectFuncOptimize(strings.TrimSpace(fvalue)); err != nil {
level.Error(logger).Log(
"msg", "[FEATURE] Error parsing select_func_optimization value",
"err", err,
)
continue
}

level.Info(logger).Log(
"msg", "[FEATURE] Select function optimization is set.",
"optimization", fvalue,
)
}
}
}
9 changes: 8 additions & 1 deletion pp-pkg/storage/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,14 @@ func (ar *Adapter) Querier(mint, maxt int64) (storage.Querier, error) {

queriers = append(
queriers,
querier.NewQuerier(head, querier.NewNoOpShardedDeduplicator, mint, maxt, nil, ar.storageQuerierMetrics),
querier.NewQuerierWithOutSelectFuncOptimize(
head,
querier.NewNoOpShardedDeduplicator,
mint,
maxt,
nil,
ar.storageQuerierMetrics,
),
)
}

Expand Down
4 changes: 2 additions & 2 deletions pp-pkg/storage/batch_storage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ import (
"github.com/jonboulle/clockwork"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/prometheus/pp/go/storage/storagetest"
"github.com/prometheus/prometheus/storage"
"github.com/stretchr/testify/suite"

"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/pp/go/cppbridge"
pp_model "github.com/prometheus/prometheus/pp/go/model"
pp_storage "github.com/prometheus/prometheus/pp/go/storage"
"github.com/prometheus/prometheus/pp/go/storage/catalog"
"github.com/prometheus/prometheus/storage"
)

const (
Expand Down Expand Up @@ -202,7 +202,7 @@ func (s *BatchStorageSuite) TestCommit_WithSamplesAdded() {
StartTimestampMs: 0,
EndTimestampMs: 5000,
LabelSetIDs: []uint32{0},
})
}, cppbridge.NoDownsampling, &storage.SelectHints{})
s.Require().Equal(cppbridge.DataStorageQueryStatusSuccess, queryResult.Status)
s.Equal(storagetest.SamplesMap{
0: []cppbridge.Sample{
Expand Down
7 changes: 7 additions & 0 deletions pp/bare_bones/algorithm.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <bit>
#include <utility>

namespace BareBones {
Expand All @@ -20,6 +21,12 @@ constexpr bool is_in(const Value& value, Args&&... args) {
return (... || (value == std::forward<Args>(args)));
}

template <class ResultType, auto... Values>
constexpr ResultType build_bitmask() {
static_assert((... && std::has_single_bit(static_cast<ResultType>(Values))), "each bitmask value must be a power of two");
return (... | static_cast<ResultType>(Values));
}

template <class Range1, class Range2, class Comparator>
auto lexicographical_compare_three_way(const Range1& range1, const Range2& range2, Comparator&& comparator) {
using result_type = decltype(comparator(*range1.begin(), *range2.begin()));
Expand Down
31 changes: 31 additions & 0 deletions pp/entrypoint/aggregation_iterator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "aggregation_iterator.h"

#include "series_data/serialization.h"

extern "C" void prompp_series_data_serialization_serialized_data_aggregation_iterator_ctor(void* args) {
struct Arguments {
entrypoint::series_data::AggregationIterator* iterator;
entrypoint::series_data::SerializedDataPtr serialized_data;
uint32_t chunk_ref;
};

const auto in = static_cast<Arguments*>(args);
std::construct_at(in->iterator, in->serialized_data->aggregation_iterator(in->chunk_ref));
}

extern "C" void prompp_series_data_serialization_serialized_data_aggregation_iterator_next(void* iterator) {
using series_data::decoder::DecodeIteratorSentinel;

++(*static_cast<entrypoint::series_data::AggregationIterator*>(iterator));
}

extern "C" void prompp_series_data_serialization_serialized_data_aggregation_iterator_reset(void* args) {
struct Arguments {
entrypoint::series_data::AggregationIterator* iterator;
entrypoint::series_data::SerializedDataPtr serialized_data;
uint32_t chunk_ref;
};

const Arguments* in = static_cast<Arguments*>(args);
*in->iterator = in->serialized_data->aggregation_iterator(in->chunk_ref);
}
38 changes: 38 additions & 0 deletions pp/entrypoint/aggregation_iterator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Create a aggregation iterator for corresponding chunk_ref.
*
* @param args {
* serializedData uintptr // pointer to serialized data.
* chunk_ref uint32 // inner chunk id.
* }
*
*/
void prompp_series_data_serialization_serialized_data_aggregation_iterator_ctor(void* args);

/**
* @brief Advance aggregation iterator.
*
* @param iterator uintptr // pointer to aggregation iterator
*
*/
void prompp_series_data_serialization_serialized_data_aggregation_iterator_next(void* iterator);

/**
* @brief Reset a aggregation iterator for corresponding chunk_ref.
*
* @param args {
* serializedData uintptr // pointer to serialized data.
* iterator uintptr // pointer to aggregation iterator
* chunkRef uint32 // inner chunk id.
* }
*
*/
void prompp_series_data_serialization_serialized_data_aggregation_iterator_reset(void* args);

#ifdef __cplusplus
} // extern "C"
#endif
5 changes: 3 additions & 2 deletions pp/entrypoint/go_constants.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "go_constants.h"

#include "head/serialization.h"
#include "metrics/storage.h"
#include "prometheus/relabeler.h"
#include "series_data/serialization.h"
#include "wal/output_decoder.h"
#include "wal/segment_samples_storage.h"

Expand All @@ -14,7 +14,8 @@ static_assert(sizeof(roaring::Roaring) == Sizeof_RoaringBitset);

static_assert(sizeof(PromPP::Prometheus::Relabel::InnerSeries) == Sizeof_InnerSeries);

static_assert(sizeof(entrypoint::head::SerializedDataIterator) == Sizeof_SerializedDataIterator);
static_assert(sizeof(entrypoint::series_data::SamplesIterator) == Sizeof_SerializedDataSamplesIterator);
static_assert(sizeof(entrypoint::series_data::AggregationIterator) == Sizeof_SerializedDataAggregationIterator);

static_assert(sizeof(metrics::Storage::Iterator) == Sizeof_MetricsIterator);

Expand Down
3 changes: 2 additions & 1 deletion pp/entrypoint/go_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
#define Sizeof_InnerSeries (Sizeof_SizeT + Sizeof_BareBonesVector + Sizeof_RoaringBitset)
#define Sizeof_GoLabels 16

#define Sizeof_SerializedDataIterator 184
#define Sizeof_SerializedDataSamplesIterator 152
#define Sizeof_SerializedDataAggregationIterator 208

#define Sizeof_MetricsIterator 24

Expand Down
28 changes: 0 additions & 28 deletions pp/entrypoint/head/serialization.h

This file was deleted.

2 changes: 1 addition & 1 deletion pp/entrypoint/head_wal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#include "exception.hpp"
#include "hashdex.hpp"
#include "head/lss.h"
#include "head/series_data.h"
#include "primitives/go_slice.h"
#include "series_data/series_data.h"
#include "wal/decoder.h"
#include "wal/encoder.h"
#include "wal/wal.h"
Expand Down
43 changes: 43 additions & 0 deletions pp/entrypoint/samples_iterator.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#include "samples_iterator.h"

#include "series_data/serialization.h"

extern "C" void prompp_series_data_serialization_serialized_data_samples_iterator_ctor(void* args) {
struct Arguments {
entrypoint::series_data::SamplesIterator* iterator;
entrypoint::series_data::SerializedDataPtr serialized_data;
uint32_t chunk_ref;
};

const auto in = static_cast<Arguments*>(args);
std::construct_at(in->iterator, in->serialized_data->samples_iterator(in->chunk_ref));
}

extern "C" void prompp_series_data_serialization_serialized_data_samples_iterator_next(void* iterator) {
using series_data::decoder::DecodeIteratorSentinel;

++(*static_cast<entrypoint::series_data::SamplesIterator*>(iterator));
}

extern "C" void prompp_series_data_serialization_serialized_data_samples_iterator_seek(void* args) {
using series_data::decoder::DecodeIteratorSentinel;

struct Arguments {
entrypoint::series_data::SamplesIterator* iterator;
int64_t target_timestamp;
};

const Arguments* in = static_cast<Arguments*>(args);
in->iterator->seek_to(in->target_timestamp);
}

extern "C" void prompp_series_data_serialization_serialized_data_samples_iterator_reset(void* args) {
struct Arguments {
entrypoint::series_data::SamplesIterator* iterator;
entrypoint::series_data::SerializedDataPtr serialized_data;
uint32_t chunk_ref;
};

const Arguments* in = static_cast<Arguments*>(args);
*in->iterator = in->serialized_data->samples_iterator(in->chunk_ref);
}
49 changes: 49 additions & 0 deletions pp/entrypoint/samples_iterator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#ifdef __cplusplus
extern "C" {
#endif

/**
* @brief Create a samples iterator for corresponding chunk_ref.
*
* @param args {
* serializedData uintptr // pointer to serialized data.
* chunk_ref uint32 // inner chunk id.
* }
*
*/
void prompp_series_data_serialization_serialized_data_samples_iterator_ctor(void* args);

/**
* @brief Advance samples iterator.
*
* @param iterator uintptr // pointer to samples iterator
*
*/
void prompp_series_data_serialization_serialized_data_samples_iterator_next(void* iterator);

/**
* @brief Advance samples iterator until referenced sample is gte targetTimestamp.
*
* @param args {
* iterator uintptr // pointer to samples iterator
* targetTimestamp int64 // target timestamp
* }
*
*/
void prompp_series_data_serialization_serialized_data_samples_iterator_seek(void* args);

/**
* @brief Reset a samples iterator for corresponding chunk_ref.
*
* @param args {
* serializedData uintptr // pointer to serialized data.
* iterator uintptr // pointer to samples iterator
* chunkRef uint32 // inner chunk id.
* }
*
*/
void prompp_series_data_serialization_serialized_data_samples_iterator_reset(void* args);

#ifdef __cplusplus
} // extern "C"
#endif
Loading
Loading