1
0
Fork 0

Even better package name

master
Philip O'Toole 1 year ago
parent fd4433ea4b
commit 12f3dd913a

@ -5,16 +5,16 @@ import (
"io/ioutil"
"os"
"github.com/rqlite/rqlite/autostate"
"github.com/rqlite/rqlite/auto"
"github.com/rqlite/rqlite/aws"
)
// Config is the config file format for the upload service
type Config struct {
Version int `json:"version"`
Type autostate.StorageType `json:"type"`
Type auto.StorageType `json:"type"`
NoCompress bool `json:"no_compress,omitempty"`
Interval autostate.Duration `json:"interval"`
Interval auto.Duration `json:"interval"`
Sub json.RawMessage `json:"sub"`
}
@ -26,8 +26,8 @@ func Unmarshal(data []byte) (*Config, *aws.S3Config, error) {
return nil, nil, err
}
if cfg.Version > autostate.Version {
return nil, nil, autostate.ErrInvalidVersion
if cfg.Version > auto.Version {
return nil, nil, auto.ErrInvalidVersion
}
s3cfg := &aws.S3Config{}

@ -9,7 +9,7 @@ import (
"testing"
"time"
"github.com/rqlite/rqlite/autostate"
"github.com/rqlite/rqlite/auto"
"github.com/rqlite/rqlite/aws"
)
@ -138,7 +138,7 @@ func TestUnmarshal(t *testing.T) {
Version: 1,
Type: "s3",
NoCompress: true,
Interval: 24 * autostate.Duration(time.Hour),
Interval: 24 * auto.Duration(time.Hour),
},
expectedS3: &aws.S3Config{
AccessKeyID: "test_id",
@ -169,7 +169,7 @@ func TestUnmarshal(t *testing.T) {
Version: 1,
Type: "s3",
NoCompress: false,
Interval: 24 * autostate.Duration(time.Hour),
Interval: 24 * auto.Duration(time.Hour),
},
expectedS3: &aws.S3Config{
AccessKeyID: "test_id",
@ -198,7 +198,7 @@ func TestUnmarshal(t *testing.T) {
} `),
expectedCfg: nil,
expectedS3: nil,
expectedErr: autostate.ErrInvalidVersion,
expectedErr: auto.ErrInvalidVersion,
},
{
name: "UnsupportedType",
@ -218,7 +218,7 @@ func TestUnmarshal(t *testing.T) {
} `),
expectedCfg: nil,
expectedS3: nil,
expectedErr: autostate.ErrUnsupportedStorageType,
expectedErr: auto.ErrUnsupportedStorageType,
},
}

@ -6,15 +6,15 @@ import (
"os"
"time"
"github.com/rqlite/rqlite/autostate"
"github.com/rqlite/rqlite/auto"
"github.com/rqlite/rqlite/aws"
)
// Config is the config file format for the upload service
type Config struct {
Version int `json:"version"`
Type autostate.StorageType `json:"type"`
Timeout autostate.Duration `json:"timeout,omitempty"`
Type auto.StorageType `json:"type"`
Timeout auto.Duration `json:"timeout,omitempty"`
ContinueOnFailure bool `json:"continue_on_failure,omitempty"`
Sub json.RawMessage `json:"sub"`
}
@ -27,12 +27,12 @@ func Unmarshal(data []byte) (*Config, *aws.S3Config, error) {
return nil, nil, err
}
if cfg.Version > autostate.Version {
return nil, nil, autostate.ErrInvalidVersion
if cfg.Version > auto.Version {
return nil, nil, auto.ErrInvalidVersion
}
if cfg.Timeout == 0 {
cfg.Timeout = autostate.Duration(30 * time.Second)
cfg.Timeout = auto.Duration(30 * time.Second)
}
s3cfg := &aws.S3Config{}

@ -9,7 +9,7 @@ import (
"testing"
"time"
"github.com/rqlite/rqlite/autostate"
"github.com/rqlite/rqlite/auto"
"github.com/rqlite/rqlite/aws"
)
@ -136,7 +136,7 @@ func TestUnmarshal(t *testing.T) {
expectedCfg: &Config{
Version: 1,
Type: "s3",
Timeout: 30 * autostate.Duration(time.Second),
Timeout: 30 * auto.Duration(time.Second),
ContinueOnFailure: false,
},
expectedS3: &aws.S3Config{
@ -167,7 +167,7 @@ func TestUnmarshal(t *testing.T) {
expectedCfg: &Config{
Version: 1,
Type: "s3",
Timeout: autostate.Duration(30 * time.Second),
Timeout: auto.Duration(30 * time.Second),
ContinueOnFailure: true,
},
expectedS3: &aws.S3Config{
@ -196,7 +196,7 @@ func TestUnmarshal(t *testing.T) {
} `),
expectedCfg: nil,
expectedS3: nil,
expectedErr: autostate.ErrInvalidVersion,
expectedErr: auto.ErrInvalidVersion,
},
{
name: "UnsupportedType",
@ -215,7 +215,7 @@ func TestUnmarshal(t *testing.T) {
} `),
expectedCfg: nil,
expectedS3: nil,
expectedErr: autostate.ErrUnsupportedStorageType,
expectedErr: auto.ErrUnsupportedStorageType,
},
}

@ -1,4 +1,4 @@
package autostate
package auto
import (
"encoding/json"

@ -19,8 +19,8 @@ import (
"github.com/rqlite/rqlite-disco-clients/dnssrv"
etcd "github.com/rqlite/rqlite-disco-clients/etcd"
"github.com/rqlite/rqlite/auth"
"github.com/rqlite/rqlite/autostate/backup"
"github.com/rqlite/rqlite/autostate/restore"
"github.com/rqlite/rqlite/auto/backup"
"github.com/rqlite/rqlite/auto/restore"
"github.com/rqlite/rqlite/aws"
"github.com/rqlite/rqlite/cluster"
"github.com/rqlite/rqlite/cmd"

Loading…
Cancel
Save