From 76c98ee2f8f5bf03b276a4124585add6d0afbd2f Mon Sep 17 00:00:00 2001 From: Martin Martinez Rivera Date: Tue, 9 Jun 2020 12:16:45 -0700 Subject: [PATCH] Change groupId from int to uint32. (#5605) This change removes the need to convert between int and uint32. Group IDs are always uint32. --- worker/backup_handler.go | 2 +- worker/file_handler.go | 2 +- worker/restore.go | 2 +- worker/s3_handler.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/worker/backup_handler.go b/worker/backup_handler.go index f72aa336d42..ea5923b2dc5 100644 --- a/worker/backup_handler.go +++ b/worker/backup_handler.go @@ -171,7 +171,7 @@ type predicateSet map[string]struct{} // loadFn is a function that will receive the current file being read. // A reader, the backup groupId, and a map whose keys are the predicates to restore // are passed as arguments. -type loadFn func(reader io.Reader, groupId int, preds predicateSet) (uint64, error) +type loadFn func(reader io.Reader, groupId uint32, preds predicateSet) (uint64, error) // LoadBackup will scan location l for backup files in the given backup series and load them // sequentially. Returns the maximum Since value on success, otherwise an error. diff --git a/worker/file_handler.go b/worker/file_handler.go index 0d8693781c0..e2dcd7c5826 100644 --- a/worker/file_handler.go +++ b/worker/file_handler.go @@ -171,7 +171,7 @@ func (h *fileHandler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult // of the last backup. predSet := manifests[len(manifests)-1].getPredsInGroup(gid) - groupMaxUid, err := fn(fp, int(gid), predSet) + groupMaxUid, err := fn(fp, gid, predSet) if err != nil { return LoadResult{0, 0, err} } diff --git a/worker/restore.go b/worker/restore.go index 0f3081068ff..bd4b79d16a2 100644 --- a/worker/restore.go +++ b/worker/restore.go @@ -44,7 +44,7 @@ func RunRestore(pdir, location, backupId, keyfile string) LoadResult { // Scan location for backup files and load them. Each file represents a node group, // and we create a new p dir for each. return LoadBackup(location, backupId, - func(r io.Reader, groupId int, preds predicateSet) (uint64, error) { + func(r io.Reader, groupId uint32, preds predicateSet) (uint64, error) { dir := filepath.Join(pdir, fmt.Sprintf("p%d", groupId)) r, err := enc.GetReader(keyfile, r) diff --git a/worker/s3_handler.go b/worker/s3_handler.go index e41f4d4ca3d..50562969815 100644 --- a/worker/s3_handler.go +++ b/worker/s3_handler.go @@ -318,7 +318,7 @@ func (h *s3Handler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult { // of the last backup. predSet := manifests[len(manifests)-1].getPredsInGroup(gid) - groupMaxUid, err := fn(reader, int(gid), predSet) + groupMaxUid, err := fn(reader, gid, predSet) if err != nil { return LoadResult{0, 0, err} }