admin

package
v0.0.52 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: GPL-3.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package admin provides administration and caching services for CBT

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCacheManagerUnavailable is returned when cache manager is not available
	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"`

	// Initial scan tracking
	InitialScanComplete bool       `json:"initial_scan_complete"`
	InitialScanStarted  *time.Time `json:"initial_scan_started,omitempty"`

	// 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 GapInfo

type GapInfo struct {
	StartPos uint64
	EndPos   uint64
}

GapInfo represents a gap in the processed data

type ProcessedRange added in v0.0.25

type ProcessedRange struct {
	Position uint64 `ch:"position"`
	Interval uint64 `ch:"interval"`
}

ProcessedRange represents a processed range from the admin table

type Service

type Service interface {
	// Position tracking (for incremental transformations)
	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

	// Scheduled transformation tracking
	RecordScheduledCompletion(ctx context.Context, modelID string, startDateTime time.Time) error
	GetLastScheduledExecution(ctx context.Context, modelID string) (*time.Time, error)

	// Coverage and gap management
	GetCoverage(ctx context.Context, modelID string, startPos, endPos uint64) (bool, error)
	GetProcessedRanges(ctx context.Context, modelID string) ([]ProcessedRange, 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
	GetIncrementalAdminDatabase() string
	GetIncrementalAdminTable() string
	GetScheduledAdminDatabase() string
	GetScheduledAdminTable() string
}

Service defines the public interface for the admin service

func NewService

func NewService(log logrus.FieldLogger, client clickhouse.ClientInterface, cluster, localSuffix string, config TableConfig, redisClient *redis.Client) Service

NewService creates a new admin table manager with type-specific admin tables

type TableConfig added in v0.0.25

type TableConfig struct {
	IncrementalDatabase string
	IncrementalTable    string
	ScheduledDatabase   string
	ScheduledTable      string
}

TableConfig represents configuration for admin tables

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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