storage

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CobaltDB

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

CobaltDB implements a B+Tree-based embedded storage engine optimized for time-series monitoring data with MVCC support.

func NewEngine

func NewEngine(config core.StorageConfig, logger *slog.Logger) (*CobaltDB, error)

NewEngine creates a new CobaltDB storage engine

func (*CobaltDB) AcknowledgeVerdict

func (db *CobaltDB) AcknowledgeVerdict(ctx context.Context, workspaceID, verdictID, user string) error

AcknowledgeVerdict marks a verdict as acknowledged

func (*CobaltDB) Close

func (db *CobaltDB) Close() error

Close shuts down the storage engine

func (*CobaltDB) Delete

func (db *CobaltDB) Delete(key string) error

Delete removes a key-value pair

func (*CobaltDB) DeleteAlertChannel

func (db *CobaltDB) DeleteAlertChannel(id string) error

DeleteAlertChannel removes an alert channel

func (*CobaltDB) DeleteAlertRule

func (db *CobaltDB) DeleteAlertRule(id string) error

DeleteAlertRule removes an alert rule

func (*CobaltDB) DeleteChannel

func (db *CobaltDB) DeleteChannel(ctx context.Context, id string) error

DeleteChannel removes a channel

func (*CobaltDB) DeleteChannelNoCtx

func (db *CobaltDB) DeleteChannelNoCtx(id string) error

DeleteChannelNoCtx deletes a channel

func (*CobaltDB) DeleteJourney

func (db *CobaltDB) DeleteJourney(ctx context.Context, workspaceID, journeyID string) error

DeleteJourney removes a journey

func (*CobaltDB) DeleteJourneyNoCtx added in v0.1.0

func (db *CobaltDB) DeleteJourneyNoCtx(id string) error

func (*CobaltDB) DeletePrefix

func (db *CobaltDB) DeletePrefix(prefix string) error

DeletePrefix removes all key-value pairs with the given prefix

func (*CobaltDB) DeleteRule

func (db *CobaltDB) DeleteRule(ctx context.Context, id string) error

DeleteRule removes an alert rule

func (*CobaltDB) DeleteRuleNoCtx

func (db *CobaltDB) DeleteRuleNoCtx(id string) error

DeleteRuleNoCtx deletes a rule

func (*CobaltDB) DeleteSoul

func (db *CobaltDB) DeleteSoul(ctx context.Context, workspaceID, soulID string) error

DeleteSoul removes a soul

func (*CobaltDB) DeleteStatusPage

func (db *CobaltDB) DeleteStatusPage(id string) error

func (*CobaltDB) DeleteStatusPageNoCtx

func (db *CobaltDB) DeleteStatusPageNoCtx(id string) error

func (*CobaltDB) DeleteStatusPageSubscription

func (db *CobaltDB) DeleteStatusPageSubscription(subscriptionID string) error

func (*CobaltDB) DeleteWorkspace

func (db *CobaltDB) DeleteWorkspace(ctx context.Context, id string) error

DeleteWorkspace removes a workspace

func (*CobaltDB) DeleteWorkspaceNoCtx

func (db *CobaltDB) DeleteWorkspaceNoCtx(id string) error

DeleteWorkspaceNoCtx deletes a workspace

func (*CobaltDB) Get

func (db *CobaltDB) Get(key string) ([]byte, error)

Get retrieves a value by key

func (*CobaltDB) GetActiveVerdicts

func (db *CobaltDB) GetActiveVerdicts(ctx context.Context, workspaceID, soulID string) ([]*core.Verdict, error)

GetActiveVerdicts returns all active (non-resolved) verdicts for a soul

func (*CobaltDB) GetAlertChannel

func (db *CobaltDB) GetAlertChannel(id string) (*core.AlertChannel, error)

GetAlertChannel retrieves an alert channel by ID

func (*CobaltDB) GetAlertRule

func (db *CobaltDB) GetAlertRule(id string) (*core.AlertRule, error)

GetAlertRule retrieves an alert rule by ID

func (*CobaltDB) GetChannel

func (db *CobaltDB) GetChannel(ctx context.Context, id string) (*core.ChannelConfig, error)

GetChannel retrieves a channel by name

func (*CobaltDB) GetChannelNoCtx

func (db *CobaltDB) GetChannelNoCtx(id string) (*core.AlertChannel, error)

GetChannelNoCtx retrieves a channel by ID

func (*CobaltDB) GetIncident

func (db *CobaltDB) GetIncident(id string) (*core.Incident, error)

GetIncident retrieves an incident by ID

func (*CobaltDB) GetJourney

func (db *CobaltDB) GetJourney(ctx context.Context, workspaceID, journeyID string) (*core.JourneyConfig, error)

GetJourney retrieves a journey by ID

func (*CobaltDB) GetJourneyNoCtx added in v0.1.0

func (db *CobaltDB) GetJourneyNoCtx(id string) (*core.JourneyConfig, error)

func (*CobaltDB) GetJudgment

func (db *CobaltDB) GetJudgment(ctx context.Context, workspaceID, soulID string, timestamp time.Time) (*core.Judgment, error)

GetJudgment retrieves a judgment by soul ID and timestamp

func (*CobaltDB) GetJudgmentNoCtx

func (db *CobaltDB) GetJudgmentNoCtx(id string) (*core.Judgment, error)

GetJudgmentNoCtx retrieves a judgment by ID

func (*CobaltDB) GetLatestJudgment

func (db *CobaltDB) GetLatestJudgment(ctx context.Context, workspaceID, soulID string) (*core.Judgment, error)

GetLatestJudgment retrieves the most recent judgment for a soul

func (*CobaltDB) GetRaftLogEntry

func (db *CobaltDB) GetRaftLogEntry(ctx context.Context, index uint64) (term uint64, data []byte, err error)

GetRaftLogEntry retrieves a Raft log entry

func (*CobaltDB) GetRaftState

func (db *CobaltDB) GetRaftState(ctx context.Context) (currentTerm uint64, votedFor string, err error)

GetRaftState retrieves Raft persistent state

func (*CobaltDB) GetRule

func (db *CobaltDB) GetRule(ctx context.Context, id string) (*core.AlertRule, error)

GetRule retrieves an alert rule by ID

func (*CobaltDB) GetRuleNoCtx

func (db *CobaltDB) GetRuleNoCtx(id string) (*core.AlertRule, error)

GetRuleNoCtx retrieves a rule by ID

func (*CobaltDB) GetSoul

func (db *CobaltDB) GetSoul(ctx context.Context, workspaceID, soulID string) (*core.Soul, error)

GetSoul retrieves a soul by ID

func (*CobaltDB) GetSoulJudgments

func (db *CobaltDB) GetSoulJudgments(soulID string, limit int) ([]core.Judgment, error)

GetSoulJudgments retrieves recent judgments for a soul (for status page)

func (*CobaltDB) GetSoulNoCtx

func (db *CobaltDB) GetSoulNoCtx(id string) (*core.Soul, error)

GetSoulNoCtx retrieves a soul by ID (REST API compatible)

func (*CobaltDB) GetSoulPurity

func (db *CobaltDB) GetSoulPurity(ctx context.Context, workspaceID, soulID string, window time.Duration) (float64, error)

GetSoulPurity calculates uptime percentage for a soul over a time window

func (*CobaltDB) GetStats

func (db *CobaltDB) GetStats(ctx context.Context, workspaceID string, start, end time.Time) (*core.Stats, error)

GetStats returns statistics for a workspace

func (*CobaltDB) GetStatsNoCtx

func (db *CobaltDB) GetStatsNoCtx(workspace string, start, end time.Time) (*core.Stats, error)

GetStatsNoCtx gets stats without context

func (*CobaltDB) GetStatusPage

func (db *CobaltDB) GetStatusPage(id string) (*core.StatusPage, error)

func (*CobaltDB) GetStatusPageByDomain

func (db *CobaltDB) GetStatusPageByDomain(domain string) (*core.StatusPage, error)

func (*CobaltDB) GetStatusPageBySlug

func (db *CobaltDB) GetStatusPageBySlug(slug string) (*core.StatusPage, error)

func (*CobaltDB) GetStatusPageNoCtx

func (db *CobaltDB) GetStatusPageNoCtx(id string) (*core.StatusPage, error)

func (*CobaltDB) GetSubscriptionsByPage

func (db *CobaltDB) GetSubscriptionsByPage(pageID string) ([]*core.StatusPageSubscription, error)

func (*CobaltDB) GetSystemConfig

func (db *CobaltDB) GetSystemConfig(ctx context.Context, key string) ([]byte, error)

GetSystemConfig retrieves system configuration

func (*CobaltDB) GetUptimeHistory

func (db *CobaltDB) GetUptimeHistory(soulID string, days int) ([]core.UptimeDay, error)

func (*CobaltDB) GetVerdict

func (db *CobaltDB) GetVerdict(ctx context.Context, workspaceID, verdictID string) (*core.Verdict, error)

GetVerdict retrieves a verdict by ID

func (*CobaltDB) GetWorkspace

func (db *CobaltDB) GetWorkspace(ctx context.Context, id string) (*core.Workspace, error)

GetWorkspace retrieves a workspace by ID

func (*CobaltDB) GetWorkspaceNoCtx

func (db *CobaltDB) GetWorkspaceNoCtx(id string) (*core.Workspace, error)

GetWorkspaceNoCtx retrieves a workspace

func (*CobaltDB) List

func (db *CobaltDB) List(prefix string) ([]string, error)

List returns all keys with the given prefix

func (*CobaltDB) ListActiveIncidents

func (db *CobaltDB) ListActiveIncidents() ([]*core.Incident, error)

ListActiveIncidents returns all non-resolved incidents

func (*CobaltDB) ListAlertChannels

func (db *CobaltDB) ListAlertChannels() ([]*core.AlertChannel, error)

ListAlertChannels returns all alert channels

func (*CobaltDB) ListAlertEvents

func (db *CobaltDB) ListAlertEvents(soulID string, limit int) ([]*core.AlertEvent, error)

ListAlertEvents returns alert events for a soul

func (*CobaltDB) ListAlertRules

func (db *CobaltDB) ListAlertRules() ([]*core.AlertRule, error)

ListAlertRules returns all alert rules

func (*CobaltDB) ListChannels

func (db *CobaltDB) ListChannels(ctx context.Context, workspaceID string) ([]*core.ChannelConfig, error)

ListChannels returns all channels in a workspace

func (*CobaltDB) ListChannelsNoCtx

func (db *CobaltDB) ListChannelsNoCtx(workspace string) ([]*core.AlertChannel, error)

ListChannelsNoCtx lists channels

func (*CobaltDB) ListJackals

func (db *CobaltDB) ListJackals(ctx context.Context) (map[string]map[string]string, error)

ListJackals returns all registered nodes

func (*CobaltDB) ListJourneys

func (db *CobaltDB) ListJourneys(ctx context.Context, workspaceID string) ([]*core.JourneyConfig, error)

ListJourneys returns all journeys in a workspace

func (*CobaltDB) ListJourneysNoCtx added in v0.1.0

func (db *CobaltDB) ListJourneysNoCtx(workspace string, offset, limit int) ([]*core.JourneyConfig, error)

func (*CobaltDB) ListJudgments

func (db *CobaltDB) ListJudgments(ctx context.Context, soulID string, start, end time.Time, limit int) ([]*core.Judgment, error)

ListJudgments returns judgments for a soul within a time range

func (*CobaltDB) ListJudgmentsNoCtx

func (db *CobaltDB) ListJudgmentsNoCtx(soulID string, start, end time.Time, limit int) ([]*core.Judgment, error)

ListJudgmentsNoCtx lists judgments in time range

func (*CobaltDB) ListRules

func (db *CobaltDB) ListRules(ctx context.Context, workspaceID string) ([]*core.AlertRule, error)

ListRules returns all rules in a workspace

func (*CobaltDB) ListRulesNoCtx

func (db *CobaltDB) ListRulesNoCtx(workspace string) ([]*core.AlertRule, error)

ListRulesNoCtx lists rules

func (*CobaltDB) ListSouls

func (db *CobaltDB) ListSouls(ctx context.Context, workspaceID string, offset, limit int) ([]*core.Soul, error)

ListSouls returns all souls in a workspace with pagination

func (*CobaltDB) ListSoulsNoCtx

func (db *CobaltDB) ListSoulsNoCtx(workspace string, offset, limit int) ([]*core.Soul, error)

ListSoulsNoCtx lists souls for REST API (no context)

func (*CobaltDB) ListStatusPages

func (db *CobaltDB) ListStatusPages() ([]*core.StatusPage, error)

func (*CobaltDB) ListStatusPagesNoCtx

func (db *CobaltDB) ListStatusPagesNoCtx() ([]*core.StatusPage, error)

func (*CobaltDB) ListVerdicts

func (db *CobaltDB) ListVerdicts(ctx context.Context, workspaceID string, status core.VerdictStatus, limit int) ([]*core.Verdict, error)

ListVerdicts returns verdicts for a workspace with optional filters

func (*CobaltDB) ListWorkspaces

func (db *CobaltDB) ListWorkspaces(ctx context.Context) ([]*core.Workspace, error)

ListWorkspaces returns all workspaces

func (*CobaltDB) ListWorkspacesNoCtx

func (db *CobaltDB) ListWorkspacesNoCtx() ([]*core.Workspace, error)

ListWorkspacesNoCtx lists workspaces

func (*CobaltDB) PrefixScan

func (db *CobaltDB) PrefixScan(prefix string) (map[string][]byte, error)

PrefixScan returns all key-value pairs with the given prefix

func (*CobaltDB) Put

func (db *CobaltDB) Put(key string, value []byte) error

Put stores a key-value pair

func (*CobaltDB) QueryJourneyRuns

func (db *CobaltDB) QueryJourneyRuns(ctx context.Context, workspaceID, journeyID string, limit int) ([]*core.JourneyRun, error)

QueryJourneyRuns retrieves runs for a journey

func (*CobaltDB) QueryJudgments

func (db *CobaltDB) QueryJudgments(ctx context.Context, workspaceID, soulID string, start, end time.Time, limit int) ([]*core.Judgment, error)

QueryJudgments retrieves judgments for a soul within a time range

func (*CobaltDB) RangeScan

func (db *CobaltDB) RangeScan(start, end string) (map[string][]byte, error)

RangeScan returns all key-value pairs in the given range [start, end)

func (*CobaltDB) SaveAlertChannel

func (db *CobaltDB) SaveAlertChannel(ch *core.AlertChannel) error

SaveAlertChannel saves an alert channel

func (*CobaltDB) SaveAlertEvent

func (db *CobaltDB) SaveAlertEvent(event *core.AlertEvent) error

SaveAlertEvent saves an alert event

func (*CobaltDB) SaveAlertRule

func (db *CobaltDB) SaveAlertRule(rule *core.AlertRule) error

SaveAlertRule saves an alert rule

func (*CobaltDB) SaveChannel

func (db *CobaltDB) SaveChannel(ctx context.Context, ch *core.ChannelConfig) error

SaveChannel saves an alert channel configuration

func (*CobaltDB) SaveChannelNoCtx

func (db *CobaltDB) SaveChannelNoCtx(ch *core.AlertChannel) error

SaveChannelNoCtx saves a channel without context

func (*CobaltDB) SaveIncident

func (db *CobaltDB) SaveIncident(incident *core.Incident) error

SaveIncident saves an incident

func (*CobaltDB) SaveJackal

func (db *CobaltDB) SaveJackal(ctx context.Context, nodeID, address, region string) error

SaveJackal registers a cluster node

func (*CobaltDB) SaveJourney

func (db *CobaltDB) SaveJourney(ctx context.Context, j *core.JourneyConfig) error

SaveJourney saves a journey configuration

func (*CobaltDB) SaveJourneyNoCtx added in v0.1.0

func (db *CobaltDB) SaveJourneyNoCtx(journey *core.JourneyConfig) error

func (*CobaltDB) SaveJourneyRun

func (db *CobaltDB) SaveJourneyRun(ctx context.Context, run *core.JourneyRun) error

SaveJourneyRun saves a journey execution result

func (*CobaltDB) SaveJudgment

func (db *CobaltDB) SaveJudgment(ctx context.Context, j *core.Judgment) error

SaveJudgment saves a judgment to time-series storage

func (*CobaltDB) SaveRaftLogEntry

func (db *CobaltDB) SaveRaftLogEntry(ctx context.Context, index uint64, term uint64, data []byte) error

SaveRaftLogEntry saves a Raft log entry

func (*CobaltDB) SaveRaftState

func (db *CobaltDB) SaveRaftState(ctx context.Context, currentTerm uint64, votedFor string) error

SaveRaftState saves Raft persistent state

func (*CobaltDB) SaveRule

func (db *CobaltDB) SaveRule(ctx context.Context, rule *core.AlertRule) error

SaveRule saves an alert rule

func (*CobaltDB) SaveRuleNoCtx

func (db *CobaltDB) SaveRuleNoCtx(rule *core.AlertRule) error

SaveRuleNoCtx saves a rule without context

func (*CobaltDB) SaveSoul

func (db *CobaltDB) SaveSoul(ctx context.Context, soul *core.Soul) error

SaveSoul saves a soul to storage

func (*CobaltDB) SaveStatusPage

func (db *CobaltDB) SaveStatusPage(page *core.StatusPage) error

func (*CobaltDB) SaveStatusPageNoCtx

func (db *CobaltDB) SaveStatusPageNoCtx(page *core.StatusPage) error

func (*CobaltDB) SaveStatusPageSubscription

func (db *CobaltDB) SaveStatusPageSubscription(sub *core.StatusPageSubscription) error

func (*CobaltDB) SaveSystemConfig

func (db *CobaltDB) SaveSystemConfig(ctx context.Context, key string, value []byte) error

SaveSystemConfig saves global system configuration

func (*CobaltDB) SaveVerdict

func (db *CobaltDB) SaveVerdict(ctx context.Context, v *core.Verdict) error

SaveVerdict saves a verdict to storage

func (*CobaltDB) SaveWorkspace

func (db *CobaltDB) SaveWorkspace(ctx context.Context, ws *core.Workspace) error

SaveWorkspace saves a workspace

func (*CobaltDB) SaveWorkspaceNoCtx

func (db *CobaltDB) SaveWorkspaceNoCtx(ws *core.Workspace) error

SaveWorkspaceNoCtx saves a workspace

func (*CobaltDB) Set

func (db *CobaltDB) Set(key string, value []byte) error

Set stores a key-value pair (alias for Put to satisfy raft.Storage interface)

func (*CobaltDB) UpdateVerdictStatus

func (db *CobaltDB) UpdateVerdictStatus(ctx context.Context, workspaceID, verdictID string, status core.VerdictStatus) error

UpdateVerdictStatus updates a verdict's status

type CobaltDBLogStore

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

CobaltDBLogStore implements the raft.LogStore interface using CobaltDB

func NewCobaltDBLogStore

func NewCobaltDBLogStore(db *CobaltDB) *CobaltDBLogStore

NewCobaltDBLogStore creates a new LogStore backed by CobaltDB

func (*CobaltDBLogStore) DeleteRange

func (s *CobaltDBLogStore) DeleteRange(min, max uint64) error

DeleteRange deletes all log entries in the given range (inclusive)

func (*CobaltDBLogStore) FirstIndex

func (s *CobaltDBLogStore) FirstIndex() (uint64, error)

FirstIndex returns the first index in the log

func (*CobaltDBLogStore) GetLog

func (s *CobaltDBLogStore) GetLog(index uint64, log *core.RaftLogEntry) error

GetLog retrieves a log entry at the given index

func (*CobaltDBLogStore) LastIndex

func (s *CobaltDBLogStore) LastIndex() (uint64, error)

LastIndex returns the last index in the log

func (*CobaltDBLogStore) StoreLog

func (s *CobaltDBLogStore) StoreLog(log *core.RaftLogEntry) error

StoreLog stores a single log entry

func (*CobaltDBLogStore) StoreLogs

func (s *CobaltDBLogStore) StoreLogs(logs []core.RaftLogEntry) error

StoreLogs stores multiple log entries in batch

type CobaltDBSnapshotStore

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

CobaltDBSnapshotStore implements raft.SnapshotStore

func NewCobaltDBSnapshotStore

func NewCobaltDBSnapshotStore(db *CobaltDB) *CobaltDBSnapshotStore

NewCobaltDBSnapshotStore creates a new SnapshotStore backed by CobaltDB

func (*CobaltDBSnapshotStore) Create

func (s *CobaltDBSnapshotStore) Create(version, index, term uint64, configuration []byte) (raft.SnapshotSink, error)

Create creates a new snapshot

func (*CobaltDBSnapshotStore) List

List returns metadata for all snapshots

func (*CobaltDBSnapshotStore) Open

Open opens a snapshot for reading

type CobaltDBStableStore

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

CobaltDBStableStore implements raft.StableStore for stable storage

func NewCobaltDBStableStore

func NewCobaltDBStableStore(db *CobaltDB) *CobaltDBStableStore

NewCobaltDBStableStore creates a new StableStore backed by CobaltDB

func (*CobaltDBStableStore) Get

func (s *CobaltDBStableStore) Get(key string) ([]byte, error)

Get retrieves a byte slice

func (*CobaltDBStableStore) GetUint64

func (s *CobaltDBStableStore) GetUint64(key string) (uint64, error)

GetUint64 retrieves a uint64 value

func (*CobaltDBStableStore) Set

func (s *CobaltDBStableStore) Set(key string, val []byte) error

Set stores a byte slice

func (*CobaltDBStableStore) SetUint64

func (s *CobaltDBStableStore) SetUint64(key string, val uint64) error

SetUint64 stores a uint64 value

type JudgmentSummary

type JudgmentSummary struct {
	SoulID        string    `json:"soul_id"`
	WorkspaceID   string    `json:"workspace_id"`
	Resolution    string    `json:"resolution"`
	BucketTime    time.Time `json:"bucket_time"`
	Count         int       `json:"count"`
	SuccessCount  int       `json:"success_count"`
	FailureCount  int       `json:"failure_count"`
	MinLatency    float64   `json:"min_latency_ms"`
	MaxLatency    float64   `json:"max_latency_ms"`
	AvgLatency    float64   `json:"avg_latency_ms"`
	P50Latency    float64   `json:"p50_latency_ms"`
	P95Latency    float64   `json:"p95_latency_ms"`
	P99Latency    float64   `json:"p99_latency_ms"`
	UptimePercent float64   `json:"uptime_percent"`
	PacketLossAvg float64   `json:"packet_loss_avg,omitempty"`
}

JudgmentSummary aggregates multiple judgments into a time bucket

type RetentionManager

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

RetentionManager handles data retention and cleanup

func NewRetentionManager

func NewRetentionManager(db *CobaltDB, config core.RetentionConfig, dataPath string, logger *slog.Logger) *RetentionManager

NewRetentionManager creates a retention manager

func (*RetentionManager) GetStorageStats

func (rm *RetentionManager) GetStorageStats(ctx context.Context) (*StorageStats, error)

GetStorageStats returns storage statistics including disk usage

func (*RetentionManager) Start

func (rm *RetentionManager) Start()

Start starts the background retention cleanup goroutine

func (*RetentionManager) Stop added in v0.0.2

func (rm *RetentionManager) Stop()

Stop gracefully stops the retention manager

type StatusPageRepository

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

StatusPageRepository implements status page data access

func NewStatusPageRepository

func NewStatusPageRepository(storage *CobaltDB) *StatusPageRepository

NewStatusPageRepository creates a new status page repository

func (*StatusPageRepository) AddIncident added in v0.1.0

func (r *StatusPageRepository) AddIncident(pageID string, incident core.StatusIncident) error

AddIncident adds an incident to a status page

func (*StatusPageRepository) DeleteStatusPage

func (r *StatusPageRepository) DeleteStatusPage(id string) error

DeleteStatusPage deletes a status page

func (*StatusPageRepository) DeleteSubscription added in v0.1.0

func (r *StatusPageRepository) DeleteSubscription(subscriptionID string) error

DeleteSubscription removes a subscription

func (*StatusPageRepository) GetIncidentsByPage

func (r *StatusPageRepository) GetIncidentsByPage(pageID string) ([]core.StatusIncident, error)

GetIncidentsByPage retrieves incidents for a status page

func (*StatusPageRepository) GetSoul

func (r *StatusPageRepository) GetSoul(id string) (*core.Soul, error)

GetSoul retrieves a soul by ID

func (*StatusPageRepository) GetSoulJudgments

func (r *StatusPageRepository) GetSoulJudgments(soulID string, limit int) ([]core.Judgment, error)

GetSoulJudgments retrieves recent judgments for a soul

func (*StatusPageRepository) GetStatusPage

func (r *StatusPageRepository) GetStatusPage(id string) (*core.StatusPage, error)

GetStatusPage retrieves a status page by ID

func (*StatusPageRepository) GetStatusPageByDomain

func (r *StatusPageRepository) GetStatusPageByDomain(domain string) (*core.StatusPage, error)

GetStatusPageByDomain retrieves a status page by custom domain

func (*StatusPageRepository) GetStatusPageBySlug

func (r *StatusPageRepository) GetStatusPageBySlug(slug string) (*core.StatusPage, error)

GetStatusPageBySlug retrieves a status page by slug

func (*StatusPageRepository) GetSubscriptionsByPage added in v0.1.0

func (r *StatusPageRepository) GetSubscriptionsByPage(pageID string) ([]*core.StatusPageSubscription, error)

GetSubscriptionsByPage retrieves all subscriptions for a status page

func (*StatusPageRepository) GetUptimeHistory

func (r *StatusPageRepository) GetUptimeHistory(soulID string, days int) ([]core.UptimeDay, error)

GetUptimeHistory retrieves uptime history for a soul

func (*StatusPageRepository) GetWorkspace

func (r *StatusPageRepository) GetWorkspace(id string) (*core.Workspace, error)

GetWorkspace retrieves a workspace by ID

func (*StatusPageRepository) ListStatusPages

func (r *StatusPageRepository) ListStatusPages(workspaceID string) ([]*core.StatusPage, error)

ListStatusPages lists all status pages for a workspace

func (*StatusPageRepository) SaveStatusPage

func (r *StatusPageRepository) SaveStatusPage(page *core.StatusPage) error

SaveStatusPage saves a status page

func (*StatusPageRepository) SaveSubscription added in v0.1.0

func (r *StatusPageRepository) SaveSubscription(sub *core.StatusPageSubscription) error

SaveSubscription saves a status page subscription

func (*StatusPageRepository) SaveUptimeDay

func (r *StatusPageRepository) SaveUptimeDay(soulID string, day core.UptimeDay) error

SaveUptimeDay saves a day's uptime record

func (*StatusPageRepository) UpdateIncident added in v0.1.0

func (r *StatusPageRepository) UpdateIncident(pageID string, incidentID string, updates core.StatusIncident) error

UpdateIncident updates an incident on a status page

type StorageStats

type StorageStats struct {
	TotalKeys int              `json:"total_keys"`
	TotalSize int64            `json:"total_size"`
	DiskSize  int64            `json:"disk_size,omitempty"`  // Actual disk usage
	DiskFiles int64            `json:"disk_files,omitempty"` // Number of files on disk
	KeyCounts map[string]int   `json:"key_counts"`
	TypeSizes map[string]int64 `json:"type_sizes"`
}

StorageStats holds storage statistics

type TimeResolution

type TimeResolution string

TimeResolution represents different time granularities

const (
	ResolutionRaw   TimeResolution = "raw"
	Resolution1Min  TimeResolution = "1min"
	Resolution5Min  TimeResolution = "5min"
	Resolution1Hour TimeResolution = "1hour"
	Resolution1Day  TimeResolution = "1day"
)

type TimeSeriesStore

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

TimeSeriesStore provides optimized time-series storage

func NewTimeSeriesStore

func NewTimeSeriesStore(db *CobaltDB, config core.TimeSeriesConfig, logger *slog.Logger) *TimeSeriesStore

NewTimeSeriesStore creates a time-series store

func (*TimeSeriesStore) GetPurityFromSummaries

func (ts *TimeSeriesStore) GetPurityFromSummaries(ctx context.Context, workspaceID, soulID string, window time.Duration) (float64, error)

GetPurityFromSummaries calculates uptime from summaries (faster than raw)

func (*TimeSeriesStore) QuerySummaries

func (ts *TimeSeriesStore) QuerySummaries(ctx context.Context, workspaceID, soulID string, resolution TimeResolution, start, end time.Time) ([]*JudgmentSummary, error)

QuerySummaries retrieves aggregated summaries for a time range

func (*TimeSeriesStore) SaveJudgment

func (ts *TimeSeriesStore) SaveJudgment(ctx context.Context, j *core.Judgment) error

SaveJudgment saves a judgment and updates summaries

func (*TimeSeriesStore) StartCompaction

func (ts *TimeSeriesStore) StartCompaction()

StartCompaction starts the background compaction goroutine

Jump to

Keyboard shortcuts

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