diff --git a/README.md b/README.md index 980118f..197e513 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

equalizer

- + diff --git a/equalizer.go b/equalizer.go index 5dbb662..a70d4d1 100644 --- a/equalizer.go +++ b/equalizer.go @@ -7,9 +7,9 @@ import ( "sync" ) -// An Equalizer represents a bitmap-based adaptive rate limiter. +// An Equalizer represents an adaptive rate limiter based on a bit array. // -// The Equalizer uses a round-robin bitmap tape with a moving head to manage +// The Equalizer uses a round-robin bit array with a moving head to manage // quotas. // The quota management algorithm is simple and works in the following way. // To request a permit in a non-blocking manner use the TryAcquire method. @@ -23,9 +23,9 @@ import ( // An Equalizer is safe for use by multiple goroutines simultaneously. type Equalizer struct { sync.RWMutex - // tape is the underlying bitmap tape + // tape is the underlying bit array tape *big.Int - // seed is the initial state of the bitmap tape + // seed is the initial state of the bit array tape seed *big.Int // mask is the positive bitmask mask *big.Int @@ -38,8 +38,8 @@ type Equalizer struct { } // NewEqualizer instantiates and returns a new Equalizer rate limiter, where -// len is the size of the bitmap, reserved is the number of reserved positive -// bits and offset is an instance of the equalizer.Offset strategy. +// size is the length of the bit array, reserved is the number of reserved +// positive bits and offset is an instance of the equalizer.Offset strategy. func NewEqualizer(size, reserved int, offset Offset) (*Equalizer, error) { if offset == nil { return nil, fmt.Errorf("offset is nil") @@ -53,7 +53,7 @@ func NewEqualizer(size, reserved int, offset Offset) (*Equalizer, error) { if reserved > size { return nil, fmt.Errorf("reserved must not exceed size") } - // init the seed bitmap tape + // init the seed bit array var seed big.Int seed.SetString(strings.Repeat("1", size), 2) @@ -62,7 +62,7 @@ func NewEqualizer(size, reserved int, offset Offset) (*Equalizer, error) { mask.SetString(strings.Repeat("1", reserved), 2) mask.Lsh(&mask, uint(size-reserved)) - // init the bitmap tape + // init the operational bit array tape var tape big.Int tape.Set(&seed) diff --git a/internal/async/task.go b/internal/async/task.go index 295b828..68d1abd 100644 --- a/internal/async/task.go +++ b/internal/async/task.go @@ -12,7 +12,7 @@ type Task struct { stop chan struct{} } -// New returns a new Task configured to execute periodically at the +// NewTask returns a new Task configured to execute periodically at the // specified interval. func NewTask(interval time.Duration) *Task { return &Task{