Interim release: documentation updates and rate limiting improvements
- Add applesauce library reference documentation - Add rate limiting test report for Badger - Add memory monitoring for rate limiter (platform-specific implementations) - Enhance PID-controlled adaptive rate limiting - Update Neo4j and Badger monitors with improved load metrics - Add docker-compose configuration - Update README and configuration options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit was merged in pull request #3.
This commit is contained in:
@@ -20,6 +20,15 @@ import (
|
||||
"git.mleku.dev/mleku/nostr/utils/units"
|
||||
)
|
||||
|
||||
// RateLimiterInterface defines the minimal interface for rate limiting during import
|
||||
type RateLimiterInterface interface {
|
||||
IsEnabled() bool
|
||||
Wait(ctx context.Context, opType int) time.Duration
|
||||
}
|
||||
|
||||
// WriteOpType is the operation type constant for write operations
|
||||
const WriteOpType = 1
|
||||
|
||||
// D implements the Database interface using Badger as the storage backend
|
||||
type D struct {
|
||||
ctx context.Context
|
||||
@@ -35,6 +44,14 @@ type D struct {
|
||||
// Serial cache for compact event storage
|
||||
// Caches pubkey and event ID serial mappings for fast compact event decoding
|
||||
serialCache *SerialCache
|
||||
|
||||
// Rate limiter for controlling memory pressure during bulk operations
|
||||
rateLimiter RateLimiterInterface
|
||||
}
|
||||
|
||||
// SetRateLimiter sets the rate limiter for controlling memory during import/export
|
||||
func (d *D) SetRateLimiter(limiter RateLimiterInterface) {
|
||||
d.rateLimiter = limiter
|
||||
}
|
||||
|
||||
// Ensure D implements Database interface at compile time
|
||||
|
||||
Reference in New Issue
Block a user