This commit is contained in:
Sam Boyer 2016-04-28 11:07:21 -04:00
Родитель b812a4ce18
Коммит e00401fdae
4 изменённых файлов: 13 добавлений и 13 удалений

Просмотреть файл

@ -107,7 +107,7 @@ func TestProjectManagerInit(t *testing.T) {
// Two birds, one stone - make sure the internal ProjectManager vlist cache
// works by asking for the versions again, and do it through smcache to
// ensure its sorting works, as well.
smc := &smcache{
smc := &smAdapter{
sm: sm,
vlists: make(map[ProjectName][]Version),
}

Просмотреть файл

@ -2,7 +2,7 @@ package vsolver
import "sort"
// smcache is a pseudo-decorator around a proper SourceManager.
// smAdapter is an adapter and around a proper SourceManager.
//
// It provides localized caching that's tailored to the requirements of a
// particular solve run.
@ -13,8 +13,8 @@ import "sort"
// the complexities of deciding what a particular name "means" entirely within
// the solver, while the SourceManager can traffic exclusively in
// globally-unique network names.
type smcache struct {
// The decorated/underlying SourceManager
type smAdapter struct {
// The underlying, adapted-to SourceManager
sm SourceManager
// Direction to sort the version list. False indicates sorting for upgrades;
// true for downgrades.
@ -26,11 +26,11 @@ type smcache struct {
vlists map[ProjectName][]Version
}
func (c *smcache) getProjectInfo(pa ProjectAtom) (ProjectInfo, error) {
func (c *smAdapter) getProjectInfo(pa ProjectAtom) (ProjectInfo, error) {
return c.sm.GetProjectInfo(pa)
}
func (c *smcache) listVersions(n ProjectName) ([]Version, error) {
func (c *smAdapter) listVersions(n ProjectName) ([]Version, error) {
if vl, exists := c.vlists[n]; exists {
return vl, nil
}
@ -51,11 +51,11 @@ func (c *smcache) listVersions(n ProjectName) ([]Version, error) {
return vl, nil
}
func (c *smcache) repoExists(n ProjectName) (bool, error) {
func (c *smAdapter) repoExists(n ProjectName) (bool, error) {
return c.sm.RepoExists(n)
}
func (c *smcache) vendorCodeExists(n ProjectName) (bool, error) {
func (c *smAdapter) vendorCodeExists(n ProjectName) (bool, error) {
return c.sm.VendorCodeExists(n)
}

Просмотреть файл

@ -37,7 +37,7 @@ func NewSolver(sm SourceManager, l *logrus.Logger) Solver {
}
return &solver{
sm: &smcache{sm: sm},
sm: &smAdapter{sm: sm},
l: l,
latest: make(map[ProjectName]struct{}),
rlm: make(map[ProjectName]LockedProject),
@ -49,7 +49,7 @@ func NewSolver(sm SourceManager, l *logrus.Logger) Solver {
type solver struct {
l *logrus.Logger
o SolveOpts
sm *smcache
sm *smAdapter
latest map[ProjectName]struct{}
sel *selection
unsel *unselected
@ -84,7 +84,7 @@ func (s *solver) Solve(opts SolveOpts) (Result, error) {
//return Result{}, fmt.Errorf("Project root must be a directory.")
//}
// Init/reset the smcache
// Init/reset the smAdapter
s.sm.sortdown = opts.Downgrade
s.sm.vlists = make(map[ProjectName][]Version)

Просмотреть файл

@ -14,12 +14,12 @@ type versionQueue struct {
ref ProjectName
pi []Version
fails []failedVersion
sm *smcache
sm *smAdapter
failed bool
hasLock, allLoaded bool
}
func newVersionQueue(ref ProjectName, lockv ProjectAtom, sm *smcache) (*versionQueue, error) {
func newVersionQueue(ref ProjectName, lockv ProjectAtom, sm *smAdapter) (*versionQueue, error) {
vq := &versionQueue{
ref: ref,
sm: sm,