Documentation
¶
Overview ¶
Package streamlog is the Neptune Streams commit log: an ordered, expiring record of committed graph changes.
Index ¶
- Constants
- Variables
- type Change
- type Data
- type Log
- func (l *Log) Commit(changes []Change)
- func (l *Log) Enabled() bool
- func (l *Log) Export() ([]byte, error)
- func (l *Log) Import(data []byte) error
- func (l *Log) Policy() Policy
- func (l *Log) Read(q Query) (Page, error)
- func (l *Log) Reset()
- func (l *Log) SetClock(now func() time.Time)
- func (l *Log) SetPolicy(p Policy)
- func (l *Log) Size() (int, int)
- type Page
- type Policy
- type Query
- type Record
- type Value
Constants ¶
const ( OpAdd = "ADD" OpRemove = "REMOVE" )
Op values of a change record.
const ( AtSequenceNumber = "AT_SEQUENCE_NUMBER" AfterSequenceNumber = "AFTER_SEQUENCE_NUMBER" TrimHorizon = "TRIM_HORIZON" Latest = "LATEST" )
Iterator types accepted by Read.
const DefaultRetention = 7 * 24 * time.Hour
DefaultRetention is the documented default of neptune_streams_expiry_days (7 days).
Variables ¶
var ( // ErrNotFound means the requested sequence number is past the newest record. ErrNotFound = errors.New("stream records not found") // ErrExpired means the requested sequence number was already trimmed. ErrExpired = errors.New("stream records expired") // ErrInvalid means the iterator or sequence number is malformed. ErrInvalid = errors.New("invalid stream request") )
Functions ¶
This section is empty.
Types ¶
type Data ¶
type Data struct {
Value *Value `json:"value,omitempty"`
ID string `json:"id,omitempty"`
Type string `json:"type,omitempty"`
Key string `json:"key,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Stmt string `json:"stmt,omitempty"`
}
Data is the serialised change: PG_JSON fields for property graphs, Stmt (an N-Quads line) for SPARQL.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
Log is a concurrency-safe commit log.
func (*Log) Commit ¶
Commit records one transaction's changes under the next commit number; it is a no-op when disabled or empty.
func (*Log) Reset ¶
func (l *Log) Reset()
Reset discards every record and restarts commit numbering.
type Page ¶
Page is the result of a read: lastEvent is the id of the final record, or the newest record when empty.
type Policy ¶
Policy gates recording and sets retention; it mirrors neptune_streams and neptune_streams_expiry_days.