Created
April 16, 2019 09:48
-
-
Save trusch/4ec3c9af79aff2747358701fc31c54ed to your computer and use it in GitHub Desktop.
This file contains 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