create_map test ready

This commit is contained in:
2026-05-21 22:34:58 -06:00
parent 80fa7f8392
commit d03908eb8e
3 changed files with 124 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package repomaint
import (
"os"
"github.com/ewpt3ch/pkgstash/internal/cache"
)
type CacheClient interface {
FetchDB() error
Fetch(relpath string) (*cache.CacheFile, error)
}
type RepoSync struct {
c CacheClient
root *os.Root
repos []string
}
func NewRepoSync(c CacheClient, path string, repos []string) (*RepoSync, error) {
root, err := os.OpenRoot(path)
if err != nil {
return nil, err
}
rs := RepoSync{
c: c,
root: root,
repos: repos,
}
return &rs, nil
}
func (r *RepoSync) Sync() error {
// create map of pkgname to filenames from current db
// call cache db fetch
if err := r.c.FetchDB(); err != nil {
return err
}
// create map from pkgnames in new db
// compare and fetch
// call cache cleanup
return nil
}