riviera: hawx.me/code/riviera/river/confluence Index | Files

package confluence

import "hawx.me/code/riviera/river/confluence"

Package confluence manages a list of subscribed feeds.


Package Files

confluence.go database.go

type Confluence Uses

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 Uses

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 Uses

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.

Package confluence imports 7 packages (graph) and is imported by 8 packages. Updated 2017-12-26. Refresh now. Tools for package owners.