Documentation
¶
Overview ¶
Package admin provides administration and caching services for CBT
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidModelID is returned when model ID format is invalid ErrInvalidModelID = errors.New("invalid model ID format: expected database.table") ErrCacheManagerUnavailable = errors.New("cache manager not available") )
Functions ¶
This section is empty.
Types ¶
type BoundsCache ¶ added in v0.0.2
type BoundsCache struct {
ModelID string `json:"model_id"`
Min uint64 `json:"min"`
Max uint64 `json:"max"`
// Track scan times
LastIncrementalScan time.Time `json:"last_incremental_scan"`
LastFullScan time.Time `json:"last_full_scan"`
// For optimization hints
PreviousMin uint64 `json:"previous_min"`
PreviousMax uint64 `json:"previous_max"`
// Metadata
UpdatedAt time.Time `json:"updated_at"`
}
BoundsCache represents cached external model bounds
type CacheManager ¶
type CacheManager struct {
// contains filtered or unexported fields
}
CacheManager manages Redis-based caching for external models
func NewCacheManager ¶
func NewCacheManager(redisClient *redis.Client) *CacheManager
NewCacheManager creates a new cache manager instance
func (*CacheManager) GetBounds ¶ added in v0.0.2
func (c *CacheManager) GetBounds(ctx context.Context, modelID string) (*BoundsCache, error)
GetBounds retrieves cached external model bounds from Redis
func (*CacheManager) SetBounds ¶ added in v0.0.2
func (c *CacheManager) SetBounds(ctx context.Context, cache *BoundsCache) error
SetBounds stores external model bounds in Redis cache (no TTL)
type Service ¶
type Service interface {
// Position tracking
GetLastProcessedEndPosition(ctx context.Context, modelID string) (uint64, error) // Returns end of last processed range
GetNextUnprocessedPosition(ctx context.Context, modelID string) (uint64, error) // Returns next position for forward fill
GetLastProcessedPosition(ctx context.Context, modelID string) (uint64, error) // Returns position of last record
GetFirstPosition(ctx context.Context, modelID string) (uint64, error)
RecordCompletion(ctx context.Context, modelID string, position, interval uint64) error
// Coverage and gap management
GetCoverage(ctx context.Context, modelID string, startPos, endPos uint64) (bool, error)
FindGaps(ctx context.Context, modelID string, minPos, maxPos, interval uint64) ([]GapInfo, error)
// Consolidation
ConsolidateHistoricalData(ctx context.Context, modelID string) (int, error)
// External bounds cache
GetExternalBounds(ctx context.Context, modelID string) (*BoundsCache, error)
SetExternalBounds(ctx context.Context, cache *BoundsCache) error
// Admin table info
GetAdminDatabase() string
GetAdminTable() string
}
Service defines the public interface for the admin service
func NewService ¶
func NewService(log logrus.FieldLogger, client clickhouse.ClientInterface, cluster, localSuffix, adminDatabase, adminTable string, redisClient *redis.Client) Service
NewService creates a new admin table manager
Click to show internal directories.
Click to hide internal directories.