github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/dscache/build/from_repo.go (about)

     1  package build
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/qri-io/qri/dscache"
     7  	"github.com/qri-io/qri/repo"
     8  )
     9  
    10  // DscacheFromRepo creates a dscache, building it from the repo's logbook and profiles and dsrefs.
    11  func DscacheFromRepo(ctx context.Context, r repo.Repo) (*dscache.Dscache, error) {
    12  	num, err := r.RefCount()
    13  	if err != nil {
    14  		return nil, err
    15  	}
    16  	refs, err := r.References(0, num)
    17  	if err != nil {
    18  		return nil, err
    19  	}
    20  	profiles := r.Profiles()
    21  	logbook := r.Logbook()
    22  	filesys := r.Filesystem()
    23  	return dscache.BuildDscacheFromLogbookAndProfilesAndDsref(ctx, refs, profiles, logbook, filesys)
    24  }