aggregator

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action uint8

Action is used to manage a process

const (
	// StartAction is the action to start a process
	StartAction Action = iota
	// StopAction is the action to stop a process
	StopAction
)

func (Action) String

func (a Action) String() string

String converts an action to a readable string

type FeedAggregator

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

FeedAggregator aggregator

func NewFeedAggregator

func NewFeedAggregator(feed *app.Feed, om *output.Manager, delay time.Duration, timeout time.Duration, callbackURL string) *FeedAggregator

NewFeedAggregator creats a new feed aggregator

func (*FeedAggregator) GetFeedWithAggregationStatus

func (fa *FeedAggregator) GetFeedWithAggregationStatus() *app.Feed

GetFeedWithAggregationStatus get a copy of the aggregator feed hydrated with aggregation status.

func (*FeedAggregator) Start

func (fa *FeedAggregator) Start()

Start starts feed aggregator.

func (*FeedAggregator) StartWithDelay

func (fa *FeedAggregator) StartWithDelay(delay time.Duration)

StartWithDelay starts feed aggregator with a delay.

func (*FeedAggregator) Stop

func (fa *FeedAggregator) Stop()

Stop stops feed aggregator.

type FeedHandler

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

FeedHandler handles feed refresh

func NewFeedHandler

func NewFeedHandler(feed *app.Feed, timeout time.Duration) *FeedHandler

NewFeedHandler creats new feed handler

func (*FeedHandler) Refresh

func (fh *FeedHandler) Refresh() (FeedStatus, []*model.Article)

Refresh fetch feed items

type FeedStatus

type FeedStatus struct {
	CheckedAt          time.Time `json:"checked_at"`
	EtagHeader         string    `json:"etag_header"`
	LastModifiedHeader string    `json:"last_modified_header"`
	ExpiresHeader      string    `json:"expires_header"`
	ErrorMsg           string    `json:"error_message"`
	ErrorCount         int       `json:"error_count"`
}

FeedStatus status of a feed

func (*FeedStatus) ComputeNextCheckDate

func (fs *FeedStatus) ComputeNextCheckDate(base time.Duration) time.Time

ComputeNextCheckDate computes next date to check regarding some rules The duration is multiply the number of error. The limit is h24

func (*FeedStatus) Err

func (fs *FeedStatus) Err(err error)

Err set error status message and counter Reset if err is null

type Manager

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

Manager of the feed aggregators

func NewManager

func NewManager(db store.DB, om *output.Manager, delay time.Duration, timeout time.Duration, callbackURL string) *Manager

NewManager creates a new aggregator manager

func (*Manager) GetFeedAggregator

func (m *Manager) GetFeedAggregator(id string) *FeedAggregator

GetFeedAggregator returns a feed aggregator

func (*Manager) RegisterFeedAggregator

func (m *Manager) RegisterFeedAggregator(feed *app.Feed) *FeedAggregator

RegisterFeedAggregator register and start a new feed aggregator

func (*Manager) RestartFeedAggregator

func (m *Manager) RestartFeedAggregator(id string, delay time.Duration)

RestartFeedAggregator restart feed aggregator with delay

func (*Manager) Shutdown

func (m *Manager) Shutdown()

Shutdown stop the manager (aka. stop and unregister all feed aggregator)

func (*Manager) Start added in v1.2.0

func (m *Manager) Start() error

Start the aggrgator manager (aka. register and start all feed aggregator)

func (*Manager) UnRegisterFeedAggregator

func (m *Manager) UnRegisterFeedAggregator(id string)

UnRegisterFeedAggregator stop and un-register a feed aggregator

type Status

type Status uint8

Status is the process status

const (
	// RunningStatus is the status of a running process
	RunningStatus Status = iota
	// StoppedStatus is the status of a stoppedprocess
	StoppedStatus
)

func (Status) String

func (s Status) String() string

String converts a status to a readable string

Jump to

Keyboard shortcuts

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