-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreferences.go
64 lines (58 loc) · 2.51 KB
/
references.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
55
56
57
58
59
60
61
62
63
64
package api
// n.b. nomenclature: "*Ref" is a usable tuple; "*Name" is one coordinate in a Ref.
// types are abbreviated to "*Ref"; funcs usually use the full word "*Reference*";
// funcs that are factories (or parse helpers, etc) for a type are also abbreviated.
type SlotName string
type StepName string
type SlotRef struct {
StepName // zero for module import reference
SlotName
}
type SubmoduleRef string // .-sep. really is a []StepName, but we wanted something easily used as a map key.
type SubmoduleStepRef struct {
SubmoduleRef
StepName
}
type SubmoduleSlotRef struct {
SubmoduleRef
SlotRef
}
// ImportRef is a sum type, containing either a
// catalog reference ("catalog:{moduleName}:{releaseName}:{itemName}")
// or parent reference ("parent:{slotRef}"; only valid in submodules)
// or an ingest reference ("ingest:{ingestKind}[:{addntl}]"; only valid on main module).
//
// Ingest references are interesting and should be used sparingly; they're
// for where new data comes into the Timeless ecosystem -- and that also means
// ingest references are also where the Timeless Stack abilities to
// automatically recursively audit where that data came from has reached its end.
//
// Ingest references may explicitly reference wares
// (ex. "ingest:literal:tar:f00bAr"),
// or lean on other extensions to bring data into the system
// (ex. "ingest:git:.:HEAD").
// Again, use sparingly: anything beyond "ingest:literal" and your module
// pipeline has become virtually impossible for anyone to evaluate without
// whatever additional un-contained un-tracked context your ingest refers to.
//
// Ingest references should be passed on directly as an export of a module.
// Failure to do so is not *exactly* illegal, but it would make any replay
// of this module impossible without un-tracked context, and as such most of
// the tools in the Timeless Stack will issue either warnings or outright
// errors if the ingested data isn't also in the module exports.
type ImportRef interface {
_ImportRef()
String() string
}
type ImportRef_Catalog ItemRef
type ImportRef_Parent SlotRef
type ImportRef_Ingest struct {
IngestKind string
Args string
}
func (ImportRef_Catalog) _ImportRef() {}
func (ImportRef_Parent) _ImportRef() {}
func (ImportRef_Ingest) _ImportRef() {}
func (x ImportRef_Catalog) String() string { return "catalog:" + (ItemRef(x)).String() }
func (x ImportRef_Parent) String() string { return "parent:" + (SlotRef(x)).String() }
func (x ImportRef_Ingest) String() string { return "ingest:" + x.IngestKind + ":" + x.Args }