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.
This commit is contained in:
Vincent Ambo 2019-10-03 12:49:26 +01:00 committed by Vincent Ambo
parent 313e5d08f1
commit 43a642435b
5 changed files with 71 additions and 52 deletions

View file

@ -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)