view

package
v0.0.0-...-f714a01 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2016 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrDoesNotExist = errors.New("log: does not exist")

Functions

func Deduplicate

func Deduplicate(iter origins.Iterator) origins.Iterator

remove duplicate facts from a stream

func Merge

func Merge(iterators ...origins.Iterator) origins.Iterator

Merge multiple fact streams into one. Note: iterators return facts in the order opposite to that in which they were committed (i.e. newest facts with largest transaction IDs first), and the Merge operation will preserve that.

Types

type Event

type Event struct {
	Type      EventType
	Entity    *origins.Ident
	Attribute *origins.Ident
	Before    *origins.Fact
	After     *origins.Fact
}

func Timeline

func Timeline(iter origins.Iterator, order Order) ([]*Event, error)

Timeline returns an ordered set of events derived from the fact iterator. The iterator is assumed to return facts in reverse order by time (newest first) which is what the Log view returns.

func (*Event) MarshalJSON

func (e *Event) MarshalJSON() ([]byte, error)

type EventType

type EventType int8

An EventType denotes the type of event

const (
	// Event types.
	Add EventType = iota + 1
	Change
	Remove
)

func (EventType) MarshalJSON

func (e EventType) MarshalJSON() ([]byte, error)

func (EventType) String

func (e EventType) String() string

type Log

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

A Log is an ordered sequence of facts within a domain.

func OpenLog

func OpenLog(engine storage.Engine, domain, name string) (*Log, error)

OpenLog opens a log for reading.

func (*Log) Asof

func (l *Log) Asof(t time.Time) origins.Iterator

Asof returns a view of the log with an explicit upper time boundary.

func (*Log) Now

func (l *Log) Now() origins.Iterator

Now returns a view of the log with a time boundary set to the current time. This is equivalent to: Asof(time.Now().UTC())

func (*Log) Since

func (l *Log) Since(t time.Time) origins.Iterator

Since returns a view of the log with an explicit lower time boundary.

func (*Log) View

func (l *Log) View(since, asof time.Time) origins.Iterator

View returns a view of the log for the specified time period. It is safe for multiple consumers to create views of a log.

type Order

type Order int8

Order defines the order of an iterator of facts.

const (
	// Order types.
	Ascending Order = iota + 1
	Descending
)

func (Order) String

func (o Order) String() string

Jump to

Keyboard shortcuts

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