Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachIterator ¶
type AttachIterator interface {
// Returns an array of task states. Returns nil when there are no more
Next() ([]*TaskDBTaskState, error)
}
type DrainIterator ¶
type TaskDB ¶
type TaskDB interface {
// Acquires the TaskDB lock as needed, then returns an AttachIterator
Attach() AttachIterator
// A Task will be inserted into the task table, and its first state inserted
Enqueue(state *TaskDBTaskState, payload []byte) WriteResult
// A new task state
PutState(state *TaskDBTaskState) WriteResult
// Retrieves the payload for a given task
GetPayload(topicName, taskID string) ([]byte, error)
// Deletes all task states for a topic, and removes the topic from the task table. If no more tasks exist then the task will be removed from the task table
Delete(topicName, taskID string) WriteResult
// Returns an iterator that will read all payloads from the DB, so they can be drained into other partitions
Drain() DrainIterator
}
type TaskDBTaskState ¶
type TaskDBTaskState struct {
Topic string
Partition string
ID string
State TaskState
Version int
DeliveryAttempts int
CreatedAt time.Time
Priority int
}
func NewTaskDBTaskState ¶
type WriteResult ¶
type WriteResult interface {
// Waits for the write to be committed to the TaskDB.
// Should use a buffered channel to wait for a batch to be committed.
// If the TaskDB does not batch it should still immediately write to
// the buffered channel so that function calls are non-blocking and
// return immediately
Get() error
}
Click to show internal directories.
Click to hide internal directories.