admin

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

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")
)

Functions

This section is empty.

Types

type CacheExternal

type CacheExternal struct {
	ModelID   string        `json:"model_id"`
	Min       uint64        `json:"min"`
	Max       uint64        `json:"max"`
	UpdatedAt time.Time     `json:"updated_at"`
	TTL       time.Duration `json:"ttl"`
}

CacheExternal 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) GetExternal

func (c *CacheManager) GetExternal(ctx context.Context, modelID string) (*CacheExternal, error)

GetExternal retrieves cached external model bounds from Redis

func (*CacheManager) InvalidateExternal

func (c *CacheManager) InvalidateExternal(ctx context.Context, modelID string) error

InvalidateExternal removes external model bounds from cache

func (*CacheManager) SetExternal

func (c *CacheManager) SetExternal(ctx context.Context, cache CacheExternal) error

SetExternal stores external model bounds in Redis cache

type GapInfo

type GapInfo struct {
	StartPos uint64
	EndPos   uint64
}

GapInfo represents a gap in the processed data

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages the admin tracking table for completed transformations

func NewService

func NewService(client clickhouse.ClientInterface, cluster, localSuffix, adminDatabase, adminTable string, redisClient *redis.Client) *Service

NewService creates a new admin table manager

func (*Service) DeleteRange

func (a *Service) DeleteRange(ctx context.Context, modelID string, startPos, endPos uint64) error

DeleteRange deletes entries in a range from the admin table

func (*Service) FindGaps

func (a *Service) FindGaps(ctx context.Context, modelID string, minPos, maxPos, interval uint64) ([]GapInfo, error)

FindGaps finds all gaps in the processed data for a model

func (*Service) GetAdminDatabase

func (a *Service) GetAdminDatabase() string

GetAdminDatabase returns the admin database name

func (*Service) GetAdminTable

func (a *Service) GetAdminTable() string

GetAdminTable returns the admin table name

func (*Service) GetCacheManager

func (a *Service) GetCacheManager() *CacheManager

GetCacheManager returns the cache manager instance

func (*Service) GetCoverage

func (a *Service) GetCoverage(ctx context.Context, modelID string, startPos, endPos uint64) (bool, error)

GetCoverage checks if a range is fully covered in the admin table

func (*Service) GetFirstPosition

func (a *Service) GetFirstPosition(ctx context.Context, modelID string) (uint64, error)

GetFirstPosition returns the first processed position for a model

func (*Service) GetLastPosition

func (a *Service) GetLastPosition(ctx context.Context, modelID string) (uint64, error)

GetLastPosition returns the last processed position for a model

func (*Service) RecordCompletion

func (a *Service) RecordCompletion(ctx context.Context, modelID string, position, interval uint64) error

RecordCompletion records a completed transformation in the admin table

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL