Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeTotalLag ¶
ComputeTotalLag computes the total offset lag across all partitions. For partitions missing from dst, the full source offset counts as lag.
func SortedPartitionIDs ¶
SortedPartitionIDs returns the union of partition IDs from two offset maps, sorted ascending.
Types ¶
type Provider ¶ added in v0.7.1
type Provider interface {
GetMany(ctx context.Context, topics []string) (map[string]map[int32]int64, error)
}
Provider abstracts offset retrieval for testability.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides offset operations against a Kafka cluster.
func NewOffsetService ¶
NewOffsetService creates a Service backed by the given Kafka client.
func (*Service) Exists ¶
Exists checks whether a topic exists on the cluster by refreshing metadata.
func (*Service) Get ¶
Get fetches the log end offset (LEO) for every partition of a topic. It is a single-topic wrapper over GetMany kept for the package tests and the offsetbench loop-vs-batch contrast; production sweeps call GetMany, which costs one request per broker instead of one per topic.
func (*Service) GetMany ¶ added in v0.8.8
GetMany fetches the log end offset (LEO) for every partition of every topic in a single sweep. Partitions are grouped by leader broker across all topics and one ListOffsets request is sent per broker (concurrently), so a sweep of N topics costs one round trip instead of N.
Partitions that fail because cached metadata went stale mid-sweep (leader moved, replica unavailable, or the cached leader broker unreachable) are retried once against refreshed metadata before the sweep fails.