Created
April 16, 2019 09:49
-
-
Save trusch/6d37a552472de81809b0b2604a533c7b 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