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

package river

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

Package river aggregates feeds into a riverjs file.

See http://riverjs.org for more information on the format.


Package Files

handler.go options.go river.go


const DefaultCallback = "onGetRiverStream"

DefaultCallback is the name of the callback to use in the jsonp response.


var DefaultOptions = Options{
    Mapping:   mapping.DefaultMapping,
    CutOff:    -24 * time.Hour,
    Refresh:   15 * time.Minute,
    LogLength: 0,

DefaultOptions are some sensible options to start out with.

func Handler Uses

func Handler(feeds River) http.Handler

Handler returns a http.Handler that serves the river.

/        the riverjs feed wrapped in the DefaultCallback
/log     the event log from fetching feeds

type Options Uses

type Options struct {
    // Mapping is the function used to convert a feed item to an item in the
    // river.
    Mapping mapping.Mapping

    // CutOff is the duration after which items are not shown in the river. This
    // is given as a negative time and is calculated from the time the feed was
    // fetched not the time the item was published.
    CutOff time.Duration

    // Refresh is the minimum refresh period. If an rss feed does not specify
    // when to be fetched this duration will be used.
    Refresh time.Duration

    // LogLength defines the number of events to keep in the crawl log, per feed.
    LogLength int

Options change the behaviour of River.

type River Uses

type River interface {
    // Encode writes the river to w in json format. It does not write the json in
    // a javascript callback function.
    Encode(w io.Writer) error

    // Log returns a list of fetch events.
    Log() []events.Event

    // Add subscribes the river to the feed at uri.
    Add(uri string)

    // Remove unsubscribes the river from the feed at url.
    Remove(uri string)

    // Close gracefully stops feeds from being checked.
    Close() error

A River aggregates feeds that it is subscribed to, and writes them in riverjs format.

func New Uses

func New(store data.Database, options Options) River

New creates an empty river.


confluencePackage confluence manages a list of subscribed feeds.
dataPackage data provides the ability to rebuild previous feeds and remove duplicate items.
data/boltdataPackage boltdata implements data over a bolt database.
data/memdataPackage memdata implements data over a set of in memory maps.
eventsPackage events keeps track of the results of fetching feeds.
mappingPackage mapping converts a feed item into a riverjs item.
riverjsPackage riverjs contains structs that map to the parts of a riverjs feed.
tributaryPackage tributary fetches a single feed.

Package river imports 13 packages (graph) and is imported by 2 packages. Updated 2019-04-25. Refresh now. Tools for package owners.