Documentation
¶
Overview ¶
ABOUTME: Thread-safe cache with TTL expiration. ABOUTME: Stores expensive operation results to avoid recomputation.
ABOUTME: Resource coordinator for multi-agent systems providing resource locking. ABOUTME: Ensures thread-safe coordination across agent hierarchy.
ABOUTME: Token bucket rate limiter for API call throttling. ABOUTME: Allows bursts up to capacity while maintaining average rate.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides thread-safe caching with TTL expiration.
func (*Cache) Cleanup ¶
func (c *Cache) Cleanup()
Cleanup removes expired entries. Call periodically.
type CachedItem ¶
CachedItem stores a value with expiration time.
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator manages shared resources across agents.
func (*Coordinator) Acquire ¶
func (c *Coordinator) Acquire(ctx context.Context, agentID, resourceID string) error
Acquire attempts to acquire a lock on a resource. Idempotent: if the agent already owns the lock, returns nil.
func (*Coordinator) Release ¶
func (c *Coordinator) Release(agentID, resourceID string) error
Release releases a lock on a resource.
func (*Coordinator) ReleaseAll ¶
func (c *Coordinator) ReleaseAll(agentID string)
ReleaseAll releases all locks held by the given agent.
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements token bucket rate limiting.
func NewRateLimiter ¶
func NewRateLimiter(capacity, refillRate float64) *RateLimiter
NewRateLimiter creates a new token bucket rate limiter. capacity: maximum tokens (burst size) refillRate: tokens added per second