29 lines
843 B
Go
29 lines
843 B
Go
package core
|
|
|
|
import (
|
|
"context"
|
|
)
|
|
|
|
type EntryStore interface {
|
|
Append(ctx context.Context, entry Entry) error
|
|
Get(ctx context.Context, entryID EntryID) (Entry, error)
|
|
GetBySeq(ctx context.Context, ledgerID LedgerID, seq uint64) (Entry, error)
|
|
Delete(ctx context.Context, entryID EntryID) error
|
|
|
|
Head(ctx context.Context, ledgerID LedgerID) (EntryID, error)
|
|
HeadSeq(context.Context, LedgerID) (uint64, error)
|
|
Tail(ctx context.Context, ledgerID LedgerID) (EntryID, error)
|
|
Iterator(ctx context.Context, ledgerLedgerID, startSeq uint64) (EntryIterator, error)
|
|
}
|
|
|
|
type EntryIterator interface {
|
|
Next() bool
|
|
Entry() Entry
|
|
}
|
|
|
|
type PayloadStore interface {
|
|
Put(ctx context.Context, payload []byte) (PayloadID, error)
|
|
Get(ctx context.Context, payloadID PayloadID) ([]byte, error)
|
|
Delete(ctx context.Context, payloadID PayloadID) error
|
|
}
|