Documentation
¶
Index ¶
- Constants
- type Cycle
- type CycleConfig
- type CycleMetadata
- type DefaultThrottle
- type MetadataReadWriter
- type MockCycle
- func (m *MockCycle) ID() string
- func (m *MockCycle) Metadata() CycleMetadata
- func (m *MockCycle) Name() string
- func (m *MockCycle) Reset()
- func (m *MockCycle) SetMetadata(state CycleMetadata)
- func (m *MockCycle) Start()
- func (m *MockCycle) State() []string
- func (m *MockCycle) Stop()
- func (m *MockCycle) TransformToConfig() CycleConfig
- func (m *MockCycle) Type() string
- type MockMetadataRW
- type MockScheduler
- func (m *MockScheduler) AddCycle(cycle Cycle) error
- func (m *MockScheduler) AddThrottle(name string, throttleInterval string) error
- func (m *MockScheduler) AutomaticToggleHandler(toggleValue string)
- func (m *MockScheduler) Cycles() map[string]Cycle
- func (m *MockScheduler) DeleteCycle(cycleID string) error
- func (m *MockScheduler) DeleteThrottle(name string) error
- func (m *MockScheduler) IsAutomaticallyDisabled() bool
- func (m *MockScheduler) IsEnabled() bool
- func (m *MockScheduler) IsRunning() bool
- func (m *MockScheduler) ManualToggleHandler(toggleValue string)
- func (m *MockScheduler) NewCycle(config CycleConfig) (Cycle, error)
- func (m *MockScheduler) RestorePreviousState()
- func (m *MockScheduler) Shutdown() error
- func (m *MockScheduler) Start() error
- func (m *MockScheduler) Throttles() map[string]Throttle
- func (m *MockScheduler) WasAutomaticallyDisabled() bool
- type MockThrottle
- type ScalingWindowCycle
- type Scheduler
- type State
- type Throttle
- func NewCappedDynamicThrottle(interval time.Duration, minThrottle time.Duration, maxThrottle time.Duration, ...) (Throttle, context.CancelFunc)
- func NewDynamicThrottle(interval time.Duration, minimumThrottle time.Duration, publishes int, ...) (Throttle, context.CancelFunc)
- func NewThrottle(interval time.Duration, burst int) (Throttle, context.CancelFunc)
- type ThrottledWholeCollectionCycle
- func (a ThrottledWholeCollectionCycle) ID() string
- func (a ThrottledWholeCollectionCycle) Metadata() CycleMetadata
- func (a ThrottledWholeCollectionCycle) Name() string
- func (a ThrottledWholeCollectionCycle) PublishedItems() int
- func (a ThrottledWholeCollectionCycle) Reset()
- func (a ThrottledWholeCollectionCycle) SetMetadata(metadata CycleMetadata)
- func (l *ThrottledWholeCollectionCycle) Start()
- func (a ThrottledWholeCollectionCycle) State() []string
- func (a ThrottledWholeCollectionCycle) Stop()
- func (s *ThrottledWholeCollectionCycle) TransformToConfig() CycleConfig
- func (a ThrottledWholeCollectionCycle) Type() string
- func (a ThrottledWholeCollectionCycle) UpdateState(states ...string)
Constants ¶
View Source
const (
ThrottledWholeCollectionType = "ThrottledWholeCollection"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cycle ¶
type Cycle interface { ID() string Name() string Type() string Start() Stop() Reset() Metadata() CycleMetadata SetMetadata(state CycleMetadata) TransformToConfig() CycleConfig State() []string }
func NewScalingWindowCycle ¶
type CycleConfig ¶
type CycleConfig struct { Name string `yaml:"name" json:"name"` Type string `yaml:"type" json:"type"` Origin string `yaml:"origin" json:"origin"` Collection string `yaml:"collection" json:"collection"` CoolDown string `yaml:"coolDown" json:"coolDown"` Throttle string `yaml:"throttle" json:"throttle,omitempty"` TimeWindow string `yaml:"timeWindow" json:"timeWindow,omitempty"` MinimumThrottle string `yaml:"minimumThrottle" json:"minimumThrottle,omitempty"` MaximumThrottle string `yaml:"maximumThrottle" json:"maximumThrottle,omitempty"` }
func (CycleConfig) Validate ¶
func (c CycleConfig) Validate() error
Validate checks the provided config for errors
type CycleMetadata ¶
type CycleMetadata struct { CurrentPublishUUID string `json:"currentPublishUuid"` CurrentPublishRef string `json:"currentPublishReference"` CurrentPublishError string `json:"currentPublishError,omitempty"` Errors int `json:"errors"` Progress float64 `json:"progress"` State []string `json:"state"` Completed int `json:"completed"` Total int `json:"total"` Iteration int `json:"iteration"` Attempts int `json:"attempts"` Start *time.Time `json:"windowStart,omitempty"` End *time.Time `json:"windowEnd,omitempty"` }
type DefaultThrottle ¶
type DefaultThrottle struct { Context context.Context Limiter *rate.Limiter // contains filtered or unexported fields }
func (*DefaultThrottle) Interval ¶
func (d *DefaultThrottle) Interval() time.Duration
func (*DefaultThrottle) MarshalJSON ¶ added in v0.2.12
func (d *DefaultThrottle) MarshalJSON() ([]byte, error)
func (*DefaultThrottle) Queue ¶
func (d *DefaultThrottle) Queue() error
func (*DefaultThrottle) Stop ¶
func (d *DefaultThrottle) Stop()
func (*DefaultThrottle) UnmarshalJSON ¶ added in v0.2.12
func (d *DefaultThrottle) UnmarshalJSON(in []byte) error
type MetadataReadWriter ¶
type MetadataReadWriter interface { LoadMetadata(id string) (CycleMetadata, error) WriteMetadata(id string, config CycleConfig, metadata CycleMetadata) error }
func NewS3MetadataReadWriter ¶
func NewS3MetadataReadWriter(rw s3.ReadWriter) MetadataReadWriter
type MockCycle ¶
func (*MockCycle) Metadata ¶
func (m *MockCycle) Metadata() CycleMetadata
func (*MockCycle) SetMetadata ¶
func (m *MockCycle) SetMetadata(state CycleMetadata)
func (*MockCycle) TransformToConfig ¶
func (m *MockCycle) TransformToConfig() CycleConfig
type MockMetadataRW ¶
MetadataRWMock is a mock of a MetadataReadWriter that can be used to test
func (*MockMetadataRW) LoadMetadata ¶
func (m *MockMetadataRW) LoadMetadata(id string) (CycleMetadata, error)
func (*MockMetadataRW) WriteMetadata ¶
func (m *MockMetadataRW) WriteMetadata(id string, config CycleConfig, metadata CycleMetadata) error
type MockScheduler ¶
func (*MockScheduler) AddCycle ¶
func (m *MockScheduler) AddCycle(cycle Cycle) error
func (*MockScheduler) AddThrottle ¶
func (m *MockScheduler) AddThrottle(name string, throttleInterval string) error
func (*MockScheduler) AutomaticToggleHandler ¶ added in v0.2.12
func (m *MockScheduler) AutomaticToggleHandler(toggleValue string)
func (*MockScheduler) Cycles ¶
func (m *MockScheduler) Cycles() map[string]Cycle
func (*MockScheduler) DeleteCycle ¶
func (m *MockScheduler) DeleteCycle(cycleID string) error
func (*MockScheduler) DeleteThrottle ¶
func (m *MockScheduler) DeleteThrottle(name string) error
func (*MockScheduler) IsAutomaticallyDisabled ¶ added in v0.2.12
func (m *MockScheduler) IsAutomaticallyDisabled() bool
func (*MockScheduler) IsEnabled ¶ added in v0.2.12
func (m *MockScheduler) IsEnabled() bool
func (*MockScheduler) IsRunning ¶ added in v0.2.12
func (m *MockScheduler) IsRunning() bool
func (*MockScheduler) ManualToggleHandler ¶ added in v0.2.12
func (m *MockScheduler) ManualToggleHandler(toggleValue string)
func (*MockScheduler) NewCycle ¶
func (m *MockScheduler) NewCycle(config CycleConfig) (Cycle, error)
func (*MockScheduler) RestorePreviousState ¶
func (m *MockScheduler) RestorePreviousState()
func (*MockScheduler) Shutdown ¶
func (m *MockScheduler) Shutdown() error
func (*MockScheduler) Start ¶
func (m *MockScheduler) Start() error
func (*MockScheduler) Throttles ¶
func (m *MockScheduler) Throttles() map[string]Throttle
func (*MockScheduler) WasAutomaticallyDisabled ¶ added in v0.2.12
func (m *MockScheduler) WasAutomaticallyDisabled() bool
type MockThrottle ¶
func (*MockThrottle) Interval ¶
func (m *MockThrottle) Interval() time.Duration
func (*MockThrottle) Queue ¶
func (m *MockThrottle) Queue() error
func (*MockThrottle) Stop ¶
func (m *MockThrottle) Stop()
type ScalingWindowCycle ¶
type ScalingWindowCycle struct { MaximumThrottle string `json:"maximumThrottle"` // contains filtered or unexported fields }
func (*ScalingWindowCycle) Start ¶
func (s *ScalingWindowCycle) Start()
func (*ScalingWindowCycle) TransformToConfig ¶
func (s *ScalingWindowCycle) TransformToConfig() CycleConfig
type Scheduler ¶
type Scheduler interface { Cycles() map[string]Cycle NewCycle(config CycleConfig) (Cycle, error) AddCycle(cycle Cycle) error DeleteCycle(cycleID string) error RestorePreviousState() Start() error Shutdown() error ManualToggleHandler(toggleValue string) AutomaticToggleHandler(toggleValue string) IsRunning() bool IsEnabled() bool IsAutomaticallyDisabled() bool WasAutomaticallyDisabled() bool }
Scheduler is the main component of the publish carousel, which handles the publish cycles.
func LoadSchedulerFromFile ¶
func LoadSchedulerFromFile(configFile string, uuidCollectionBuilder *native.NativeUUIDCollectionBuilder, publishTask tasks.Task, rw MetadataReadWriter, defaultThrottle time.Duration, checkpointInterval time.Duration) (Scheduler, error)
LoadSchedulerFromFile loads cycles and throttles from the provided yaml config file
func NewScheduler ¶
func NewScheduler(uuidCollectionBuilder *native.NativeUUIDCollectionBuilder, publishTask tasks.Task, metadataReadWriter MetadataReadWriter, defaultThrottle time.Duration, checkpointInterval time.Duration) Scheduler
NewScheduler returns a new instance of the cycles scheduler
type State ¶ added in v0.2.12
type State struct {
// contains filtered or unexported fields
}
func (*State) MarshalJSON ¶ added in v0.2.12
func (*State) UnmarshalJSON ¶ added in v0.2.12
type ThrottledWholeCollectionCycle ¶
type ThrottledWholeCollectionCycle struct { Throttle Throttle `json:"throttle"` // contains filtered or unexported fields }
func (ThrottledWholeCollectionCycle) Metadata ¶
func (a ThrottledWholeCollectionCycle) Metadata() CycleMetadata
func (ThrottledWholeCollectionCycle) Name ¶ added in v0.2.12
func (a ThrottledWholeCollectionCycle) Name() string
func (ThrottledWholeCollectionCycle) PublishedItems ¶
func (a ThrottledWholeCollectionCycle) PublishedItems() int
func (ThrottledWholeCollectionCycle) SetMetadata ¶
func (a ThrottledWholeCollectionCycle) SetMetadata(metadata CycleMetadata)
func (*ThrottledWholeCollectionCycle) Start ¶
func (l *ThrottledWholeCollectionCycle) Start()
func (ThrottledWholeCollectionCycle) State ¶
func (a ThrottledWholeCollectionCycle) State() []string
func (*ThrottledWholeCollectionCycle) TransformToConfig ¶
func (s *ThrottledWholeCollectionCycle) TransformToConfig() CycleConfig
func (ThrottledWholeCollectionCycle) Type ¶ added in v0.2.12
func (a ThrottledWholeCollectionCycle) Type() string
func (ThrottledWholeCollectionCycle) UpdateState ¶
func (a ThrottledWholeCollectionCycle) UpdateState(states ...string)
Click to show internal directories.
Click to hide internal directories.