Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 24, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions store/imagestore/aciinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func GetACIInfosWithKeyPrefix(tx *sql.Tx, prefix string) ([]*ACIInfo, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfo{}
if err := aciinfoRowScan(rows, aciinfo); err != nil {
Expand All @@ -93,6 +94,7 @@ func GetACIInfosWithName(tx *sql.Tx, name string) ([]*ACIInfo, bool, error) {
if err != nil {
return nil, false, err
}
defer rows.Close()
for rows.Next() {
found = true
aciinfo := &ACIInfo{}
Expand All @@ -116,6 +118,7 @@ func GetACIInfoWithBlobKey(tx *sql.Tx, blobKey string) (*ACIInfo, bool, error) {
if err != nil {
return nil, false, err
}
defer rows.Close()
for rows.Next() {
found = true
if err := aciinfoRowScan(rows, aciinfo); err != nil {
Expand Down Expand Up @@ -147,6 +150,7 @@ func GetAllACIInfos(tx *sql.Tx, sortfields []string, ascending bool) ([]*ACIInfo
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfo{}
if err := aciinfoRowScan(rows, aciinfo); err != nil {
Expand Down
8 changes: 8 additions & 0 deletions store/imagestore/migrate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ func getAllACIInfosV0_2(tx *sql.Tx) ([]*ACIInfoV0_2, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV0_2{}
if err := rows.Scan(&aciinfo.BlobKey, &aciinfo.AppName, &aciinfo.ImportTime, &aciinfo.Latest); err != nil {
Expand All @@ -485,6 +486,7 @@ func getAllACIInfosV3(tx *sql.Tx) ([]*ACIInfoV3, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV3{}
if rows.Scan(&aciinfo.BlobKey, &aciinfo.Name, &aciinfo.ImportTime, &aciinfo.Latest); err != nil {
Expand All @@ -504,6 +506,7 @@ func getAllACIInfosV4(tx *sql.Tx) ([]*ACIInfoV4, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV4{}
if rows.Scan(&aciinfo.BlobKey, &aciinfo.Name, &aciinfo.ImportTime, &aciinfo.LastUsed, &aciinfo.Latest); err != nil {
Expand All @@ -523,6 +526,7 @@ func getAllACIInfosV5(tx *sql.Tx) ([]*ACIInfoV5, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV5{}
if rows.Scan(&aciinfo.BlobKey, &aciinfo.Name, &aciinfo.ImportTime, &aciinfo.LastUsed, &aciinfo.Latest, &aciinfo.Size, &aciinfo.TreeStoreSize); err != nil {
Expand All @@ -542,6 +546,7 @@ func getAllACIInfosV6(tx *sql.Tx) ([]*ACIInfoV6, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV6{}
if rows.Scan(&aciinfo.BlobKey, &aciinfo.Name, &aciinfo.ImportTime, &aciinfo.LastUsed, &aciinfo.Latest, &aciinfo.Size, &aciinfo.TreeStoreSize, &aciinfo.InsecureOptions); err != nil {
Expand All @@ -561,6 +566,7 @@ func getAllACIInfosV7(tx *sql.Tx) ([]*ACIInfoV7, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
aciinfo := &ACIInfoV7{}
if rows.Scan(&aciinfo.BlobKey, &aciinfo.Name, &aciinfo.ImportTime, &aciinfo.LastUsed, &aciinfo.Latest, &aciinfo.Size, &aciinfo.TreeStoreSize); err != nil {
Expand All @@ -587,6 +593,7 @@ func getAllRemoteV0_1(tx *sql.Tx) ([]*RemoteV0_1, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
remote := &RemoteV0_1{}
if err := rows.Scan(&remote.ACIURL, &remote.SigURL, &remote.ETag, &remote.BlobKey); err != nil {
Expand Down Expand Up @@ -615,6 +622,7 @@ func getAllRemoteV2_7(tx *sql.Tx) ([]*RemoteV2_7, error) {
if err != nil {
return nil, err
}
defer rows.Close()
for rows.Next() {
remote := &RemoteV2_7{}
if err := rows.Scan(&remote.ACIURL, &remote.SigURL, &remote.ETag, &remote.BlobKey, &remote.CacheMaxAge, &remote.DownloadTime); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions store/imagestore/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func GetRemote(tx *sql.Tx, aciURL string) (*Remote, error) {
if err != nil {
return nil, err
}
defer rows.Close()

if ok := rows.Next(); !ok {
return nil, ErrRemoteNotFound
Expand Down Expand Up @@ -86,6 +87,7 @@ func GetAllRemotes(tx *sql.Tx) ([]*Remote, error) {
return nil, err

}
defer rows.Close()

for rows.Next() {
r := &Remote{}
Expand Down
2 changes: 2 additions & 0 deletions store/imagestore/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func dbIsPopulated(tx *sql.Tx) (bool, error) {
if err != nil {
return false, err
}
defer rows.Close()
count := 0
for rows.Next() {
count++
Expand All @@ -68,6 +69,7 @@ func getDBVersion(tx *sql.Tx) (int, error) {
if err != nil {
return -1, err
}
defer rows.Close()
found := false
for rows.Next() {
if err := rows.Scan(&version); err != nil {
Expand Down