-
Notifications
You must be signed in to change notification settings - Fork 0
/
bpm.go
47 lines (37 loc) · 934 Bytes
/
bpm.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
package bpm
import (
"github.com/blobcache/glfs"
"github.com/blobcache/webref"
"github.com/brendoncarroll/go-state"
"github.com/brendoncarroll/go-state/cadata"
"lukechampine.com/blake3"
"github.com/blobcache/bpm/bpmmd"
"github.com/blobcache/bpm/sources"
)
const MaxBlobSize = 1 << 21
// Hash is the hash function used by BPM
func Hash(x []byte) cadata.ID {
return blake3.Sum256(x)
}
type (
Label = bpmmd.Label
LabelSet = bpmmd.LabelSet
)
type Asset struct {
ID uint64 `json:"id"`
Labels LabelSet `json:"labels"`
Root glfs.Ref `json:"root"`
Upstream *UpstreamURL `json:"upstream"`
}
func (a Asset) IsLocal() bool {
return a.Upstream == nil
}
type WebRefStore interface {
state.Putter[cadata.ID, webref.Ref]
state.Getter[cadata.ID, webref.Ref]
}
type Manifest map[string]DeploySpec
type DeploySpec struct {
Source sources.URL `json:"source"`
Query string `json:"query"`
}