Skip to content

Commit

Permalink
rac2: introduce stream token counter provider interface
Browse files Browse the repository at this point in the history
Introduce the `StreamTokenCounterProvider` interface, which will be used
by replication flow control v2 to access the `TokenCounter` for a given
tenant, store stream.

Note the original interface in the v2 prototype included two additional
methods for metrics gathering which are omitted here.

Resolves: cockroachdb#128010
Release note: None
  • Loading branch information
kvoli committed Aug 5, 2024
1 parent de6ed20 commit f01b7d0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/kv/kvserver/kvflowcontrol/rac2/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "rac2",
srcs = ["token_counter.go"],
srcs = [
"store_stream.go",
"token_counter.go",
],
importpath = "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvflowcontrol/rac2",
visibility = ["//visibility:public"],
deps = [
Expand Down
22 changes: 22 additions & 0 deletions pkg/kv/kvserver/kvflowcontrol/rac2/store_stream.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Copyright 2024 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package rac2

import "github.com/cockroachdb/cockroach/pkg/kv/kvserver/kvflowcontrol"

// StreamTokenCounterProvider is the interface for retrieving token counters
// for a given stream.
type StreamTokenCounterProvider interface {
// Eval returns the evaluation token counter for the given stream.
Eval(kvflowcontrol.Stream) TokenCounter
// Send returns the send token counter for the given stream.
Send(kvflowcontrol.Stream) TokenCounter
}

0 comments on commit f01b7d0

Please sign in to comment.