Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

simple source pure

Functions 1

func NewStorage

1func NewStorage(maxValues uint) *Storage
source

NewStorage creates a new Storage with the given maximum number of values. If maxValues is 0, the storage is bounded to a size of one. If this is not desirable, then don't provide a value of 0.

Types 1

type Storage

struct
1type Storage struct {
2	values    []feed.Value
3	maxValues uint
4}
source

Storage is simple, bounded storage for published feed values.

Methods on Storage

func GetHistory

method on Storage
1func (s Storage) GetHistory() []feed.Value
source

GetHistory returns all values in the storage, from oldest to newest.

func GetLatest

method on Storage
1func (s Storage) GetLatest() feed.Value
source

GetLatest returns the most recently added value, or an empty value if none exist.

func Put

method on Storage
1func (s *Storage) Put(value string) error
source

Put adds a new value to the storage. If the storage is full, the oldest value is removed. If maxValues is 0, the storage is bounded to a size of one.

Imports 3

Source Files 2