about summary refs log tree commit diff
path: root/tools/nixery/server/main.go
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-10-03T11·49+0100
committerVincent Ambo <github@tazj.in>2019-10-03T12·21+0100
commit43a642435b653d04d730de50735d310f1f1083eb (patch)
treef401510a150ed177add1adfb3bc737e1d9a1562b /tools/nixery/server/main.go
parent313e5d08f12f4c8573e9347f7f04493ab99b5abf (diff)
feat(server): Reimplement local manifest cache backed by files
Implements a local manifest cache that uses the temporary directory to
cache manifest builds.

This is necessary due to the size of manifests: Keeping them entirely
in-memory would quickly balloon the memory usage of Nixery, unless
some mechanism for cache eviction is implemented.
Diffstat (limited to 'tools/nixery/server/main.go')
-rw-r--r--tools/nixery/server/main.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/nixery/server/main.go b/tools/nixery/server/main.go
index 1ff3a471f94f..aeb70163da6a 100644
--- a/tools/nixery/server/main.go
+++ b/tools/nixery/server/main.go
@@ -194,8 +194,17 @@ func main() {
 	}
 
 	ctx := context.Background()
-	bucket := prepareBucket(ctx, cfg)
-	state := builder.NewState(bucket, *cfg)
+	bucket := prepareBucket(ctx, &cfg)
+	cache, err := builder.NewCache()
+	if err != nil {
+		log.Fatalln("Failed to instantiate build cache", err)
+	}
+
+	state := builder.State{
+		Bucket: bucket,
+		Cache:  &cache,
+		Cfg:    cfg,
+	}
 
 	log.Printf("Starting Nixery on port %s\n", cfg.Port)