-
Notifications
You must be signed in to change notification settings - Fork 9
/
output_path_factory.go
45 lines (39 loc) · 1.78 KB
/
output_path_factory.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
39
40
41
42
43
44
45
package virtual
import (
"context"
"github.com/buildbarn/bb-remote-execution/pkg/filesystem/virtual"
"github.com/buildbarn/bb-storage/pkg/digest"
"github.com/buildbarn/bb-storage/pkg/filesystem/path"
"github.com/buildbarn/bb-storage/pkg/util"
)
// OutputPath is a directory where build results may be stored. Simple
// implementations may store these results in memory, while more complex
// ones use local or networked storage.
type OutputPath interface {
virtual.PrepopulatedDirectory
// FinalizeBuild() is called at the end of every build.
// Implementations of OutputPath may use this method to persist
// state.
FinalizeBuild(ctx context.Context, digestFunction digest.Function)
}
// OutputPathFactory is an interface that is invoked by
// BazelOutputServiceDirectory to manage individual directories where
// build results may be stored.
type OutputPathFactory interface {
// StartInitialBuild() is called when a build is started that
// uses an output base ID that hasn't been observed before, or
// was cleaned previously.
StartInitialBuild(outputBaseID path.Component, casFileFactory virtual.CASFileFactory, digestFunction digest.Function, errorLogger util.ErrorLogger) OutputPath
// Clean() is called when the BazelOutputServiceDirectory
// service is instructed to clean an output path that is not yet
// managed by the BazelOutputServiceDirectory. This may occur if
// a 'bazel clean' is invoked right after startup. In that case
// the output path may not yet be attached, though we should
// clean up any persistent data associated with it.
//
// Output paths that have already been returned by
// StartInitialBuild() will be cleaned by
// BazelOutputServiceDirectory by calling
// PrepopulatedDirectory.RemoveAllChildren(true).
Clean(outputBaseID path.Component) error
}