summaryrefslogtreecommitdiff
path: root/structs.go
diff options
context:
space:
mode:
Diffstat (limited to 'structs.go')
-rw-r--r--structs.go33
1 files changed, 24 insertions, 9 deletions
diff --git a/structs.go b/structs.go
index 90b84bc..ac10293 100644
--- a/structs.go
+++ b/structs.go
@@ -2,6 +2,7 @@ package forgepb
import (
sync "sync"
+ "time"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/lib/protobuf/zoopb"
@@ -10,15 +11,16 @@ import (
// maybe an interface someday?
type Forge struct {
// one-time initialized data
- initOnce sync.Once
- initErr error // init error, if any
-
- goSrc string // the path to go/src
- goWork bool // means the user is currently using a go.work file
- Config *ForgeConfigs // config repos for readonly, private, etc
- Repos *gitpb.Repos
- Machine *zoopb.Machine
- configSave bool
+ initOnce sync.Once
+ initErr error // init error, if any
+ goSrc string // the path to go/src
+ goWork bool // means the user is currently using a go.work file
+ Config *ForgeConfigs // config repos for readonly, private, etc
+ Repos *gitpb.Repos // the repo protobufs
+ Machine *zoopb.Machine // things for virtigo to track vm's
+ configSave bool // if you need to save the config because things changed
+ hasFullScan bool // track last scan so it can be throttled
+ fullscan time.Time // time of the last scan so it can be throttled
}
func (f *Forge) GetGoSrc() string {
@@ -28,3 +30,16 @@ func (f *Forge) GetGoSrc() string {
func (f *Forge) IsGoWork() bool {
return f.goWork
}
+
+func (f *Forge) HasFullScan() bool {
+ return f.Repos.HasFullScan
+}
+
+func (f *Forge) FullScanRan() {
+ f.fullscan = time.Now()
+}
+
+func (f *Forge) FullScanAge() time.Duration {
+ fs := f.Repos.FullScan.AsTime()
+ return time.Since(fs)
+}