1
0
out-of-tree/distro/debian/cache.go

31 lines
522 B
Go
Raw Normal View History

2023-05-11 18:45:44 +00:00
package debian
import (
"github.com/rapidloop/skv"
"code.dumpstack.io/tools/out-of-tree/distro/debian/snapshot"
)
type Cache struct {
store *skv.KVStore
}
func NewCache(path string) (c *Cache, err error) {
c = &Cache{}
c.store, err = skv.Open(path)
return
}
func (c Cache) Put(p snapshot.Package) error {
return c.store.Put(p.Version, p)
}
func (c Cache) Get(version string) (p snapshot.Package, err error) {
err = c.store.Get(version, &p)
return
}
func (c Cache) Close() error {
return c.store.Close()
}