synchronizing

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector added in v0.7.0

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

Collector tracks feed synchronization metrics.

func NewCollector added in v0.7.0

func NewCollector(metricsPrefix string) *Collector

NewCollector initializes and returns a new Collector for feed synchronization metrics.

func (*Collector) Collect added in v0.7.0

func (c *Collector) Collect(ch chan<- prometheus.Metric)

func (*Collector) Describe added in v0.7.0

func (c *Collector) Describe(ch chan<- *prometheus.Desc)

type FeedFetchMetadata

type FeedFetchMetadata struct {
	UUID string

	ETag         string
	LastModified time.Time

	UpdatedAt time.Time
	FetchedAt time.Time
}

FeedFetchMetadata represents the metadata for feed fetch information.

type FeedMetadata added in v0.3.0

type FeedMetadata struct {
	UUID string

	Title       string
	Description string

	Hash uint64

	UpdatedAt time.Time
}

FeedMetadata represents the metadata for a feed and its content.

type Repository

type Repository interface {
	// FeedGetNByLastSynchronizationTime returns at most n feeds that have last been synchronized before
	// a given time.Time.
	//
	// This method must only return feeds with at least one active user Subscription.
	FeedGetNByLastSynchronizationTime(ctx context.Context, n uint, before time.Time) ([]feed.Feed, error)

	// FeedUpdateFetchMetadata updates fetch metadata (ETag, FetchedAt, UpdatedAt) for a given feed.Feed.
	FeedUpdateFetchMetadata(ctx context.Context, feedFetchMetadata FeedFetchMetadata) error

	// FeedUpdateMetadata updates metadata (Title, Description) for a given feed.Feed.
	FeedUpdateMetadata(ctx context.Context, feedMetadata FeedMetadata) error

	// FeedEntryUpsertMany adds a collection of new entries and updates existing entries.
	FeedEntryUpsertMany(ctx context.Context, entries []feed.Entry) (int64, error)
}

Repository provides access to feed data for synchronizing.

type Scheduler

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

A Scheduler periodically synchronizes all syndication feeds.

func NewScheduler

func NewScheduler(service *Service, locker sync.Locker) *Scheduler

NewScheduler initializes and returns a Scheduler.

func (*Scheduler) Run

func (sc *Scheduler) Run(ctx context.Context)

Run periodically synchronizes all syndication feeds.

type Service

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

Service handles feed synchronization operations.

func NewService

func NewService(r Repository, client *fetching.Client, metricsPrefix string) *Service

NewService initializes and returns a new feed synchronization service.

func (*Service) Collector added in v0.7.0

func (s *Service) Collector() *Collector

Collector returns the Prometheus metrics collector for the service.

func (*Service) Synchronize

func (s *Service) Synchronize(ctx context.Context, jobID string) error

Synchronize synchronizes syndication feeds for all users.

Jump to

Keyboard shortcuts

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