SPB Git

Repository Public

types.go 2.0 KB 69 lines go

1// Package maintenance implements the maintenance calendar of the cluster:2// windows, their recurrence (wall-clock stable across DST changes) and the3// iCalendar (RFC 5545) export. This part of the package is pure: no database,4// no HTTP.5package maintenance67import (8	"time"910	"github.com/google/uuid"11)1213// Recurrence values.14const (15	RecurrenceNone    = "none"16	RecurrenceDaily   = "daily"17	RecurrenceWeekly  = "weekly"18	RecurrenceMonthly = "monthly"19)2021// Category values.22const (23	CategoryPlanned    = "planned"24	CategoryEmergency  = "emergency"25	CategoryUpdate     = "update"26	CategoryHardware   = "hardware"27	CategoryInspection = "inspection"28)2930// Status values.31const (32	StatusScheduled  = "scheduled"33	StatusInProgress = "in_progress"34	StatusCompleted  = "completed"35	StatusCancelled  = "cancelled"36)3738// Window is a maintenance window. StartsAt/EndsAt describe the FIRST39// occurrence [StartsAt, EndsAt) as absolute instants (stored in UTC);40// Timezone is the IANA zone in which the recurrence keeps its local41// wall-clock time.42type Window struct {43	ID                   uuid.UUID44	Title, Description   string45	Category             string     // planned|emergency|update|hardware|inspection46	StartsAt, EndsAt     time.Time  // first occurrence47	Timezone             string     // IANA48	Recurrence           string     // none|daily|weekly|monthly49	RecurrenceUntil      *time.Time // last allowed occurrence START (inclusive)50	NodeIDs              []uuid.UUID51	SetMaintenanceMode   bool52	SilenceAlerts        bool53	Status               string // scheduled|in_progress|completed|cancelled54	ActivatedOccurrence  *time.Time55	CompletedOccurrence  *time.Time56	CreatedBy            *uuid.UUID57	CreatedAt, UpdatedAt time.Time58}5960// Occurrence is one concrete occurrence [Start, End) of a window, in UTC.61type Occurrence struct{ Start, End time.Time }6263// MaxDuration is the longest allowed occurrence.64const MaxDuration = 14 * 24 * time.Hour6566// MaxOccurrences is the hard cap on the number of occurrences returned by67// one Expand call.68const MaxOccurrences = 100069
Files main
Menu

Theme