-
Notifications
You must be signed in to change notification settings - Fork 68
/
action_router.go
28 lines (25 loc) · 1.32 KB
/
action_router.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
package routing
import (
"context"
remoteexecution "github.com/bazelbuild/remote-apis/build/bazel/remote/execution/v2"
"github.com/buildbarn/bb-remote-execution/pkg/scheduler/initialsizeclass"
"github.com/buildbarn/bb-remote-execution/pkg/scheduler/invocation"
"github.com/buildbarn/bb-remote-execution/pkg/scheduler/platform"
"github.com/buildbarn/bb-storage/pkg/digest"
)
// ActionRouter is responsible for doing all forms of analysis on an
// incoming execution request up to the point where InMemoryBuildQueue
// acquires locks and enqueues an operation. ActionRouter is responsible
// for the following things:
//
// - To extract a platform key from the action, so that
// InMemoryBuildQueue knows on which workers the action needs to
// execute.
// - To extract invocation keys from the client's context, so that
// InMemoryBuildQueue can group operations belonging to the same
// client and schedule them fairly with respect to other clients.
// - To create an initial size class selector, which InMemoryBuildQueue
// can use to select the appropriate worker size.
type ActionRouter interface {
RouteAction(ctx context.Context, digestFunction digest.Function, action *remoteexecution.Action, requestMetadata *remoteexecution.RequestMetadata) (platform.Key, []invocation.Key, initialsizeclass.Selector, error)
}