Skip to content

Commit

Permalink
qualify module
Browse files Browse the repository at this point in the history
  • Loading branch information
dwelch-spike committed Feb 22, 2024
1 parent 75b5cd7 commit a8966d2
Show file tree
Hide file tree
Showing 21 changed files with 53 additions and 34 deletions.
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func main() {
panic(err)
}

backupErrors := make(chan error, 5)
backupHandlers := make()

// start 5 backup jobs
for i := 0; i < 5; i++ {
Expand All @@ -47,19 +47,22 @@ func main() {
}
defer file.Close()

backupOpts := backuplib.NewDefaultBackupToWriterOptions()
backupOpts.Parallel = 4
backupOpts.Namespace = "test"
backupCfg := backuplib.NewBackupToWriterConfig()
backupCfg.Parallel = 4
backupCfg.Namespace = "test"

writers := []io.Writer{file}

handler, errChan := backupClient.BackupToWriter(writers, backupOpts)
handler, err := backupClient.BackupToWriter(writers, backupCfg)
if err != nil {
panic(err)
}
// optionally check the status of the backup job
stats := handler.GetStatus()
// error channel closes when the backup is done
err = <-errChan
// use handler.Wait() to wait for the job to finish or fail
err = handler.Wait()
if err != nil {
backupErrors <- err
panic(err)
}
}

Expand All @@ -68,7 +71,10 @@ func main() {
panic(err)
}

// TODO Restore is similar
restoreErrors := make(chan error, 5)

// start 5 restore jobs from the files we backed up

```
### Prerequisites
Expand Down
5 changes: 3 additions & 2 deletions backup_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package backuplib

import (
datahandlers "backuplib/data_handlers"
"backuplib/encoder"
"io"

datahandlers "github.com/aerospike/aerospike-tools-backup-lib/data_handlers"
"github.com/aerospike/aerospike-tools-backup-lib/encoder"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
3 changes: 2 additions & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
package backuplib

import (
"backuplib/models"
"fmt"
"io"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
2 changes: 1 addition & 1 deletion data_handlers/mocks/ASBEncoder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion data_handlers/mocks/Encoder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions data_handlers/mocks/SIndexGetter.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion data_handlers/pipline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
package datahandlers

import (
"backuplib/data_handlers/mocks"
"context"
"errors"
"io"
"testing"

"github.com/aerospike/aerospike-tools-backup-lib/data_handlers/mocks"

"github.com/stretchr/testify/suite"
)

Expand Down
3 changes: 2 additions & 1 deletion data_handlers/readers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
package datahandlers

import (
"backuplib/models"
"io"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
4 changes: 2 additions & 2 deletions data_handlers/readers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import (
"testing"
"unsafe"

"backuplib/data_handlers/mocks"
"backuplib/models"
"github.com/aerospike/aerospike-tools-backup-lib/data_handlers/mocks"
"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
"github.com/stretchr/testify/suite"
Expand Down
3 changes: 2 additions & 1 deletion data_handlers/writers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
package datahandlers

import (
"backuplib/models"
"bytes"
"errors"
"fmt"
"io"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
4 changes: 2 additions & 2 deletions data_handlers/writers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import (
"errors"
"testing"

"backuplib/data_handlers/mocks"
"backuplib/models"
"github.com/aerospike/aerospike-tools-backup-lib/data_handlers/mocks"
"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
"github.com/stretchr/testify/suite"
Expand Down
3 changes: 2 additions & 1 deletion decoder/asb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package decoder

import (
"backuplib/models"
"bufio"
"bytes"
"encoding/base64"
Expand All @@ -25,6 +24,8 @@ import (
"math"
"strconv"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
3 changes: 2 additions & 1 deletion decoder/asb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package decoder

import (
"backuplib/models"
"bufio"
"encoding/base64"
"fmt"
Expand All @@ -25,6 +24,8 @@ import (
"strings"
"testing"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
"github.com/google/go-cmp/cmp"
)
Expand Down
3 changes: 2 additions & 1 deletion decoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package backuplib

import (
"backuplib/decoder"
"io"

"github.com/aerospike/aerospike-tools-backup-lib/decoder"
)

// ASBDecoderBuilder satisfies the DecoderBuilder interface
Expand Down
3 changes: 2 additions & 1 deletion encoder/asb.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
package encoder

import (
"backuplib/models"
"encoding/base64"
"errors"
"fmt"
"io"
"math"
"time"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
)

Expand Down
3 changes: 2 additions & 1 deletion encoder/asb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
package encoder

import (
"backuplib/models"
"fmt"
"math"
"reflect"
Expand All @@ -24,6 +23,8 @@ import (
"testing"
"time"

"github.com/aerospike/aerospike-tools-backup-lib/models"

a "github.com/aerospike/aerospike-client-go/v7"
"github.com/stretchr/testify/suite"
)
Expand Down
3 changes: 2 additions & 1 deletion encoders.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package backuplib

import (
"backuplib/encoder"
"io"

"github.com/aerospike/aerospike-tools-backup-lib/encoder"
)

// ASBEncoderBuilder satisfies the EncoderBuilder interface
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module backuplib
module github.com/aerospike/aerospike-tools-backup-lib

go 1.21

Expand Down
6 changes: 4 additions & 2 deletions integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@
package backuplib_test

import (
"backuplib"
testresources "backuplib/test"
"bytes"
"fmt"
"io"
"testing"

testresources "github.com/aerospike/aerospike-tools-backup-lib/test"

backuplib "github.com/aerospike/aerospike-tools-backup-lib"

a "github.com/aerospike/aerospike-client-go/v7"
"github.com/aerospike/tools-common-go/testutils"
"github.com/stretchr/testify/suite"
Expand Down
3 changes: 2 additions & 1 deletion restore_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
package backuplib

import (
datahandlers "backuplib/data_handlers"
"io"

datahandlers "github.com/aerospike/aerospike-tools-backup-lib/data_handlers"
)

// **** Generic Restore Handler ****
Expand Down
2 changes: 1 addition & 1 deletion work_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

package backuplib

import datahandlers "backuplib/data_handlers"
import datahandlers "github.com/aerospike/aerospike-tools-backup-lib/data_handlers"

// workHandler is a generic worker for running a data pipeline (job)
type workHandler struct{}
Expand Down

0 comments on commit a8966d2

Please sign in to comment.