Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit d3e738d

Browse files
authored
Merge pull request #1098 from jmank88/bolt_cache
gps: source cache: add persistent BoltDB cache
2 parents 57e95cc + 6a529db commit d3e738d

File tree

360 files changed

+168780
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

360 files changed

+168780
-82
lines changed

Gopkg.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,7 @@
1818
[[constraint]]
1919
name = "github.com/pkg/errors"
2020
version = "0.8.0"
21+
22+
[[constraint]]
23+
name = "github.com/boltdb/bolt"
24+
version = "1.0.0"

internal/gps/source.go

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,7 @@ func newSourceCoordinator(superv *supervisor, deducer deducer, cachedir string,
6565
}
6666
}
6767

68-
func (sc *sourceCoordinator) close() {
69-
for k, v := range sc.srcs {
70-
if err := v.close(); err != nil {
71-
sc.logger.Println(errors.Wrapf(err, "error closing source gateway for %q", k))
72-
}
73-
}
74-
}
68+
func (sc *sourceCoordinator) close() {}
7569

7670
func (sc *sourceCoordinator) getSourceGatewayFor(ctx context.Context, id ProjectIdentifier) (*sourceGateway, error) {
7771
if sc.supervisor.getLifetimeContext().Err() != nil {
@@ -211,10 +205,6 @@ func newSourceGateway(maybe maybeSource, superv *supervisor, cachedir string) *s
211205
return sg
212206
}
213207

214-
func (sg *sourceGateway) close() error {
215-
return errors.Wrap(sg.cache.close(), "error closing cache")
216-
}
217-
218208
func (sg *sourceGateway) syncLocal(ctx context.Context) error {
219209
sg.mu.Lock()
220210
defer sg.mu.Unlock()

internal/gps/source_cache.go

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@ type singleSourceCache interface {
5858
// If the input is a revision and multiple UnpairedVersions are associated
5959
// with it, whatever happens to be the first is returned.
6060
toUnpaired(v Version) (UnpairedVersion, bool)
61-
62-
// close closes the cache and any backing resources.
63-
close() error
6461
}
6562

6663
type singleSourceCacheMemory struct {
@@ -80,8 +77,6 @@ func newMemoryCache() singleSourceCache {
8077
}
8178
}
8279

83-
func (*singleSourceCacheMemory) close() error { return nil }
84-
8580
type projectInfo struct {
8681
Manifest
8782
Lock
@@ -225,39 +220,3 @@ func (c *singleSourceCacheMemory) toUnpaired(v Version) (UnpairedVersion, bool)
225220
panic(fmt.Sprintf("unknown version type %T", v))
226221
}
227222
}
228-
229-
// cachedManifest implements RootManifest and is populated from cached data.
230-
type cachedManifest struct {
231-
constraints, overrides ProjectConstraints
232-
ignored, required map[string]bool
233-
}
234-
235-
func (m *cachedManifest) DependencyConstraints() ProjectConstraints {
236-
return m.constraints
237-
}
238-
239-
func (m *cachedManifest) Overrides() ProjectConstraints {
240-
return m.overrides
241-
}
242-
243-
func (m *cachedManifest) IgnoredPackages() map[string]bool {
244-
return m.ignored
245-
}
246-
247-
func (m *cachedManifest) RequiredPackages() map[string]bool {
248-
return m.required
249-
}
250-
251-
// cachedManifest implements Lock and is populated from cached data.
252-
type cachedLock struct {
253-
inputHash []byte
254-
projects []LockedProject
255-
}
256-
257-
func (l *cachedLock) InputHash() []byte {
258-
return l.inputHash
259-
}
260-
261-
func (l *cachedLock) Projects() []LockedProject {
262-
return l.projects
263-
}

0 commit comments

Comments
 (0)