This repository has been archived by the owner on Oct 9, 2023. It is now read-only.
/
paths.go
54 lines (41 loc) · 2.08 KB
/
paths.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
46
47
48
49
50
51
52
53
54
package ioutils
import (
"context"
"github.com/lyft/flytestdlib/logger"
"github.com/lyft/flytestdlib/storage"
)
const (
InputsSuffix = "inputs.pb"
FuturesSuffix = "futures.pb"
OutputsSuffix = "outputs.pb"
ErrorsSuffix = "error.pb"
IndexLookupSuffix = "indexlookup.pb"
)
func constructPath(store storage.ReferenceConstructor, base storage.DataReference, suffix string) storage.DataReference {
res, err := store.ConstructReference(context.Background(), base, suffix)
if err != nil {
logger.Error(context.Background(), "Failed to construct path. Base[%v] Error: %v", base, err)
}
return res
}
func GetPath(ctx context.Context, store storage.ReferenceConstructor, root storage.DataReference, subNames ...string) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, root, subNames...)
}
func GetMasterOutputsPath(ctx context.Context, store storage.ReferenceConstructor, output storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, output, OutputsSuffix)
}
func GetInputsPath(ctx context.Context, store storage.ReferenceConstructor, prefix storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, prefix, InputsSuffix)
}
func GetOutputsPath(ctx context.Context, store storage.ReferenceConstructor, prefix storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, prefix, OutputsSuffix)
}
func GetFuturesPath(ctx context.Context, store storage.ReferenceConstructor, prefix storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, prefix, FuturesSuffix)
}
func GetErrorsPath(ctx context.Context, store storage.ReferenceConstructor, prefix storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, prefix, ErrorsSuffix)
}
func GetIndexLookupPath(ctx context.Context, store storage.ReferenceConstructor, prefix storage.DataReference) (res storage.DataReference, err error) {
return store.ConstructReference(ctx, prefix, IndexLookupSuffix)
}