Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateID(batchID string) error
- func ValidateIdentity(state *State, identity Identity) error
- type AppendOptions
- type Identity
- type Options
- type Repository
- func (r *Repository) Append(options AppendOptions) (int, error)
- func (r *Repository) Create(state State) (*State, error)
- func (r *Repository) Delete(batchID string) (*State, error)
- func (r *Repository) Ensure() error
- func (r *Repository) Get(batchID string) (*State, error)
- func (r *Repository) List() ([]Summary, error)
- func (r *Repository) Path(batchID string) (string, error)
- func (r *Repository) Prune(olderThan time.Duration) ([]Summary, error)
- func (r *Repository) WithState(batchID string, fn func(*Transaction) error) error
- type RequestEntry
- type State
- type Summary
- type Transaction
Constants ¶
View Source
const (
ServiceDocs = "docs"
)
Variables ¶
View Source
var ( ErrEmptyRevision = errors.New("document revision is empty") ErrRevisionChanged = errors.New("document revision changed") ErrRequireEmpty = errors.New("operation requires an empty batch") ErrTransactionDeleted = errors.New("batch transaction is already deleted") ErrInvalidID = errors.New("invalid batch ID") ErrIdentityMismatch = errors.New("batch identity mismatch") ErrNotFound = errors.New("batch not found") ErrStoredIDMismatch = errors.New("stored batch ID does not match filename") )
Functions ¶
func ValidateID ¶
func ValidateIdentity ¶
Types ¶
type AppendOptions ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func New ¶
func New(dir string, options Options) *Repository
func (*Repository) Append ¶
func (r *Repository) Append(options AppendOptions) (int, error)
func (*Repository) Ensure ¶
func (r *Repository) Ensure() error
func (*Repository) List ¶
func (r *Repository) List() ([]Summary, error)
func (*Repository) WithState ¶
func (r *Repository) WithState(batchID string, fn func(*Transaction) error) error
type RequestEntry ¶
type RequestEntry struct {
AppendedAt time.Time `json:"appended_at"`
Command string `json:"command"`
Request json.RawMessage `json:"request"`
}
type State ¶
type State struct {
BatchID string `json:"batch_id"`
Name string `json:"name,omitempty"`
Service string `json:"service"`
DocumentID string `json:"doc_id"`
Account string `json:"account"`
Client string `json:"client"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
RequiredRevisionID string `json:"required_revision_id,omitempty"`
Requests []RequestEntry `json:"requests"`
}
type Summary ¶
type Summary struct {
BatchID string `json:"batch_id"`
Name string `json:"name,omitempty"`
Service string `json:"service"`
DocumentID string `json:"doc_id"`
Account string `json:"account"`
Client string `json:"client"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Requests int `json:"requests"`
}
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
func (*Transaction) PersistOrDelete ¶
func (t *Transaction) PersistOrDelete() error
func (*Transaction) State ¶
func (t *Transaction) State() *State
Click to show internal directories.
Click to hide internal directories.