Skip to content

Conversation

@bootjp
Copy link
Owner

@bootjp bootjp commented Aug 26, 2025

Summary

  • track request counts per range in distribution engine
  • split ranges once request thresholds exceed limits
  • add administrative gRPC endpoints SplitRange and GetStats

Testing

  • go test ./distribution -run Test -count=1

https://chatgpt.com/codex/tasks/task_e_689871cad050832498b5c2fddf27a073

import "testing"

// Test range statistics collection and split triggering.
func TestRangeStatsAndSplit(t *testing.T) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
calculated cyclomatic complexity for function TestRangeStatsAndSplit is 12, max is 10 (cyclop)

package distribution

import (
"sync"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)


// Test range statistics collection and split triggering.
func TestRangeStatsAndSplit(t *testing.T) {
var notified bool

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
File is not properly formatted (gci)

// function is invoked whenever a range split occurs.
func NewEngine(threshold int, notify func(left, right Range)) *Engine {
return &Engine{
ranges: []Range{{Start: "", End: string(rune(0xffff))}},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Magic number: 0xffff, in detected (mnd)

s = start[0]
}
e := byte('z')
if len(end) > 0 && end != string(rune(0xffff)) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Magic number: 0xffff, in detected (mnd)

if len(end) > 0 && end != string(rune(0xffff)) {
e = end[0]
}
m := s + (e-s)/2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚫 [golangci] reported by reviewdog 🐶
Magic number: 2, in detected (mnd)

@bootjp bootjp closed this Aug 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants