Count operation type A & B

This commit is contained in:
DullJZ
2025-10-21 18:29:24 +08:00
parent 7e1f4bbee3
commit b2dc311f01
7 changed files with 151 additions and 41 deletions
+17
View File
@@ -0,0 +1,17 @@
package api
import (
"log"
"github.com/DullJZ/s3-balance/internal/bucket"
)
// recordBackendOperation increments backend operation counters and disables the bucket if limits are exceeded.
func (h *S3Handler) recordBackendOperation(b *bucket.BucketInfo, category bucket.OperationCategory) {
if b == nil {
return
}
if disabled := b.RecordOperation(category); disabled {
log.Printf("Bucket %s disabled after exceeding %s-type operation limit", b.Config.Name, category)
}
}