Skip to content

Commit 4023ab1

Browse files
martinmrdna2github
authored andcommitted
Change groupId from int to uint32. (dgraph-io#5605)
This change removes the need to convert between int and uint32. Group IDs are always uint32.
1 parent 9710b26 commit 4023ab1

5 files changed

Lines changed: 5 additions & 5 deletions

File tree

worker/backup_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func NewUriHandler(uri *url.URL, creds *Credentials) (UriHandler, error) {
144144
// loadFn is a function that will receive the current file being read.
145145
// A reader, the backup groupId, and a map whose keys are the predicates to restore
146146
// are passed as arguments.
147-
type loadFn func(reader io.Reader, groupId int, preds predicateSet) (uint64, error)
147+
type loadFn func(reader io.Reader, groupId uint32, preds predicateSet) (uint64, error)
148148

149149
// LoadBackup will scan location l for backup files in the given backup series and load them
150150
// sequentially. Returns the maximum Since value on success, otherwise an error.

worker/file_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ func (h *fileHandler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult
173173
// of the last backup.
174174
predSet := manifests[len(manifests)-1].getPredsInGroup(gid)
175175

176-
groupMaxUid, err := fn(fp, int(gid), predSet)
176+
groupMaxUid, err := fn(fp, gid, predSet)
177177
if err != nil {
178178
return LoadResult{0, 0, err}
179179
}

worker/online_restore_ee.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ func getEncConfig(req *pb.RestoreRequest) (*viper.Viper, error) {
230230

231231
func writeBackup(ctx context.Context, req *pb.RestoreRequest) error {
232232
res := LoadBackup(req.Location, req.BackupId,
233-
func(r io.Reader, groupId int, preds predicateSet) (uint64, error) {
233+
func(r io.Reader, groupId uint32, preds predicateSet) (uint64, error) {
234234
cfg, err := getEncConfig(req)
235235
if err != nil {
236236
return 0, errors.Wrapf(err, "unable to get encryption config")

worker/restore.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func RunRestore(pdir, location, backupId string, key x.SensitiveByteSlice) LoadR
4444
// Scan location for backup files and load them. Each file represents a node group,
4545
// and we create a new p dir for each.
4646
return LoadBackup(location, backupId,
47-
func(r io.Reader, groupId int, preds predicateSet) (uint64, error) {
47+
func(r io.Reader, groupId uint32, preds predicateSet) (uint64, error) {
4848

4949
dir := filepath.Join(pdir, fmt.Sprintf("p%d", groupId))
5050
r, err := enc.GetReader(key, r)

worker/s3_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ func (h *s3Handler) Load(uri *url.URL, backupId string, fn loadFn) LoadResult {
362362
// of the last backup.
363363
predSet := manifests[len(manifests)-1].getPredsInGroup(gid)
364364

365-
groupMaxUid, err := fn(reader, int(gid), predSet)
365+
groupMaxUid, err := fn(reader, gid, predSet)
366366
if err != nil {
367367
return LoadResult{0, 0, err}
368368
}

0 commit comments

Comments
 (0)