Documentation ¶
Index ¶
- Constants
- type ActionInfo
- type Filter
- type FilterFn
- type ForEachFn
- type ForEachRawFn
- type ForEachTxnFn
- type Match
- type MrT
- func (m *MrT) Archive(populate TxnFn) (err error)
- func (m *MrT) Close() (err error)
- func (m *MrT) Comment(b []byte) (err error)
- func (m *MrT) Export(txnID string, w io.Writer) (err error)
- func (m *MrT) Filter(txnID string, archive bool, fn FilterFn, filters ...Filter) (err error)
- func (m *MrT) ForEach(txnID string, archive bool, fn ForEachFn) (err error)
- func (m *MrT) ForEachRaw(txnID string, archive bool, fn ForEachRawFn) (err error)
- func (m *MrT) ForEachTxn(txnID string, archive bool, fn ForEachTxnFn) (err error)
- func (m *MrT) GetFromRaw(raw []byte) (key, value []byte, err error)
- func (m *MrT) Import(r io.Reader, fn ForEachFn) (lastTxn string, err error)
- func (m *MrT) LastTxn() (txnID string, err error)
- func (m *MrT) Txn(fn TxnFn) (err error)
- type ReadSeekCloser
- type Txn
- type TxnFn
- type TxnInfo
- type WriteFn
Constants ¶
const ( // NilLine represents a zero-value for line types NilLine byte = iota // TransactionLine is a line with the transaction tag for the data lines following it TransactionLine // ReplayLine is a line which signals the replay through a transaction ReplayLine // CommentLine is a comment line, will be ignored when parsing data // Note: This line type will always ignore middleware CommentLine // PutLine is for setting data PutLine // DeleteLine is for removing data DeleteLine )
const ( // ErrInvalidLine is returned when an invalid line is encountered while parsing ErrInvalidLine = errors.Error("invalid line") // ErrNoTxn is returned when no transactions are available ErrNoTxn = errors.Error("no transactions available") // ErrInvalidTxn is returned when an invalid transaction is provided ErrInvalidTxn = errors.Error("transaction does not exist") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionInfo ¶
type ActionInfo struct { Put bool `json:"put"` Key string `json:"key"` Value string `json:"value"` }
ActionInfo is information about an action
type ForEachRawFn ¶
ForEachRawFn is used for iterating through raw entries
type ForEachTxnFn ¶
ForEachTxnFn is used for iterating through transactions
type Match ¶
type Match struct {
// contains filtered or unexported fields
}
Match is a transaction matching filter
type MrT ¶
type MrT struct {
// contains filtered or unexported fields
}
MrT is Mister Transaction, he manages file transactions He also pities a fool
func New ¶
func New(dir, name string, mws ...middleware.Middleware) (mp *MrT, err error)
New will return a new instance of MrT
func (*MrT) ForEach ¶
ForEach will iterate through all the file lines starting from the provided transaction id
func (*MrT) ForEachRaw ¶
func (m *MrT) ForEachRaw(txnID string, archive bool, fn ForEachRawFn) (err error)
ForEachRaw will iterate through all the raw file lines starting from the provided transaction id
func (*MrT) ForEachTxn ¶
func (m *MrT) ForEachTxn(txnID string, archive bool, fn ForEachTxnFn) (err error)
ForEachTxn will iterate through all the file transactions starting from the provided transaction id
func (*MrT) GetFromRaw ¶
GetFromRaw will get a key and value line from a raw entry
type ReadSeekCloser ¶
ReadSeekCloser incorporates reader, seeker, and closer interfaces
type Txn ¶
type Txn struct {
// contains filtered or unexported fields
}
Txn is a transaction for persistence actions
type TxnInfo ¶
type TxnInfo struct { // Transaction id ID string `json:"id"` // Timestamp of transaction TS int64 `json:"ts"` // List of actions Actions []*ActionInfo `json:"actions"` }
TxnInfo is information about a transaction