Created
April 16, 2019 09:47
-
-
Save trusch/0467e4d5e6d939da4fcf084f0b137543 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package queue | |
import ( | |
"context" | |
"time" | |
) | |
type Task struct { | |
ID string | |
Payload []byte | |
Metadata map[string]interface{} | |
CreatedAt time.Time | |
StartedAt time.Time | |
FinishedAt time.Time | |
LastHeartbeat time.Time | |
} | |
type Manager interface { | |
Enqueue(ctx context.Context, queue string, task *Task) error | |
Dequeue(ctx context.Context, queue string) (*Task, error) | |
Heartbeat(ctx context.Context, queue, taskID string, metadata map[string]interface{}) error | |
Finish(ctx context.Context, queue, taskID string, metadata map[string]interface{}) error | |
Inspect(ctx context.Context, queue string, offset uint64) (chan *Task, error) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment