-
Notifications
You must be signed in to change notification settings - Fork 394
/
cloud.go
34 lines (28 loc) · 855 Bytes
/
cloud.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
package buildkitskipper
import (
"context"
)
type ASKVClient interface {
AutoSkipExists(ctx context.Context, org, project, pipeline string, hash []byte) (bool, error)
AutoSkipAdd(ctx context.Context, org, project, pipeline string, hash []byte) error
}
func NewCloud(org, project, pipeline string, client ASKVClient) (*CloudClient, error) {
return &CloudClient{
org: org,
project: project,
pipeline: pipeline,
c: client,
}, nil
}
type CloudClient struct {
org string
project string
pipeline string
c ASKVClient
}
func (cc *CloudClient) Add(ctx context.Context, data []byte) error {
return cc.c.AutoSkipAdd(ctx, cc.org, cc.project, cc.pipeline, data)
}
func (cc *CloudClient) Exists(ctx context.Context, data []byte) (bool, error) {
return cc.c.AutoSkipExists(ctx, cc.org, cc.project, cc.pipeline, data)
}