 9bdcbe0447
			
		
	
	9bdcbe0447
	
	
	
		
			
			Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			65 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			65 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package connmgr
 | |
| 
 | |
| import (
 | |
| 	"errors"
 | |
| 	"time"
 | |
| 
 | |
| 	"github.com/benbjohnson/clock"
 | |
| )
 | |
| 
 | |
| // config is the configuration struct for the basic connection manager.
 | |
| type config struct {
 | |
| 	highWater     int
 | |
| 	lowWater      int
 | |
| 	gracePeriod   time.Duration
 | |
| 	silencePeriod time.Duration
 | |
| 	decayer       *DecayerCfg
 | |
| 	emergencyTrim bool
 | |
| 	clock         clock.Clock
 | |
| }
 | |
| 
 | |
| // Option represents an option for the basic connection manager.
 | |
| type Option func(*config) error
 | |
| 
 | |
| // DecayerConfig applies a configuration for the decayer.
 | |
| func DecayerConfig(opts *DecayerCfg) Option {
 | |
| 	return func(cfg *config) error {
 | |
| 		cfg.decayer = opts
 | |
| 		return nil
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // WithClock sets the internal clock impl
 | |
| func WithClock(c clock.Clock) Option {
 | |
| 	return func(cfg *config) error {
 | |
| 		cfg.clock = c
 | |
| 		return nil
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // WithGracePeriod sets the grace period.
 | |
| // The grace period is the time a newly opened connection is given before it becomes
 | |
| // subject to pruning.
 | |
| func WithGracePeriod(p time.Duration) Option {
 | |
| 	return func(cfg *config) error {
 | |
| 		if p < 0 {
 | |
| 			return errors.New("grace period must be non-negative")
 | |
| 		}
 | |
| 		cfg.gracePeriod = p
 | |
| 		return nil
 | |
| 	}
 | |
| }
 | |
| 
 | |
| // WithSilencePeriod sets the silence period.
 | |
| // The connection manager will perform a cleanup once per silence period
 | |
| // if the number of connections surpasses the high watermark.
 | |
| func WithSilencePeriod(p time.Duration) Option {
 | |
| 	return func(cfg *config) error {
 | |
| 		if p <= 0 {
 | |
| 			return errors.New("silence period must be non-zero")
 | |
| 		}
 | |
| 		cfg.silencePeriod = p
 | |
| 		return nil
 | |
| 	}
 | |
| }
 |