summaryrefslogtreecommitdiff
path: root/structs.go
blob: 3c636d9acbfaa86dc354b7b5be586d1ec7f565d1 (plain)
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
package forgepb

import (
	sync "sync"
	"time"

	"go.wit.com/lib/protobuf/gitpb"
)

// maybe an interface someday?
type Forge struct {
	// one-time initialized data
	once        sync.Once
	initErr     error         // init error, if any
	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
	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
	hostname    string        // your hostname
	rillX       int           // used for Rill()
	rillY       int           // used for Rill()
	Patchsets   *Patchsets    // patches that are in progress
	goSrc       string        // the path to go/src
	// forgeURL    string        // URL to use to forge.wit.com
	// configDir   string        // normally ~/.config/forge
	// patchDir    string        // where patches are stored
}

func (f *Forge) GetGoSrc() string {
	return f.goSrc
}

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)
}
*/