diff --git a/pkg/bloombuild/planner/metrics.go b/pkg/bloombuild/planner/metrics.go index 347af1926617b..9eaf453b7853c 100644 --- a/pkg/bloombuild/planner/metrics.go +++ b/pkg/bloombuild/planner/metrics.go @@ -24,6 +24,7 @@ type Metrics struct { connectedBuilders prometheus.GaugeFunc queueDuration prometheus.Histogram inflightRequests prometheus.Summary + taskLost prometheus.Counter buildStarted prometheus.Counter buildCompleted *prometheus.CounterVec @@ -65,6 +66,12 @@ func NewMetrics( MaxAge: time.Minute, AgeBuckets: 6, }), + taskLost: promauto.With(r).NewCounter(prometheus.CounterOpts{ + Namespace: metricsNamespace, + Subsystem: metricsSubsystem, + Name: "tasks_lost_total", + Help: "Total number of tasks lost due to not being picked up by a builder and failed to be requeued.", + }), buildStarted: promauto.With(r).NewCounter(prometheus.CounterOpts{ Namespace: metricsNamespace, diff --git a/pkg/bloombuild/planner/planner.go b/pkg/bloombuild/planner/planner.go index 9a5b9f6dc238e..dfb6fea80cc3f 100644 --- a/pkg/bloombuild/planner/planner.go +++ b/pkg/bloombuild/planner/planner.go @@ -4,14 +4,17 @@ import ( "context" "fmt" "sort" + "sync" "time" "github.com/go-kit/log" "github.com/go-kit/log/level" "github.com/grafana/dskit/services" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" + "github.com/grafana/loki/v3/pkg/bloombuild/protos" "github.com/grafana/loki/v3/pkg/queue" "github.com/grafana/loki/v3/pkg/storage" v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" @@ -22,6 +25,8 @@ import ( utillog "github.com/grafana/loki/v3/pkg/util/log" ) +var errPlannerIsNotRunning = errors.New("planner is not running") + type Planner struct { services.Service // Subservices manager. @@ -38,6 +43,8 @@ type Planner struct { tasksQueue *queue.RequestQueue activeUsers *util.ActiveUsersCleanupService + pendingTasks sync.Map + metrics *Metrics logger log.Logger } @@ -92,13 +99,23 @@ func New( return p, nil } -func (p *Planner) starting(_ context.Context) (err error) { +func (p *Planner) starting(ctx context.Context) (err error) { + if err := services.StartManagerAndAwaitHealthy(ctx, p.subservices); err != nil { + return fmt.Errorf("error starting planner subservices: %w", err) + } + p.metrics.running.Set(1) - return err + return nil } func (p *Planner) stopping(_ error) error { - p.metrics.running.Set(0) + defer p.metrics.running.Set(0) + + // This will also stop the requests queue, which stop accepting new requests and errors out any pending requests. + if err := services.StopManagerAndAwaitStopped(context.Background(), p.subservices); err != nil { + return fmt.Errorf("error stopping planner subservices: %w", err) + } + return nil } @@ -108,20 +125,32 @@ func (p *Planner) running(ctx context.Context) error { level.Error(p.logger).Log("msg", "bloom build iteration failed for the first time", "err", err) } - ticker := time.NewTicker(p.cfg.PlanningInterval) - defer ticker.Stop() + planningTicker := time.NewTicker(p.cfg.PlanningInterval) + defer planningTicker.Stop() + + inflightTasksTicker := time.NewTicker(250 * time.Millisecond) + defer inflightTasksTicker.Stop() + for { select { case <-ctx.Done(): - err := ctx.Err() - level.Debug(p.logger).Log("msg", "planner context done", "err", err) - return err + if err := ctx.Err(); !errors.Is(err, context.Canceled) { + level.Error(p.logger).Log("msg", "planner context done with error", "err", err) + return err + } - case <-ticker.C: + level.Debug(p.logger).Log("msg", "planner context done") + return nil + + case <-planningTicker.C: level.Info(p.logger).Log("msg", "starting bloom build iteration") if err := p.runOne(ctx); err != nil { level.Error(p.logger).Log("msg", "bloom build iteration failed", "err", err) } + + case <-inflightTasksTicker.C: + inflight := p.totalPendingTasks() + p.metrics.inflightRequests.Observe(float64(inflight)) } } } @@ -159,19 +188,13 @@ func (p *Planner) runOne(ctx context.Context) error { now := time.Now() for _, gap := range gaps { totalTasks++ - task := Task{ - table: w.table.Addr(), - tenant: w.tenant, - OwnershipBounds: w.ownershipRange, - tsdb: gap.tsdb, - gaps: gap.gaps, - - queueTime: now, - ctx: ctx, - } - p.activeUsers.UpdateUserTimestamp(task.tenant, now) - if err := p.tasksQueue.Enqueue(task.tenant, nil, task, nil); err != nil { + task := NewTask( + ctx, now, + protos.NewTask(w.table.Addr(), w.tenant, w.ownershipRange, gap.tsdb, gap.gaps), + ) + + if err := p.enqueueTask(task); err != nil { level.Error(logger).Log("msg", "error enqueuing task", "err", err) continue } @@ -326,7 +349,7 @@ func (p *Planner) findGapsForBounds( // This is a performance optimization to avoid expensive re-reindexing type blockPlan struct { tsdb tsdb.SingleTenantTSDBIdentifier - gaps []GapWithBlocks + gaps []protos.GapWithBlocks } func (p *Planner) findOutdatedGaps( @@ -420,12 +443,12 @@ func blockPlansForGaps(tsdbs []tsdbGaps, metas []bloomshipper.Meta) ([]blockPlan for _, idx := range tsdbs { plan := blockPlan{ tsdb: idx.tsdb, - gaps: make([]GapWithBlocks, 0, len(idx.gaps)), + gaps: make([]protos.GapWithBlocks, 0, len(idx.gaps)), } for _, gap := range idx.gaps { - planGap := GapWithBlocks{ - bounds: gap, + planGap := protos.GapWithBlocks{ + Bounds: gap, } for _, meta := range metas { @@ -442,18 +465,18 @@ func blockPlansForGaps(tsdbs []tsdbGaps, metas []bloomshipper.Meta) ([]blockPlan } // this block overlaps the gap, add it to the plan // for this gap - planGap.blocks = append(planGap.blocks, block) + planGap.Blocks = append(planGap.Blocks, block) } } // ensure we sort blocks so deduping iterator works as expected - sort.Slice(planGap.blocks, func(i, j int) bool { - return planGap.blocks[i].Bounds.Less(planGap.blocks[j].Bounds) + sort.Slice(planGap.Blocks, func(i, j int) bool { + return planGap.Blocks[i].Bounds.Less(planGap.Blocks[j].Bounds) }) peekingBlocks := v1.NewPeekingIter[bloomshipper.BlockRef]( v1.NewSliceIter[bloomshipper.BlockRef]( - planGap.blocks, + planGap.Blocks, ), ) // dedupe blocks which could be in multiple metas @@ -472,7 +495,7 @@ func blockPlansForGaps(tsdbs []tsdbGaps, metas []bloomshipper.Meta) ([]blockPlan if err != nil { return nil, fmt.Errorf("failed to dedupe blocks: %w", err) } - planGap.blocks = deduped + planGap.Blocks = deduped plan.gaps = append(plan.gaps, planGap) } @@ -482,3 +505,114 @@ func blockPlansForGaps(tsdbs []tsdbGaps, metas []bloomshipper.Meta) ([]blockPlan return plans, nil } + +func (p *Planner) addPendingTask(task *Task) { + p.pendingTasks.Store(task.ID, task) +} + +func (p *Planner) removePendingTask(task *Task) { + p.pendingTasks.Delete(task.ID) +} + +func (p *Planner) totalPendingTasks() (total int) { + p.pendingTasks.Range(func(_, _ interface{}) bool { + total++ + return true + }) + return total +} + +func (p *Planner) enqueueTask(task *Task) error { + p.activeUsers.UpdateUserTimestamp(task.Tenant, time.Now()) + return p.tasksQueue.Enqueue(task.Tenant, nil, task, func() { + p.addPendingTask(task) + }) +} + +func (p *Planner) NotifyBuilderShutdown( + _ context.Context, + req *protos.NotifyBuilderShutdownRequest, +) (*protos.NotifyBuilderShutdownResponse, error) { + level.Debug(p.logger).Log("msg", "builder shutdown", "builder", req.BuilderID) + p.tasksQueue.UnregisterConsumerConnection(req.GetBuilderID()) + + return &protos.NotifyBuilderShutdownResponse{}, nil +} + +func (p *Planner) BuilderLoop(builder protos.PlannerForBuilder_BuilderLoopServer) error { + resp, err := builder.Recv() + if err != nil { + return fmt.Errorf("error receiving message from builder: %w", err) + } + + builderID := resp.GetBuilderID() + logger := log.With(p.logger, "builder", builderID) + level.Debug(logger).Log("msg", "builder connected") + + p.tasksQueue.RegisterConsumerConnection(builderID) + defer p.tasksQueue.UnregisterConsumerConnection(builderID) + + lastIndex := queue.StartIndex + for p.isRunningOrStopping() { + item, idx, err := p.tasksQueue.Dequeue(builder.Context(), lastIndex, builderID) + if err != nil { + return fmt.Errorf("error dequeuing task: %w", err) + } + lastIndex = idx + + if item == nil { + + return fmt.Errorf("dequeue() call resulted in nil response. builder: %s", builderID) + } + task := item.(*Task) + + queueTime := time.Since(task.queueTime) + p.metrics.queueDuration.Observe(queueTime.Seconds()) + + if task.ctx.Err() != nil { + level.Warn(logger).Log("msg", "task context done after dequeue", "err", task.ctx.Err()) + lastIndex = lastIndex.ReuseLastIndex() + p.removePendingTask(task) + continue + } + + if err := p.forwardTaskToBuilder(builder, builderID, task); err != nil { + // Re-queue the task if the builder is failing to process the tasks + if err := p.enqueueTask(task); err != nil { + p.metrics.taskLost.Inc() + level.Error(logger).Log("msg", "error re-enqueuing task. this task will be lost", "err", err) + } + + return fmt.Errorf("error forwarding task to builder (%s). Task requeued: %w", builderID, err) + } + + } + + return errPlannerIsNotRunning +} + +func (p *Planner) forwardTaskToBuilder( + builder protos.PlannerForBuilder_BuilderLoopServer, + builderID string, + task *Task, +) error { + defer p.removePendingTask(task) + + msg := &protos.PlannerToBuilder{ + Task: task.ToProtoTask(), + } + + if err := builder.Send(msg); err != nil { + return fmt.Errorf("error sending task to builder (%s): %w", builderID, err) + } + + // TODO(salvacorts): Implement timeout and retry for builder response. + _, err := builder.Recv() + + return err +} + +func (p *Planner) isRunningOrStopping() bool { + st := p.State() + return st == services.Running || st == services.Stopping +} diff --git a/pkg/bloombuild/planner/planner_test.go b/pkg/bloombuild/planner/planner_test.go index 346bd145ab8dc..8eccc77e19bf1 100644 --- a/pkg/bloombuild/planner/planner_test.go +++ b/pkg/bloombuild/planner/planner_test.go @@ -1,15 +1,28 @@ package planner import ( + "context" + "fmt" "testing" "time" + "github.com/go-kit/log" + "github.com/grafana/dskit/flagext" + "github.com/grafana/dskit/services" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/model" "github.com/stretchr/testify/require" + "google.golang.org/grpc" + "github.com/grafana/loki/v3/pkg/bloombuild/protos" + "github.com/grafana/loki/v3/pkg/storage" v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" + "github.com/grafana/loki/v3/pkg/storage/chunk/client/local" + "github.com/grafana/loki/v3/pkg/storage/config" "github.com/grafana/loki/v3/pkg/storage/stores/shipper/bloomshipper" + bloomshipperconfig "github.com/grafana/loki/v3/pkg/storage/stores/shipper/bloomshipper/config" "github.com/grafana/loki/v3/pkg/storage/stores/shipper/indexshipper/tsdb" + "github.com/grafana/loki/v3/pkg/storage/types" ) func tsdbID(n int) tsdb.SingleTenantTSDBIdentifier { @@ -155,9 +168,9 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 10), + Bounds: v1.NewBounds(0, 10), }, }, }, @@ -173,10 +186,10 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 10), - blocks: []bloomshipper.BlockRef{genBlockRef(9, 20)}, + Bounds: v1.NewBounds(0, 10), + Blocks: []bloomshipper.BlockRef{genBlockRef(9, 20)}, }, }, }, @@ -196,9 +209,9 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 8), + Bounds: v1.NewBounds(0, 8), }, }, }, @@ -215,10 +228,10 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 8), - blocks: []bloomshipper.BlockRef{genBlockRef(5, 20)}, + Bounds: v1.NewBounds(0, 8), + Blocks: []bloomshipper.BlockRef{genBlockRef(5, 20)}, }, }, }, @@ -241,32 +254,32 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ // tsdb (id=0) can source chunks from the blocks built from tsdb (id=1) { - bounds: v1.NewBounds(3, 5), - blocks: []bloomshipper.BlockRef{genBlockRef(3, 5)}, + Bounds: v1.NewBounds(3, 5), + Blocks: []bloomshipper.BlockRef{genBlockRef(3, 5)}, }, { - bounds: v1.NewBounds(9, 10), - blocks: []bloomshipper.BlockRef{genBlockRef(8, 10)}, + Bounds: v1.NewBounds(9, 10), + Blocks: []bloomshipper.BlockRef{genBlockRef(8, 10)}, }, }, }, // tsdb (id=1) can source chunks from the blocks built from tsdb (id=0) { tsdb: tsdbID(1), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 2), - blocks: []bloomshipper.BlockRef{ + Bounds: v1.NewBounds(0, 2), + Blocks: []bloomshipper.BlockRef{ genBlockRef(0, 1), genBlockRef(1, 2), }, }, { - bounds: v1.NewBounds(6, 7), - blocks: []bloomshipper.BlockRef{genBlockRef(6, 8)}, + Bounds: v1.NewBounds(6, 7), + Blocks: []bloomshipper.BlockRef{genBlockRef(6, 8)}, }, }, }, @@ -289,10 +302,10 @@ func Test_blockPlansForGaps(t *testing.T) { exp: []blockPlan{ { tsdb: tsdbID(0), - gaps: []GapWithBlocks{ + gaps: []protos.GapWithBlocks{ { - bounds: v1.NewBounds(0, 10), - blocks: []bloomshipper.BlockRef{ + Bounds: v1.NewBounds(0, 10), + Blocks: []bloomshipper.BlockRef{ genBlockRef(1, 4), genBlockRef(5, 10), genBlockRef(9, 20), @@ -319,3 +332,158 @@ func Test_blockPlansForGaps(t *testing.T) { }) } } + +func Test_BuilderLoop(t *testing.T) { + const ( + nTasks = 100 + nBuilders = 10 + ) + logger := log.NewNopLogger() + + limits := &fakeLimits{} + cfg := Config{ + PlanningInterval: 1 * time.Hour, + MaxQueuedTasksPerTenant: 10000, + } + schemaCfg := config.SchemaConfig{ + Configs: []config.PeriodConfig{ + { + From: parseDayTime("2023-09-01"), + IndexTables: config.IndexPeriodicTableConfig{ + PeriodicTableConfig: config.PeriodicTableConfig{ + Prefix: "index_", + Period: 24 * time.Hour, + }, + }, + IndexType: types.TSDBType, + ObjectType: types.StorageTypeFileSystem, + Schema: "v13", + RowShards: 16, + }, + }, + } + storageCfg := storage.Config{ + BloomShipperConfig: bloomshipperconfig.Config{ + WorkingDirectory: []string{t.TempDir()}, + DownloadParallelism: 1, + BlocksCache: bloomshipperconfig.BlocksCacheConfig{ + SoftLimit: flagext.Bytes(10 << 20), + HardLimit: flagext.Bytes(20 << 20), + TTL: time.Hour, + }, + }, + FSConfig: local.FSConfig{ + Directory: t.TempDir(), + }, + } + + // Create planner + planner, err := New(cfg, limits, schemaCfg, storageCfg, storage.NewClientMetrics(), nil, logger, prometheus.DefaultRegisterer) + require.NoError(t, err) + + // Start planner + err = services.StartAndAwaitRunning(context.Background(), planner) + require.NoError(t, err) + t.Cleanup(func() { + err := services.StopAndAwaitTerminated(context.Background(), planner) + require.NoError(t, err) + }) + + // Enqueue tasks + for i := 0; i < nTasks; i++ { + task := NewTask( + context.Background(), time.Now(), + protos.NewTask("fakeTable", "fakeTenant", v1.NewBounds(0, 10), tsdbID(1), nil), + ) + + err = planner.enqueueTask(task) + require.NoError(t, err) + } + + // All tasks should be pending + require.Equal(t, nTasks, planner.totalPendingTasks()) + + // Create builders and call planner.BuilderLoop + builders := make([]*fakeBuilder, 0, nBuilders) + for i := 0; i < nBuilders; i++ { + builder := newMockBuilder(fmt.Sprintf("builder-%d", i)) + builders = append(builders, builder) + + go func() { + // We ignore the error since when the planner is stopped, + // the loop will return an error (queue closed) + _ = planner.BuilderLoop(builder) + }() + } + + // Eventually, all tasks should be sent to builders + require.Eventually(t, func() bool { + var receivedTasks int + for _, builder := range builders { + receivedTasks += len(builder.ReceivedTasks()) + } + return receivedTasks == nTasks + }, 15*time.Second, 10*time.Millisecond) + + // Finally, the queue should be empty + require.Equal(t, 0, planner.totalPendingTasks()) +} + +type fakeBuilder struct { + id string + tasks []*protos.Task + grpc.ServerStream +} + +func newMockBuilder(id string) *fakeBuilder { + return &fakeBuilder{id: id} +} + +func (f *fakeBuilder) ReceivedTasks() []*protos.Task { + return f.tasks +} + +func (f *fakeBuilder) Context() context.Context { + return context.Background() +} + +func (f *fakeBuilder) Send(req *protos.PlannerToBuilder) error { + task, err := protos.FromProtoTask(req.Task) + if err != nil { + return err + } + + f.tasks = append(f.tasks, task) + return nil +} + +func (f *fakeBuilder) Recv() (*protos.BuilderToPlanner, error) { + return &protos.BuilderToPlanner{ + BuilderID: f.id, + }, nil +} + +type fakeLimits struct { +} + +func (f *fakeLimits) BloomCreationEnabled(_ string) bool { + return true +} + +func (f *fakeLimits) BloomSplitSeriesKeyspaceBy(_ string) int { + return 1 +} + +func (f *fakeLimits) BloomBuildMaxBuilders(_ string) int { + return 0 +} + +func parseDayTime(s string) config.DayTime { + t, err := time.Parse("2006-01-02", s) + if err != nil { + panic(err) + } + return config.DayTime{ + Time: model.TimeFromUnix(t.Unix()), + } +} diff --git a/pkg/bloombuild/planner/task.go b/pkg/bloombuild/planner/task.go index bff459fe17643..84c6d7617eafe 100644 --- a/pkg/bloombuild/planner/task.go +++ b/pkg/bloombuild/planner/task.go @@ -4,26 +4,21 @@ import ( "context" "time" - v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" - "github.com/grafana/loki/v3/pkg/storage/stores/shipper/bloomshipper" - "github.com/grafana/loki/v3/pkg/storage/stores/shipper/indexshipper/tsdb" + "github.com/grafana/loki/v3/pkg/bloombuild/protos" ) -// TODO: Extract this definiton to a proto file at pkg/bloombuild/protos/protos.proto - -type GapWithBlocks struct { - bounds v1.FingerprintBounds - blocks []bloomshipper.BlockRef -} - type Task struct { - table string - tenant string - OwnershipBounds v1.FingerprintBounds - tsdb tsdb.SingleTenantTSDBIdentifier - gaps []GapWithBlocks + *protos.Task // Tracking queueTime time.Time ctx context.Context } + +func NewTask(ctx context.Context, queueTime time.Time, task *protos.Task) *Task { + return &Task{ + Task: task, + ctx: ctx, + queueTime: queueTime, + } +} diff --git a/pkg/bloombuild/protos/compat.go b/pkg/bloombuild/protos/compat.go new file mode 100644 index 0000000000000..b1ae7cccdbab1 --- /dev/null +++ b/pkg/bloombuild/protos/compat.go @@ -0,0 +1,113 @@ +package protos + +import ( + "fmt" + + "github.com/google/uuid" + + v1 "github.com/grafana/loki/v3/pkg/storage/bloom/v1" + "github.com/grafana/loki/v3/pkg/storage/stores/shipper/bloomshipper" + "github.com/grafana/loki/v3/pkg/storage/stores/shipper/indexshipper/tsdb" +) + +type GapWithBlocks struct { + Bounds v1.FingerprintBounds + Blocks []bloomshipper.BlockRef +} + +type Task struct { + ID string + + Table string + Tenant string + OwnershipBounds v1.FingerprintBounds + TSDB tsdb.SingleTenantTSDBIdentifier + Gaps []GapWithBlocks +} + +func NewTask(table, tenant string, bounds v1.FingerprintBounds, tsdb tsdb.SingleTenantTSDBIdentifier, gaps []GapWithBlocks) *Task { + return &Task{ + ID: uuid.NewString(), + + Table: table, + Tenant: tenant, + OwnershipBounds: bounds, + TSDB: tsdb, + Gaps: gaps, + } +} + +// TODO: Use it in the builder to parse the task +func FromProtoTask(task *ProtoTask) (*Task, error) { + if task == nil { + return nil, nil + } + + tsdbRef, ok := tsdb.ParseSingleTenantTSDBPath(task.Tsdb) + if !ok { + return nil, fmt.Errorf("failed to parse tsdb path %s", task.Tsdb) + } + + gaps := make([]GapWithBlocks, 0, len(task.Gaps)) + for _, gap := range task.Gaps { + bounds := v1.FingerprintBounds{ + Min: gap.Bounds.Min, + Max: gap.Bounds.Max, + } + blocks := make([]bloomshipper.BlockRef, 0, len(gap.BlockRef)) + for _, block := range gap.BlockRef { + b, err := bloomshipper.BlockRefFromKey(block) + if err != nil { + return nil, fmt.Errorf("failed to parse block ref %s: %w", block, err) + } + + blocks = append(blocks, b) + } + gaps = append(gaps, GapWithBlocks{ + Bounds: bounds, + Blocks: blocks, + }) + } + + return &Task{ + ID: task.Id, + Table: task.Table, + Tenant: task.Tenant, + OwnershipBounds: v1.FingerprintBounds{ + Min: task.Bounds.Min, + Max: task.Bounds.Max, + }, + TSDB: tsdbRef, + Gaps: gaps, + }, nil +} + +func (t *Task) ToProtoTask() *ProtoTask { + protoGaps := make([]*ProtoGapWithBlocks, 0, len(t.Gaps)) + for _, gap := range t.Gaps { + blockRefs := make([]string, 0, len(gap.Blocks)) + for _, block := range gap.Blocks { + blockRefs = append(blockRefs, block.String()) + } + + protoGaps = append(protoGaps, &ProtoGapWithBlocks{ + Bounds: ProtoFingerprintBounds{ + Min: gap.Bounds.Min, + Max: gap.Bounds.Max, + }, + BlockRef: blockRefs, + }) + } + + return &ProtoTask{ + Id: t.ID, + Table: t.Table, + Tenant: t.Tenant, + Bounds: ProtoFingerprintBounds{ + Min: t.OwnershipBounds.Min, + Max: t.OwnershipBounds.Max, + }, + Tsdb: t.TSDB.Path(), + Gaps: protoGaps, + } +} diff --git a/pkg/bloombuild/protos/service.pb.go b/pkg/bloombuild/protos/service.pb.go new file mode 100644 index 0000000000000..91684dd90ef8e --- /dev/null +++ b/pkg/bloombuild/protos/service.pb.go @@ -0,0 +1,1175 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/bloombuild/protos/service.proto + +package protos + +import ( + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type BuilderToPlanner struct { + BuilderID string `protobuf:"bytes,1,opt,name=builderID,proto3" json:"builderID,omitempty"` +} + +func (m *BuilderToPlanner) Reset() { *m = BuilderToPlanner{} } +func (*BuilderToPlanner) ProtoMessage() {} +func (*BuilderToPlanner) Descriptor() ([]byte, []int) { + return fileDescriptor_89de33e08b859356, []int{0} +} +func (m *BuilderToPlanner) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *BuilderToPlanner) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_BuilderToPlanner.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *BuilderToPlanner) XXX_Merge(src proto.Message) { + xxx_messageInfo_BuilderToPlanner.Merge(m, src) +} +func (m *BuilderToPlanner) XXX_Size() int { + return m.Size() +} +func (m *BuilderToPlanner) XXX_DiscardUnknown() { + xxx_messageInfo_BuilderToPlanner.DiscardUnknown(m) +} + +var xxx_messageInfo_BuilderToPlanner proto.InternalMessageInfo + +func (m *BuilderToPlanner) GetBuilderID() string { + if m != nil { + return m.BuilderID + } + return "" +} + +type PlannerToBuilder struct { + Task *ProtoTask `protobuf:"bytes,1,opt,name=task,proto3" json:"task,omitempty"` +} + +func (m *PlannerToBuilder) Reset() { *m = PlannerToBuilder{} } +func (*PlannerToBuilder) ProtoMessage() {} +func (*PlannerToBuilder) Descriptor() ([]byte, []int) { + return fileDescriptor_89de33e08b859356, []int{1} +} +func (m *PlannerToBuilder) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PlannerToBuilder) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PlannerToBuilder.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PlannerToBuilder) XXX_Merge(src proto.Message) { + xxx_messageInfo_PlannerToBuilder.Merge(m, src) +} +func (m *PlannerToBuilder) XXX_Size() int { + return m.Size() +} +func (m *PlannerToBuilder) XXX_DiscardUnknown() { + xxx_messageInfo_PlannerToBuilder.DiscardUnknown(m) +} + +var xxx_messageInfo_PlannerToBuilder proto.InternalMessageInfo + +func (m *PlannerToBuilder) GetTask() *ProtoTask { + if m != nil { + return m.Task + } + return nil +} + +type NotifyBuilderShutdownRequest struct { + BuilderID string `protobuf:"bytes,1,opt,name=builderID,proto3" json:"builderID,omitempty"` +} + +func (m *NotifyBuilderShutdownRequest) Reset() { *m = NotifyBuilderShutdownRequest{} } +func (*NotifyBuilderShutdownRequest) ProtoMessage() {} +func (*NotifyBuilderShutdownRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_89de33e08b859356, []int{2} +} +func (m *NotifyBuilderShutdownRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NotifyBuilderShutdownRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NotifyBuilderShutdownRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NotifyBuilderShutdownRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_NotifyBuilderShutdownRequest.Merge(m, src) +} +func (m *NotifyBuilderShutdownRequest) XXX_Size() int { + return m.Size() +} +func (m *NotifyBuilderShutdownRequest) XXX_DiscardUnknown() { + xxx_messageInfo_NotifyBuilderShutdownRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_NotifyBuilderShutdownRequest proto.InternalMessageInfo + +func (m *NotifyBuilderShutdownRequest) GetBuilderID() string { + if m != nil { + return m.BuilderID + } + return "" +} + +type NotifyBuilderShutdownResponse struct { +} + +func (m *NotifyBuilderShutdownResponse) Reset() { *m = NotifyBuilderShutdownResponse{} } +func (*NotifyBuilderShutdownResponse) ProtoMessage() {} +func (*NotifyBuilderShutdownResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_89de33e08b859356, []int{3} +} +func (m *NotifyBuilderShutdownResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *NotifyBuilderShutdownResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_NotifyBuilderShutdownResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *NotifyBuilderShutdownResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_NotifyBuilderShutdownResponse.Merge(m, src) +} +func (m *NotifyBuilderShutdownResponse) XXX_Size() int { + return m.Size() +} +func (m *NotifyBuilderShutdownResponse) XXX_DiscardUnknown() { + xxx_messageInfo_NotifyBuilderShutdownResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_NotifyBuilderShutdownResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*BuilderToPlanner)(nil), "protos.BuilderToPlanner") + proto.RegisterType((*PlannerToBuilder)(nil), "protos.PlannerToBuilder") + proto.RegisterType((*NotifyBuilderShutdownRequest)(nil), "protos.NotifyBuilderShutdownRequest") + proto.RegisterType((*NotifyBuilderShutdownResponse)(nil), "protos.NotifyBuilderShutdownResponse") +} + +func init() { + proto.RegisterFile("pkg/bloombuild/protos/service.proto", fileDescriptor_89de33e08b859356) +} + +var fileDescriptor_89de33e08b859356 = []byte{ + // 323 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2e, 0xc8, 0x4e, 0xd7, + 0x4f, 0xca, 0xc9, 0xcf, 0xcf, 0x4d, 0x2a, 0xcd, 0xcc, 0x49, 0xd1, 0x2f, 0x28, 0xca, 0x2f, 0xc9, + 0x2f, 0xd6, 0x2f, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0xd5, 0x03, 0x73, 0x85, 0xd8, 0x20, 0xa2, + 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0xb6, 0x3e, 0x88, 0x05, 0x91, 0x95, 0x52, 0xc4, 0x6e, + 0x44, 0x49, 0x65, 0x41, 0x6a, 0x31, 0x44, 0x89, 0x92, 0x01, 0x97, 0x80, 0x13, 0x48, 0x2e, 0xb5, + 0x28, 0x24, 0x3f, 0x20, 0x27, 0x31, 0x2f, 0x2f, 0xb5, 0x48, 0x48, 0x86, 0x8b, 0x33, 0x09, 0x22, + 0xe6, 0xe9, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x10, 0x50, 0xb2, 0xe4, 0x12, 0x80, + 0x2a, 0x0c, 0xc9, 0x87, 0x6a, 0x15, 0x52, 0xe5, 0x62, 0x29, 0x49, 0x2c, 0xce, 0x06, 0x2b, 0xe6, + 0x36, 0x12, 0x84, 0x98, 0x5d, 0xac, 0x17, 0x00, 0xa2, 0x42, 0x12, 0x8b, 0xb3, 0x83, 0xc0, 0xd2, + 0x4a, 0x36, 0x5c, 0x32, 0x7e, 0xf9, 0x25, 0x99, 0x69, 0x95, 0x50, 0x7d, 0xc1, 0x19, 0xa5, 0x25, + 0x29, 0xf9, 0xe5, 0x79, 0x41, 0xa9, 0x85, 0xa5, 0xa9, 0xc5, 0x25, 0x04, 0x2c, 0x96, 0xe7, 0x92, + 0xc5, 0xa1, 0xbb, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0xd5, 0xe8, 0x08, 0x23, 0x97, 0x20, 0xd4, 0x69, + 0x6e, 0xf9, 0x45, 0x30, 0xb7, 0xb9, 0x73, 0x71, 0x43, 0x99, 0x3e, 0xf9, 0xf9, 0x05, 0x42, 0x12, + 0x30, 0xc7, 0xa1, 0x7b, 0x5b, 0x0a, 0x2e, 0x83, 0xee, 0x3d, 0x25, 0x06, 0x0d, 0x46, 0x03, 0x46, + 0xa1, 0x34, 0x2e, 0x51, 0xac, 0xf6, 0x0b, 0xa9, 0xc0, 0x34, 0xe2, 0xf3, 0x9c, 0x94, 0x2a, 0x01, + 0x55, 0x10, 0x4f, 0x28, 0x31, 0x38, 0xd9, 0x5c, 0x78, 0x28, 0xc7, 0x70, 0xe3, 0xa1, 0x1c, 0xc3, + 0x87, 0x87, 0x72, 0x8c, 0x0d, 0x8f, 0xe4, 0x18, 0x57, 0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, + 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x5f, 0x3c, 0x92, 0x63, 0xf8, 0xf0, 0x48, + 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x82, + 0xa6, 0x84, 0x24, 0x08, 0x6d, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x28, 0x86, 0x3f, 0xfe, 0x3f, + 0x02, 0x00, 0x00, +} + +func (this *BuilderToPlanner) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*BuilderToPlanner) + if !ok { + that2, ok := that.(BuilderToPlanner) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BuilderID != that1.BuilderID { + return false + } + return true +} +func (this *PlannerToBuilder) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*PlannerToBuilder) + if !ok { + that2, ok := that.(PlannerToBuilder) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Task.Equal(that1.Task) { + return false + } + return true +} +func (this *NotifyBuilderShutdownRequest) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*NotifyBuilderShutdownRequest) + if !ok { + that2, ok := that.(NotifyBuilderShutdownRequest) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.BuilderID != that1.BuilderID { + return false + } + return true +} +func (this *NotifyBuilderShutdownResponse) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*NotifyBuilderShutdownResponse) + if !ok { + that2, ok := that.(NotifyBuilderShutdownResponse) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + return true +} +func (this *BuilderToPlanner) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&protos.BuilderToPlanner{") + s = append(s, "BuilderID: "+fmt.Sprintf("%#v", this.BuilderID)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *PlannerToBuilder) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&protos.PlannerToBuilder{") + if this.Task != nil { + s = append(s, "Task: "+fmt.Sprintf("%#v", this.Task)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func (this *NotifyBuilderShutdownRequest) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 5) + s = append(s, "&protos.NotifyBuilderShutdownRequest{") + s = append(s, "BuilderID: "+fmt.Sprintf("%#v", this.BuilderID)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *NotifyBuilderShutdownResponse) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 4) + s = append(s, "&protos.NotifyBuilderShutdownResponse{") + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringService(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// PlannerForBuilderClient is the client API for PlannerForBuilder service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type PlannerForBuilderClient interface { + BuilderLoop(ctx context.Context, opts ...grpc.CallOption) (PlannerForBuilder_BuilderLoopClient, error) + NotifyBuilderShutdown(ctx context.Context, in *NotifyBuilderShutdownRequest, opts ...grpc.CallOption) (*NotifyBuilderShutdownResponse, error) +} + +type plannerForBuilderClient struct { + cc *grpc.ClientConn +} + +func NewPlannerForBuilderClient(cc *grpc.ClientConn) PlannerForBuilderClient { + return &plannerForBuilderClient{cc} +} + +func (c *plannerForBuilderClient) BuilderLoop(ctx context.Context, opts ...grpc.CallOption) (PlannerForBuilder_BuilderLoopClient, error) { + stream, err := c.cc.NewStream(ctx, &_PlannerForBuilder_serviceDesc.Streams[0], "/protos.PlannerForBuilder/BuilderLoop", opts...) + if err != nil { + return nil, err + } + x := &plannerForBuilderBuilderLoopClient{stream} + return x, nil +} + +type PlannerForBuilder_BuilderLoopClient interface { + Send(*BuilderToPlanner) error + Recv() (*PlannerToBuilder, error) + grpc.ClientStream +} + +type plannerForBuilderBuilderLoopClient struct { + grpc.ClientStream +} + +func (x *plannerForBuilderBuilderLoopClient) Send(m *BuilderToPlanner) error { + return x.ClientStream.SendMsg(m) +} + +func (x *plannerForBuilderBuilderLoopClient) Recv() (*PlannerToBuilder, error) { + m := new(PlannerToBuilder) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *plannerForBuilderClient) NotifyBuilderShutdown(ctx context.Context, in *NotifyBuilderShutdownRequest, opts ...grpc.CallOption) (*NotifyBuilderShutdownResponse, error) { + out := new(NotifyBuilderShutdownResponse) + err := c.cc.Invoke(ctx, "/protos.PlannerForBuilder/NotifyBuilderShutdown", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// PlannerForBuilderServer is the server API for PlannerForBuilder service. +type PlannerForBuilderServer interface { + BuilderLoop(PlannerForBuilder_BuilderLoopServer) error + NotifyBuilderShutdown(context.Context, *NotifyBuilderShutdownRequest) (*NotifyBuilderShutdownResponse, error) +} + +// UnimplementedPlannerForBuilderServer can be embedded to have forward compatible implementations. +type UnimplementedPlannerForBuilderServer struct { +} + +func (*UnimplementedPlannerForBuilderServer) BuilderLoop(srv PlannerForBuilder_BuilderLoopServer) error { + return status.Errorf(codes.Unimplemented, "method BuilderLoop not implemented") +} +func (*UnimplementedPlannerForBuilderServer) NotifyBuilderShutdown(ctx context.Context, req *NotifyBuilderShutdownRequest) (*NotifyBuilderShutdownResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method NotifyBuilderShutdown not implemented") +} + +func RegisterPlannerForBuilderServer(s *grpc.Server, srv PlannerForBuilderServer) { + s.RegisterService(&_PlannerForBuilder_serviceDesc, srv) +} + +func _PlannerForBuilder_BuilderLoop_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(PlannerForBuilderServer).BuilderLoop(&plannerForBuilderBuilderLoopServer{stream}) +} + +type PlannerForBuilder_BuilderLoopServer interface { + Send(*PlannerToBuilder) error + Recv() (*BuilderToPlanner, error) + grpc.ServerStream +} + +type plannerForBuilderBuilderLoopServer struct { + grpc.ServerStream +} + +func (x *plannerForBuilderBuilderLoopServer) Send(m *PlannerToBuilder) error { + return x.ServerStream.SendMsg(m) +} + +func (x *plannerForBuilderBuilderLoopServer) Recv() (*BuilderToPlanner, error) { + m := new(BuilderToPlanner) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _PlannerForBuilder_NotifyBuilderShutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(NotifyBuilderShutdownRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PlannerForBuilderServer).NotifyBuilderShutdown(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/protos.PlannerForBuilder/NotifyBuilderShutdown", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PlannerForBuilderServer).NotifyBuilderShutdown(ctx, req.(*NotifyBuilderShutdownRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _PlannerForBuilder_serviceDesc = grpc.ServiceDesc{ + ServiceName: "protos.PlannerForBuilder", + HandlerType: (*PlannerForBuilderServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "NotifyBuilderShutdown", + Handler: _PlannerForBuilder_NotifyBuilderShutdown_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "BuilderLoop", + Handler: _PlannerForBuilder_BuilderLoop_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "pkg/bloombuild/protos/service.proto", +} + +func (m *BuilderToPlanner) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *BuilderToPlanner) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BuilderToPlanner) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BuilderID) > 0 { + i -= len(m.BuilderID) + copy(dAtA[i:], m.BuilderID) + i = encodeVarintService(dAtA, i, uint64(len(m.BuilderID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *PlannerToBuilder) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PlannerToBuilder) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PlannerToBuilder) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Task != nil { + { + size, err := m.Task.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NotifyBuilderShutdownRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NotifyBuilderShutdownRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NotifyBuilderShutdownRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BuilderID) > 0 { + i -= len(m.BuilderID) + copy(dAtA[i:], m.BuilderID) + i = encodeVarintService(dAtA, i, uint64(len(m.BuilderID))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *NotifyBuilderShutdownResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *NotifyBuilderShutdownResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *NotifyBuilderShutdownResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintService(dAtA []byte, offset int, v uint64) int { + offset -= sovService(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *BuilderToPlanner) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BuilderID) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *PlannerToBuilder) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Task != nil { + l = m.Task.Size() + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *NotifyBuilderShutdownRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.BuilderID) + if l > 0 { + n += 1 + l + sovService(uint64(l)) + } + return n +} + +func (m *NotifyBuilderShutdownResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovService(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozService(x uint64) (n int) { + return sovService(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *BuilderToPlanner) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&BuilderToPlanner{`, + `BuilderID:` + fmt.Sprintf("%v", this.BuilderID) + `,`, + `}`, + }, "") + return s +} +func (this *PlannerToBuilder) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PlannerToBuilder{`, + `Task:` + strings.Replace(fmt.Sprintf("%v", this.Task), "ProtoTask", "ProtoTask", 1) + `,`, + `}`, + }, "") + return s +} +func (this *NotifyBuilderShutdownRequest) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NotifyBuilderShutdownRequest{`, + `BuilderID:` + fmt.Sprintf("%v", this.BuilderID) + `,`, + `}`, + }, "") + return s +} +func (this *NotifyBuilderShutdownResponse) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&NotifyBuilderShutdownResponse{`, + `}`, + }, "") + return s +} +func valueToStringService(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *BuilderToPlanner) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: BuilderToPlanner: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: BuilderToPlanner: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuilderID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BuilderID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PlannerToBuilder) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PlannerToBuilder: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PlannerToBuilder: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Task", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Task == nil { + m.Task = &ProtoTask{} + } + if err := m.Task.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NotifyBuilderShutdownRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NotifyBuilderShutdownRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NotifyBuilderShutdownRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BuilderID", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthService + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthService + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BuilderID = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *NotifyBuilderShutdownResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowService + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: NotifyBuilderShutdownResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: NotifyBuilderShutdownResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipService(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthService + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipService(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthService + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowService + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipService(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthService + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthService = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowService = fmt.Errorf("proto: integer overflow") +) diff --git a/pkg/bloombuild/protos/service.proto b/pkg/bloombuild/protos/service.proto new file mode 100644 index 0000000000000..e061684c41bea --- /dev/null +++ b/pkg/bloombuild/protos/service.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; + +package protos; + +import "gogoproto/gogo.proto"; +import "pkg/bloombuild/protos/types.proto"; + +option go_package = "protos"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +service PlannerForBuilder { + rpc BuilderLoop(stream BuilderToPlanner) returns (stream PlannerToBuilder) {} + + rpc NotifyBuilderShutdown(NotifyBuilderShutdownRequest) returns (NotifyBuilderShutdownResponse) {} +} + +message BuilderToPlanner { + string builderID = 1; +} + +message PlannerToBuilder { + ProtoTask task = 1; +} + +message NotifyBuilderShutdownRequest { + string builderID = 1; +} + +message NotifyBuilderShutdownResponse { + // empty: just to acknowledge the request +} diff --git a/pkg/bloombuild/protos/types.pb.go b/pkg/bloombuild/protos/types.pb.go new file mode 100644 index 0000000000000..5d3b9bcb729a3 --- /dev/null +++ b/pkg/bloombuild/protos/types.pb.go @@ -0,0 +1,1255 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/bloombuild/protos/types.proto + +package protos + +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_prometheus_common_model "github.com/prometheus/common/model" + io "io" + math "math" + math_bits "math/bits" + reflect "reflect" + strings "strings" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// FPBounds is identical to the definition in `pkg/storage/bloom/v1/bounds.FingerprintBounds` +// which ensures we can cast between them without allocations. +// TODO(salvacorts): Reuse from `pkg/logproto/indexgateway.proto` +type ProtoFingerprintBounds struct { + Min github_com_prometheus_common_model.Fingerprint `protobuf:"varint,1,opt,name=min,proto3,casttype=github.com/prometheus/common/model.Fingerprint" json:"min"` + Max github_com_prometheus_common_model.Fingerprint `protobuf:"varint,2,opt,name=max,proto3,casttype=github.com/prometheus/common/model.Fingerprint" json:"max"` +} + +func (m *ProtoFingerprintBounds) Reset() { *m = ProtoFingerprintBounds{} } +func (*ProtoFingerprintBounds) ProtoMessage() {} +func (*ProtoFingerprintBounds) Descriptor() ([]byte, []int) { + return fileDescriptor_5325fb0610e1e9ae, []int{0} +} +func (m *ProtoFingerprintBounds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProtoFingerprintBounds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProtoFingerprintBounds.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProtoFingerprintBounds) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtoFingerprintBounds.Merge(m, src) +} +func (m *ProtoFingerprintBounds) XXX_Size() int { + return m.Size() +} +func (m *ProtoFingerprintBounds) XXX_DiscardUnknown() { + xxx_messageInfo_ProtoFingerprintBounds.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtoFingerprintBounds proto.InternalMessageInfo + +func (m *ProtoFingerprintBounds) GetMin() github_com_prometheus_common_model.Fingerprint { + if m != nil { + return m.Min + } + return 0 +} + +func (m *ProtoFingerprintBounds) GetMax() github_com_prometheus_common_model.Fingerprint { + if m != nil { + return m.Max + } + return 0 +} + +type ProtoGapWithBlocks struct { + Bounds ProtoFingerprintBounds `protobuf:"bytes,1,opt,name=bounds,proto3" json:"bounds"` + BlockRef []string `protobuf:"bytes,2,rep,name=blockRef,proto3" json:"blockRef,omitempty"` +} + +func (m *ProtoGapWithBlocks) Reset() { *m = ProtoGapWithBlocks{} } +func (*ProtoGapWithBlocks) ProtoMessage() {} +func (*ProtoGapWithBlocks) Descriptor() ([]byte, []int) { + return fileDescriptor_5325fb0610e1e9ae, []int{1} +} +func (m *ProtoGapWithBlocks) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProtoGapWithBlocks) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProtoGapWithBlocks.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProtoGapWithBlocks) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtoGapWithBlocks.Merge(m, src) +} +func (m *ProtoGapWithBlocks) XXX_Size() int { + return m.Size() +} +func (m *ProtoGapWithBlocks) XXX_DiscardUnknown() { + xxx_messageInfo_ProtoGapWithBlocks.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtoGapWithBlocks proto.InternalMessageInfo + +func (m *ProtoGapWithBlocks) GetBounds() ProtoFingerprintBounds { + if m != nil { + return m.Bounds + } + return ProtoFingerprintBounds{} +} + +func (m *ProtoGapWithBlocks) GetBlockRef() []string { + if m != nil { + return m.BlockRef + } + return nil +} + +// TODO: Define BlockRef and SingleTenantTSDBIdentifier as messages so we can use them right away +// +// instead of unmarshaling them from strings or doing unsafe casts. +type ProtoTask struct { + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Table string `protobuf:"bytes,2,opt,name=table,proto3" json:"table,omitempty"` + Tenant string `protobuf:"bytes,3,opt,name=tenant,proto3" json:"tenant,omitempty"` + Bounds ProtoFingerprintBounds `protobuf:"bytes,4,opt,name=bounds,proto3" json:"bounds"` + Tsdb string `protobuf:"bytes,5,opt,name=tsdb,proto3" json:"tsdb,omitempty"` + Gaps []*ProtoGapWithBlocks `protobuf:"bytes,6,rep,name=gaps,proto3" json:"gaps,omitempty"` +} + +func (m *ProtoTask) Reset() { *m = ProtoTask{} } +func (*ProtoTask) ProtoMessage() {} +func (*ProtoTask) Descriptor() ([]byte, []int) { + return fileDescriptor_5325fb0610e1e9ae, []int{2} +} +func (m *ProtoTask) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ProtoTask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ProtoTask.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *ProtoTask) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProtoTask.Merge(m, src) +} +func (m *ProtoTask) XXX_Size() int { + return m.Size() +} +func (m *ProtoTask) XXX_DiscardUnknown() { + xxx_messageInfo_ProtoTask.DiscardUnknown(m) +} + +var xxx_messageInfo_ProtoTask proto.InternalMessageInfo + +func (m *ProtoTask) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *ProtoTask) GetTable() string { + if m != nil { + return m.Table + } + return "" +} + +func (m *ProtoTask) GetTenant() string { + if m != nil { + return m.Tenant + } + return "" +} + +func (m *ProtoTask) GetBounds() ProtoFingerprintBounds { + if m != nil { + return m.Bounds + } + return ProtoFingerprintBounds{} +} + +func (m *ProtoTask) GetTsdb() string { + if m != nil { + return m.Tsdb + } + return "" +} + +func (m *ProtoTask) GetGaps() []*ProtoGapWithBlocks { + if m != nil { + return m.Gaps + } + return nil +} + +func init() { + proto.RegisterType((*ProtoFingerprintBounds)(nil), "protos.ProtoFingerprintBounds") + proto.RegisterType((*ProtoGapWithBlocks)(nil), "protos.ProtoGapWithBlocks") + proto.RegisterType((*ProtoTask)(nil), "protos.ProtoTask") +} + +func init() { proto.RegisterFile("pkg/bloombuild/protos/types.proto", fileDescriptor_5325fb0610e1e9ae) } + +var fileDescriptor_5325fb0610e1e9ae = []byte{ + // 393 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x92, 0x31, 0xeb, 0x9b, 0x40, + 0x18, 0xc6, 0x3d, 0xf5, 0x2f, 0xf5, 0x02, 0x19, 0x8e, 0x10, 0x24, 0xc3, 0x99, 0x66, 0xca, 0xa4, + 0x90, 0x4e, 0x85, 0x4e, 0x0e, 0xe9, 0xd0, 0xa5, 0x48, 0xa1, 0xd0, 0xed, 0x2e, 0x5e, 0xcd, 0x11, + 0xf5, 0x24, 0x77, 0x82, 0xdd, 0xfa, 0x11, 0xfa, 0x31, 0x3a, 0xf7, 0x53, 0x64, 0xcc, 0x52, 0xc8, + 0x24, 0x8d, 0x59, 0x4a, 0xa6, 0xcc, 0x9d, 0x8a, 0xa7, 0x94, 0x04, 0x3a, 0xb5, 0xd3, 0xfb, 0x3c, + 0xaf, 0xbe, 0xbf, 0xf7, 0x79, 0x45, 0xf8, 0xbc, 0xdc, 0xa5, 0x21, 0xcd, 0x84, 0xc8, 0x69, 0xc5, + 0xb3, 0x24, 0x2c, 0xf7, 0x42, 0x09, 0x19, 0xaa, 0x4f, 0x25, 0x93, 0x81, 0x36, 0xc8, 0xe9, 0x7b, + 0xb3, 0x49, 0x2a, 0x52, 0xa1, 0x75, 0xd8, 0xa9, 0xfe, 0xe9, 0xe2, 0x1b, 0x80, 0xd3, 0xb7, 0x9d, + 0x5a, 0xf3, 0x22, 0x65, 0xfb, 0x72, 0xcf, 0x0b, 0x15, 0x89, 0xaa, 0x48, 0x24, 0x7a, 0x03, 0xad, + 0x9c, 0x17, 0x1e, 0x98, 0x83, 0xa5, 0x1d, 0xbd, 0xbc, 0x36, 0x7e, 0x67, 0x7f, 0x35, 0x7e, 0x90, + 0x72, 0xb5, 0xad, 0x68, 0xb0, 0x11, 0x79, 0xb7, 0x2f, 0x67, 0x6a, 0xcb, 0x2a, 0x19, 0x6e, 0x44, + 0x9e, 0x8b, 0x22, 0xcc, 0x45, 0xc2, 0xb2, 0xe0, 0x8e, 0x16, 0x77, 0x63, 0x1a, 0x46, 0x6a, 0xcf, + 0xbc, 0x83, 0x91, 0xfa, 0x9f, 0x60, 0xa4, 0x5e, 0xd4, 0x10, 0xe9, 0xcc, 0xaf, 0x49, 0xf9, 0x9e, + 0xab, 0x6d, 0x94, 0x89, 0xcd, 0x4e, 0xa2, 0x35, 0x74, 0xa8, 0x4e, 0xae, 0x23, 0x8f, 0x56, 0xb8, + 0x3f, 0x51, 0x06, 0x7f, 0xbf, 0x2f, 0x1a, 0x1f, 0x1a, 0xdf, 0xb8, 0x36, 0xfe, 0x30, 0x15, 0x0f, + 0x15, 0xcd, 0xe0, 0x33, 0xda, 0x11, 0x63, 0xf6, 0xd1, 0x33, 0xe7, 0xd6, 0xd2, 0x8d, 0xff, 0xf8, + 0xc5, 0x77, 0x00, 0x5d, 0x8d, 0x7b, 0x47, 0xe4, 0x0e, 0x8d, 0xa1, 0xc9, 0x13, 0xbd, 0xcd, 0x8d, + 0x4d, 0x9e, 0xa0, 0x09, 0x7c, 0x52, 0x84, 0x66, 0x4c, 0x9f, 0xe9, 0xc6, 0xbd, 0x41, 0x53, 0xe8, + 0x28, 0x56, 0x90, 0x42, 0x79, 0x96, 0x6e, 0x0f, 0xee, 0x2e, 0xaf, 0xfd, 0x5f, 0x79, 0x11, 0xb4, + 0x95, 0x4c, 0xa8, 0xf7, 0xa4, 0xe9, 0x5a, 0xa3, 0x00, 0xda, 0x29, 0x29, 0xa5, 0xe7, 0xcc, 0xad, + 0xe5, 0x68, 0x35, 0x7b, 0x20, 0x3f, 0x7c, 0xb5, 0x58, 0xbf, 0x17, 0xbd, 0x3a, 0x9e, 0xb1, 0x71, + 0x3a, 0x63, 0xe3, 0x76, 0xc6, 0xe0, 0x73, 0x8b, 0xc1, 0xd7, 0x16, 0x83, 0x43, 0x8b, 0xc1, 0xb1, + 0xc5, 0xe0, 0x47, 0x8b, 0xc1, 0xcf, 0x16, 0x1b, 0xb7, 0x16, 0x83, 0x2f, 0x17, 0x6c, 0x1c, 0x2f, + 0xd8, 0x38, 0x5d, 0xb0, 0xf1, 0x61, 0xf8, 0xb5, 0x68, 0x5f, 0x5f, 0xfc, 0x0e, 0x00, 0x00, 0xff, + 0xff, 0x57, 0x05, 0xc7, 0x5d, 0x8e, 0x02, 0x00, 0x00, +} + +func (this *ProtoFingerprintBounds) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ProtoFingerprintBounds) + if !ok { + that2, ok := that.(ProtoFingerprintBounds) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Min != that1.Min { + return false + } + if this.Max != that1.Max { + return false + } + return true +} +func (this *ProtoGapWithBlocks) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ProtoGapWithBlocks) + if !ok { + that2, ok := that.(ProtoGapWithBlocks) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.Bounds.Equal(&that1.Bounds) { + return false + } + if len(this.BlockRef) != len(that1.BlockRef) { + return false + } + for i := range this.BlockRef { + if this.BlockRef[i] != that1.BlockRef[i] { + return false + } + } + return true +} +func (this *ProtoTask) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ProtoTask) + if !ok { + that2, ok := that.(ProtoTask) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Id != that1.Id { + return false + } + if this.Table != that1.Table { + return false + } + if this.Tenant != that1.Tenant { + return false + } + if !this.Bounds.Equal(&that1.Bounds) { + return false + } + if this.Tsdb != that1.Tsdb { + return false + } + if len(this.Gaps) != len(that1.Gaps) { + return false + } + for i := range this.Gaps { + if !this.Gaps[i].Equal(that1.Gaps[i]) { + return false + } + } + return true +} +func (this *ProtoFingerprintBounds) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&protos.ProtoFingerprintBounds{") + s = append(s, "Min: "+fmt.Sprintf("%#v", this.Min)+",\n") + s = append(s, "Max: "+fmt.Sprintf("%#v", this.Max)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ProtoGapWithBlocks) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 6) + s = append(s, "&protos.ProtoGapWithBlocks{") + s = append(s, "Bounds: "+strings.Replace(this.Bounds.GoString(), `&`, ``, 1)+",\n") + s = append(s, "BlockRef: "+fmt.Sprintf("%#v", this.BlockRef)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *ProtoTask) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 10) + s = append(s, "&protos.ProtoTask{") + s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") + s = append(s, "Table: "+fmt.Sprintf("%#v", this.Table)+",\n") + s = append(s, "Tenant: "+fmt.Sprintf("%#v", this.Tenant)+",\n") + s = append(s, "Bounds: "+strings.Replace(this.Bounds.GoString(), `&`, ``, 1)+",\n") + s = append(s, "Tsdb: "+fmt.Sprintf("%#v", this.Tsdb)+",\n") + if this.Gaps != nil { + s = append(s, "Gaps: "+fmt.Sprintf("%#v", this.Gaps)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") +} +func valueToGoStringTypes(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) +} +func (m *ProtoFingerprintBounds) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProtoFingerprintBounds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProtoFingerprintBounds) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Max != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Max)) + i-- + dAtA[i] = 0x10 + } + if m.Min != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Min)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *ProtoGapWithBlocks) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProtoGapWithBlocks) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProtoGapWithBlocks) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.BlockRef) > 0 { + for iNdEx := len(m.BlockRef) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BlockRef[iNdEx]) + copy(dAtA[i:], m.BlockRef[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.BlockRef[iNdEx]))) + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Bounds.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *ProtoTask) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *ProtoTask) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProtoTask) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Gaps) > 0 { + for iNdEx := len(m.Gaps) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Gaps[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if len(m.Tsdb) > 0 { + i -= len(m.Tsdb) + copy(dAtA[i:], m.Tsdb) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tsdb))) + i-- + dAtA[i] = 0x2a + } + { + size, err := m.Bounds.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.Tenant) > 0 { + i -= len(m.Tenant) + copy(dAtA[i:], m.Tenant) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tenant))) + i-- + dAtA[i] = 0x1a + } + if len(m.Table) > 0 { + i -= len(m.Table) + copy(dAtA[i:], m.Table) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Table))) + i-- + dAtA[i] = 0x12 + } + if len(m.Id) > 0 { + i -= len(m.Id) + copy(dAtA[i:], m.Id) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Id))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ProtoFingerprintBounds) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Min != 0 { + n += 1 + sovTypes(uint64(m.Min)) + } + if m.Max != 0 { + n += 1 + sovTypes(uint64(m.Max)) + } + return n +} + +func (m *ProtoGapWithBlocks) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Bounds.Size() + n += 1 + l + sovTypes(uint64(l)) + if len(m.BlockRef) > 0 { + for _, s := range m.BlockRef { + l = len(s) + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func (m *ProtoTask) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Id) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Table) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = len(m.Tenant) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + l = m.Bounds.Size() + n += 1 + l + sovTypes(uint64(l)) + l = len(m.Tsdb) + if l > 0 { + n += 1 + l + sovTypes(uint64(l)) + } + if len(m.Gaps) > 0 { + for _, e := range m.Gaps { + l = e.Size() + n += 1 + l + sovTypes(uint64(l)) + } + } + return n +} + +func sovTypes(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTypes(x uint64) (n int) { + return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *ProtoFingerprintBounds) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ProtoFingerprintBounds{`, + `Min:` + fmt.Sprintf("%v", this.Min) + `,`, + `Max:` + fmt.Sprintf("%v", this.Max) + `,`, + `}`, + }, "") + return s +} +func (this *ProtoGapWithBlocks) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&ProtoGapWithBlocks{`, + `Bounds:` + strings.Replace(strings.Replace(this.Bounds.String(), "ProtoFingerprintBounds", "ProtoFingerprintBounds", 1), `&`, ``, 1) + `,`, + `BlockRef:` + fmt.Sprintf("%v", this.BlockRef) + `,`, + `}`, + }, "") + return s +} +func (this *ProtoTask) String() string { + if this == nil { + return "nil" + } + repeatedStringForGaps := "[]*ProtoGapWithBlocks{" + for _, f := range this.Gaps { + repeatedStringForGaps += strings.Replace(f.String(), "ProtoGapWithBlocks", "ProtoGapWithBlocks", 1) + "," + } + repeatedStringForGaps += "}" + s := strings.Join([]string{`&ProtoTask{`, + `Id:` + fmt.Sprintf("%v", this.Id) + `,`, + `Table:` + fmt.Sprintf("%v", this.Table) + `,`, + `Tenant:` + fmt.Sprintf("%v", this.Tenant) + `,`, + `Bounds:` + strings.Replace(strings.Replace(this.Bounds.String(), "ProtoFingerprintBounds", "ProtoFingerprintBounds", 1), `&`, ``, 1) + `,`, + `Tsdb:` + fmt.Sprintf("%v", this.Tsdb) + `,`, + `Gaps:` + repeatedStringForGaps + `,`, + `}`, + }, "") + return s +} +func valueToStringTypes(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *ProtoFingerprintBounds) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProtoFingerprintBounds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProtoFingerprintBounds: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Min", wireType) + } + m.Min = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Min |= github_com_prometheus_common_model.Fingerprint(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Max", wireType) + } + m.Max = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Max |= github_com_prometheus_common_model.Fingerprint(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProtoGapWithBlocks) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProtoGapWithBlocks: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProtoGapWithBlocks: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bounds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Bounds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockRef", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BlockRef = append(m.BlockRef, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ProtoTask) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: ProtoTask: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ProtoTask: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Id = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Table", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Table = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tenant", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tenant = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bounds", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Bounds.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tsdb", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tsdb = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Gaps", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Gaps = append(m.Gaps, &ProtoGapWithBlocks{}) + if err := m.Gaps[len(m.Gaps)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTypes(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + return iNdEx, nil + case 1: + iNdEx += 8 + return iNdEx, nil + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTypes + } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + return iNdEx, nil + case 3: + for { + var innerWire uint64 + var start int = iNdEx + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTypes + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + innerWire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + innerWireType := int(innerWire & 0x7) + if innerWireType == 4 { + break + } + next, err := skipTypes(dAtA[start:]) + if err != nil { + return 0, err + } + iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } + } + return iNdEx, nil + case 4: + return iNdEx, nil + case 5: + iNdEx += 4 + return iNdEx, nil + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + } + panic("unreachable") +} + +var ( + ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") +) diff --git a/pkg/bloombuild/protos/types.proto b/pkg/bloombuild/protos/types.proto new file mode 100644 index 0000000000000..58ea8ee4679e4 --- /dev/null +++ b/pkg/bloombuild/protos/types.proto @@ -0,0 +1,45 @@ +syntax = "proto3"; + +package protos; + +import "gogoproto/gogo.proto"; + +option go_package = "protos"; +option (gogoproto.marshaler_all) = true; +option (gogoproto.unmarshaler_all) = true; + +// FPBounds is identical to the definition in `pkg/storage/bloom/v1/bounds.FingerprintBounds` +// which ensures we can cast between them without allocations. +// TODO(salvacorts): Reuse from `pkg/logproto/indexgateway.proto` +message ProtoFingerprintBounds { + uint64 min = 1 [ + (gogoproto.casttype) = "github.com/prometheus/common/model.Fingerprint", + (gogoproto.jsontag) = "min" + ]; + uint64 max = 2 [ + (gogoproto.casttype) = "github.com/prometheus/common/model.Fingerprint", + (gogoproto.jsontag) = "max" + ]; +} + +message ProtoGapWithBlocks { + ProtoFingerprintBounds bounds = 1 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "bounds" + ]; + repeated string blockRef = 2; +} + +// TODO: Define BlockRef and SingleTenantTSDBIdentifier as messages so we can use them right away +// instead of unmarshaling them from strings or doing unsafe casts. +message ProtoTask { + string id = 1; + string table = 2; + string tenant = 3; + ProtoFingerprintBounds bounds = 4 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "bounds" + ]; + string tsdb = 5; + repeated ProtoGapWithBlocks gaps = 6; +}