models

package
v0.0.0-...-4d13c9b Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: GPL-3.0 Imports: 1 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Receipt

type Receipt string

Receipt represents a unique receipt for a record, so that it can be tracked for committing purposes.

func (Receipt) String

func (r Receipt) String() string

type Record

type Record interface {

	// ID of the record, which is unique to courier
	ID() uuid.UUID

	// Body is the payload of the record
	Body() []byte

	// RecordID is the potential id from the underlying provider
	RecordID() string

	// Receipt is the underlying uniqueness associated with the message
	Receipt() Receipt

	// Equal another Record or not
	Equal(Record) bool

	// Commit a record to a transaction
	Commit(Transaction) error

	// Failed a record to a transaction
	Failed(Transaction) error
}

Record represents a message from the underlying storage.

type Transaction

type Transaction interface {

	// Push a record id and receipt to a transaction
	Push(uuid.UUID, Record) error

	// Walk over the transactions
	Walk(func(uuid.UUID, Record) error) error

	// Len returns the number of items with in a transaction
	Len() int

	// Flush a transaction
	Flush() error
}

Transaction represents a way of managing statefull actions (commit vs failure)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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