-
Notifications
You must be signed in to change notification settings - Fork 28
/
service.go
38 lines (29 loc) · 1013 Bytes
/
service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2022 Target Brands, Inc. All rights reserved.
//
// Use of this source code is governed by the LICENSE file in this repository.
package queue
import (
"context"
"github.com/go-vela/types"
"github.com/go-vela/types/pipeline"
)
// Service represents the interface for Vela integrating
// with the different supported Queue backends.
type Service interface {
// Service Interface Functions
// Driver defines a function that outputs
// the configured queue driver.
Driver() string
// Length defines a function that outputs
// the length of a queue channel
Length(context.Context) (int64, error)
// Pop defines a function that grabs an
// item off the queue.
Pop(context.Context) (*types.Item, error)
// Push defines a function that publishes an
// item to the specified route in the queue.
Push(context.Context, string, []byte) error
// Route defines a function that decides which
// channel a build gets placed within the queue.
Route(*pipeline.Worker) (string, error)
}