20 lines
576 B
Go
20 lines
576 B
Go
package queue
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.ilapage.cn/OPC/chorus/internal/core/model"
|
|
)
|
|
|
|
type Claim struct {
|
|
Generation model.Generation
|
|
LeaseToken string
|
|
}
|
|
|
|
type Repository interface {
|
|
ClaimNext(ctx context.Context, owner string, now time.Time, leaseDuration time.Duration) (*Claim, error)
|
|
Succeed(ctx context.Context, generationID uint64, leaseToken string, outputs []model.GenerationOutput, attempts []model.Attempt) (bool, error)
|
|
Fail(ctx context.Context, generationID uint64, leaseToken string, code, message string, attempts []model.Attempt) (bool, error)
|
|
}
|