take 2 - find .42gb usage

This commit is contained in:
Abhishek Pandey 2023-11-29 00:04:29 -08:00
parent 066aff3a46
commit bf3b232319
2 changed files with 31 additions and 32 deletions

View File

@ -198,11 +198,11 @@ func (oc *Collection) Add(cdi CorsoDriveItemable) bool {
// oc.driveItems[ptr.Val(item.GetId())] = item // oc.driveItems[ptr.Val(item.GetId())] = item
//cdi := ToCorsoDriveItemable(item) //cdi := ToCorsoDriveItemable(item)
//_, found := oc.driveItems[ptr.Val(cdi.GetId())] _, found := oc.driveItems[ptr.Val(cdi.GetId())]
//oc.driveItems[ptr.Val(cdi.GetId())] = cdi oc.driveItems[ptr.Val(cdi.GetId())] = cdi
// if !found, it's a new addition // if !found, it's a new addition
return true return !found
} }
// Remove removes a item from the collection // Remove removes a item from the collection

View File

@ -4,7 +4,6 @@ import (
"time" "time"
"github.com/alcionai/corso/src/internal/common/ptr" "github.com/alcionai/corso/src/internal/common/ptr"
"github.com/alcionai/corso/src/internal/common/str"
"github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/microsoftgraph/msgraph-sdk-go/models"
) )
@ -225,17 +224,17 @@ func ToCorsoDriveItemable(item models.DriveItemable) CorsoDriveItemable {
// Hacky way to cache the download url. Thats all we use from additional data // Hacky way to cache the download url. Thats all we use from additional data
// Otherwise, we'll hold a reference to the underlying store which will consume // Otherwise, we'll hold a reference to the underlying store which will consume
// lot more memory. // lot more memory.
if item.GetFile() != nil { // if item.GetFile() != nil {
ad := make(map[string]interface{}) // ad := make(map[string]interface{})
for _, key := range downloadURLKeys { // for _, key := range downloadURLKeys {
if v, err := str.AnyValueToString(key, item.GetAdditionalData()); err == nil { // if v, err := str.AnyValueToString(key, item.GetAdditionalData()); err == nil {
ad[key] = v // ad[key] = v
break // break
} // }
} // }
cdi.AdditionalData = ad // cdi.AdditionalData = ad
} // }
if item.GetFolder() != nil { if item.GetFolder() != nil {
cdi.Folder = &folderDriveItem{ cdi.Folder = &folderDriveItem{
@ -289,26 +288,26 @@ func ToCorsoDriveItemable(item models.DriveItemable) CorsoDriveItemable {
} }
} }
if item.GetCreatedBy() != nil && item.GetCreatedBy().GetUser() != nil { // if item.GetCreatedBy() != nil && item.GetCreatedBy().GetUser() != nil {
additionalData := item.GetCreatedBy().GetUser().GetAdditionalData() // additionalData := item.GetCreatedBy().GetUser().GetAdditionalData()
ad := make(map[string]interface{}) // ad := make(map[string]interface{})
var str string // var str string
ed, ok := additionalData["email"] // ed, ok := additionalData["email"]
if ok { // if ok {
str = ptr.Val(ed.(*string)) // str = ptr.Val(ed.(*string))
ad["email"] = &str // ad["email"] = &str
} else if ed, ok = additionalData["displayName"]; ok { // } else if ed, ok = additionalData["displayName"]; ok {
str = ptr.Val(ed.(*string)) // str = ptr.Val(ed.(*string))
ad["displayName"] = &str // ad["displayName"] = &str
} // }
cdi.CreatedBy = &itemIdentitySet{ // cdi.CreatedBy = &itemIdentitySet{
user: &itemUser{ // user: &itemUser{
additionalData: ad, // additionalData: ad,
}, // },
} // }
} // }
return cdi return cdi
} }