INNER CODE UNIT · Go

cacheManifest

tazjin/nixery · builder/cache.go:130

func cacheManifest(ctx context.Context, s *State, key string, m json.RawMessage) {
	go s.Cache.localCacheManifest(key, m)

	path := "manifests/" + key
	_, size, err := s.Storage.Persist(ctx, path, manifest.ManifestType, func(w io.Writer) (string, int64, error) {
		size, err := io.Copy(w, bytes.NewReader([]byte(m)))
		return "", size, err
	})

	if err != nil {
		slog.Error("failed to cache manifest to storage backend", "err", err, "manifest", key, "backend", s.Storage.Name())

		return
	}

	slog.Info("cached manifest to storage backend", "manifest", key, "size", size, "backend", s.Storage.Name())
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…