Skip to content

Commit

Permalink
do not immediately return listing of objects when it meets empty rows…
Browse files Browse the repository at this point in the history
…, for post-process
  • Loading branch information
iychoi committed Jun 14, 2023
1 parent f922bef commit 66201dc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 27 deletions.
12 changes: 6 additions & 6 deletions irods/fs/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func ListCollectionMeta(conn *connection.IRODSConnection, path string) ([]*types
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return metas, nil
break
}
return nil, xerrors.Errorf("received collection metadata query error: %w", err)
}
Expand Down Expand Up @@ -284,7 +284,7 @@ func ListCollectionAccesses(conn *connection.IRODSConnection, path string) ([]*t
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return accesses, nil
break
}
return nil, xerrors.Errorf("received collection access query error: %w", err)
}
Expand Down Expand Up @@ -385,7 +385,7 @@ func ListAccessesForSubCollections(conn *connection.IRODSConnection, path string
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return accesses, nil
break
}
return nil, xerrors.Errorf("received collection access query error: %w", err)
}
Expand Down Expand Up @@ -488,7 +488,7 @@ func ListSubCollections(conn *connection.IRODSConnection, path string) ([]*types
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return collections, nil
break
}
return nil, xerrors.Errorf("received collection query error: %w", err)
}
Expand Down Expand Up @@ -769,7 +769,7 @@ func SearchCollectionsByMeta(conn *connection.IRODSConnection, metaName string,
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return collections, nil
break
}
return nil, xerrors.Errorf("received collection query error: %w", err)
}
Expand Down Expand Up @@ -889,7 +889,7 @@ func SearchCollectionsByMetaWildcard(conn *connection.IRODSConnection, metaName
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return collections, nil
break
}
return nil, xerrors.Errorf("received collection query error: %w", err)
}
Expand Down
19 changes: 10 additions & 9 deletions irods/fs/data_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ func ListDataObjects(conn *connection.IRODSConnection, collection *types.IRODSCo
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down Expand Up @@ -670,7 +670,7 @@ func ListDataObjectsMasterReplica(conn *connection.IRODSConnection, collection *
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down Expand Up @@ -783,6 +783,7 @@ func ListDataObjectsMasterReplica(conn *connection.IRODSConnection, collection *

// merge data objects per file
mergedDataObjectsMap := map[int64]*types.IRODSDataObject{}

for _, object := range dataObjects {
existingObj, exists := mergedDataObjectsMap[object.ID]
if exists {
Expand Down Expand Up @@ -852,7 +853,7 @@ func ListDataObjectMeta(conn *connection.IRODSConnection, collection *types.IROD
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return metas, nil
break
}
return nil, xerrors.Errorf("received data object metadata query error: %w", err)
}
Expand Down Expand Up @@ -957,7 +958,7 @@ func ListDataObjectAccesses(conn *connection.IRODSConnection, collection *types.
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return accesses, nil
break
}
return nil, xerrors.Errorf("received data object access query error: %w", err)
}
Expand Down Expand Up @@ -1058,7 +1059,7 @@ func ListAccessesForDataObjects(conn *connection.IRODSConnection, collection *ty
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return accesses, nil
break
}
return nil, xerrors.Errorf("received data object access query error: %w", err)
}
Expand Down Expand Up @@ -1990,7 +1991,7 @@ func SearchDataObjectsByMeta(conn *connection.IRODSConnection, metaName string,
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down Expand Up @@ -2195,7 +2196,7 @@ func SearchDataObjectsMasterReplicaByMeta(conn *connection.IRODSConnection, meta
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down Expand Up @@ -2408,7 +2409,7 @@ func SearchDataObjectsByMetaWildcard(conn *connection.IRODSConnection, metaName
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down Expand Up @@ -2614,7 +2615,7 @@ func SearchDataObjectsMasterReplicaByMetaWildcard(conn *connection.IRODSConnecti
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return dataObjects, nil
break
}
return nil, xerrors.Errorf("received data object query error: %w", err)
}
Expand Down
12 changes: 6 additions & 6 deletions irods/fs/ticket.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ func ListTicketsForDataObjects(conn *connection.IRODSConnection) ([]*types.IRODS
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return tickets, nil
break
}

return nil, xerrors.Errorf("received a ticket query error: %w", err)
Expand Down Expand Up @@ -719,7 +719,7 @@ func ListTicketsForCollections(conn *connection.IRODSConnection) ([]*types.IRODS
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return tickets, nil
break
}

return nil, xerrors.Errorf("received a ticket query error: %w", err)
Expand Down Expand Up @@ -884,7 +884,7 @@ func ListTicketsBasic(conn *connection.IRODSConnection) ([]*types.IRODSTicket, e
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return tickets, nil
break
}

return nil, xerrors.Errorf("received a ticket query error: %w", err)
Expand Down Expand Up @@ -1038,7 +1038,7 @@ func ListTicketAllowedHosts(conn *connection.IRODSConnection, ticketID int64) ([
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return hosts, nil
break
}

return nil, xerrors.Errorf("received a ticket restriction query error: %w", err)
Expand Down Expand Up @@ -1114,7 +1114,7 @@ func ListTicketAllowedUserNames(conn *connection.IRODSConnection, ticketID int64
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return usernames, nil
break
}

return nil, xerrors.Errorf("received a ticket restriction query error: %w", err)
Expand Down Expand Up @@ -1190,7 +1190,7 @@ func ListTicketAllowedGroupNames(conn *connection.IRODSConnection, ticketID int6
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return groupnames, nil
break
}

return nil, xerrors.Errorf("received a ticket restriction query error: %w", err)
Expand Down
12 changes: 6 additions & 6 deletions irods/fs/usergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func ListGroupUsers(conn *connection.IRODSConnection, group string) ([]*types.IR
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return users, nil
break
}
return nil, xerrors.Errorf("received a group user query error: %w", err)
}
Expand Down Expand Up @@ -244,7 +244,7 @@ func ListGroups(conn *connection.IRODSConnection) ([]*types.IRODSUser, error) {
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return groups, nil
break
}
return nil, xerrors.Errorf("received a group query error: %w", err)
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func ListUsers(conn *connection.IRODSConnection) ([]*types.IRODSUser, error) {
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return users, nil
break
}
return nil, xerrors.Errorf("received a user query error: %w", err)
}
Expand Down Expand Up @@ -437,7 +437,7 @@ func ListUserGroupNames(conn *connection.IRODSConnection, user string) ([]string
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return groups, nil
break
}
return nil, xerrors.Errorf("received a group query error: %w", err)
}
Expand Down Expand Up @@ -631,7 +631,7 @@ func ListUserResourceQuota(conn *connection.IRODSConnection, user string) ([]*ty
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return quota, nil
break
}
return nil, xerrors.Errorf("received a quota query error: %w", err)
}
Expand Down Expand Up @@ -848,7 +848,7 @@ func ListUserMeta(conn *connection.IRODSConnection, user string) ([]*types.IRODS
if err != nil {
if types.GetIRODSErrorCode(err) == common.CAT_NO_ROWS_FOUND {
// empty
return metas, nil
break
}
return nil, xerrors.Errorf("received a user metadata query error: %w", err)
}
Expand Down

0 comments on commit 66201dc

Please sign in to comment.