confluence

package
v0.0.0-...-44d4e1f Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package confluence manages a list of subscribed feeds.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Confluence

type Confluence interface {
	// Latest returns the newest items from all managed Tributaries.
	Latest() []riverjs.Feed

	// Log returns the events that have been triggered by the Tributaries.
	Log() []events.Event

	// Add causes the Confluence to aggregate a new Tributary. If a Tributary with
	// the same name is already managed by the Confluence no action will be taken.
	Add(stream tributary.Tributary)

	// Remove will stop the named Tributary and remove it from the list of those
	// managed by the Confluence.
	Remove(uri string) bool

	// Close stops the Confluence and all managed Tributaries.
	Close() error
}

A Confluence manages a list of Tributaries and aggregates the latest updates into a single (truncated) list.

func New

func New(store Database, cutoff time.Duration, logLength int) Confluence

New creates a new Confluence writing to the store. The cutoff specifies the minimum duration an item should be returned by Latest for, but is not guaranteed to be followed exactly (e.g. with a cutoff of 1 hour an item which is 2 hours old may be returned by Latest, but an item that is 5 minutes old must be returned by Latest). The event log size is set by logLength.

type Database

type Database interface {
	Add(feed riverjs.Feed)
	Truncate(cutoff time.Duration)
	Latest(cutoff time.Duration) []riverjs.Feed
}

A Database contains persisted feed data, specifically each "block" of updates for a feed. This allows the river to be recreated from past data, to be displayed on startup.

Jump to

Keyboard shortcuts

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