Cherry pick cache integration changes with dummy url cache

This commit is contained in:
Abhishek Pandey 2023-05-31 04:08:30 -07:00
parent b68336a466
commit 671fd5150d
3 changed files with 7 additions and 1 deletions

View File

@ -323,7 +323,7 @@ type itemAndAPIGetter interface {
// downloadContent attempts to fetch the item content. If the content url // downloadContent attempts to fetch the item content. If the content url
// is expired (ie, returns a 401), it re-fetches the item to get a new download // is expired (ie, returns a 401), it re-fetches the item to get a new download
// url and tries again. // url and tries again.
func downloadContent( func (oc *Collection) downloadContent(
ctx context.Context, ctx context.Context,
iaag itemAndAPIGetter, iaag itemAndAPIGetter,
uc getItemPropertyer, uc getItemPropertyer,

View File

@ -207,6 +207,8 @@ func (suite *CollectionUnitTestSuite) TestCollection() {
CollectionScopeFolder, CollectionScopeFolder,
true, true,
nil) nil)
true,
nil)
require.NoError(t, err, clues.ToCore(err)) require.NoError(t, err, clues.ToCore(err))
require.NotNil(t, coll) require.NotNil(t, coll)
assert.Equal(t, folderPath, coll.FullPath()) assert.Equal(t, folderPath, coll.FullPath())

View File

@ -63,6 +63,9 @@ type Collections struct {
NumItems int NumItems int
NumFiles int NumFiles int
NumContainers int NumContainers int
// drive ID -> url cache instance
driveURLCache map[string]*urlCache
} }
func NewCollections( func NewCollections(
@ -79,6 +82,7 @@ func NewCollections(
CollectionMap: map[string]map[string]*Collection{}, CollectionMap: map[string]map[string]*Collection{},
statusUpdater: statusUpdater, statusUpdater: statusUpdater,
ctrl: ctrlOpts, ctrl: ctrlOpts,
driveURLCache: map[string]*urlCache{},
} }
} }