Skip to content

Commit

Permalink
Add storage root folder prefix to startAfter flag (#270)
Browse files Browse the repository at this point in the history
* fix scan after flag

* linter warnings

* rollback config
  • Loading branch information
korotkov-aerospike authored Nov 25, 2024
1 parent f83837b commit 4ff9568
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/service/storage/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (a *AzureStorageAccessor) createReader(
opts := []azure.Opt{
azure.WithValidator(filter),
azure.WithNestedDir(),
azure.WithStartAfter(startScanFrom),
azure.WithStartAfter(filepath.Join(azures.Path, startScanFrom)),
}
fullPath := filepath.Join(azures.Path, path)
if isFile {
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/storage/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (a *GcpStorageAccessor) createReader(
opts := []gcp.Opt{
gcp.WithValidator(filter),
gcp.WithNestedDir(),
gcp.WithStartOffset(startScanFrom),
gcp.WithStartOffset(filepath.Join(gcps.Path, startScanFrom)),
}
fullPath := filepath.Join(gcps.Path, path)
if isFile {
Expand Down
6 changes: 4 additions & 2 deletions pkg/service/storage/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package storage
import (
"bytes"
"context"
"fmt"
"io"
"path/filepath"
"strconv"
"time"

"github.com/aerospike/aerospike-backup-service/v2/pkg/model"
Expand Down Expand Up @@ -49,7 +50,8 @@ func ReadFiles(ctx context.Context, storage model.Storage, path string, filterSt
) ([]*bytes.Buffer, error) {
var startScanFrom string
if fromTime != nil {
startScanFrom = fmt.Sprintf("%s/%d", path, fromTime.UnixMilli()-1) // -1 to ensure filter is greater or equal.
fromTimeStr := strconv.FormatInt(fromTime.UnixMilli()-1, 10) // -1 to ensure filter is greater or equal.
startScanFrom = filepath.Join(path, fromTimeStr)
}

reader, err := CreateReader(ctx, storage, path, false, newNameValidator(filterStr), startScanFrom)
Expand Down
2 changes: 1 addition & 1 deletion pkg/service/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (a *S3StorageAccessor) createReader(
opts := []s3.Opt{
s3.WithValidator(filter),
s3.WithNestedDir(),
s3.WithStartAfter(startScanFrom),
s3.WithStartAfter(filepath.Join(s3s.Path, startScanFrom)),
}
fullPath := filepath.Join(s3s.Path, path)
if isFile {
Expand Down

0 comments on commit 4ff9568

Please sign in to comment.