diff --git a/autostate/backup/config.go b/auto/backup/config.go similarity index 71% rename from autostate/backup/config.go rename to auto/backup/config.go index 913fe753..8b9637b5 100644 --- a/autostate/backup/config.go +++ b/auto/backup/config.go @@ -5,17 +5,17 @@ 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"` - NoCompress bool `json:"no_compress,omitempty"` - Interval autostate.Duration `json:"interval"` - Sub json.RawMessage `json:"sub"` + Version int `json:"version"` + Type auto.StorageType `json:"type"` + NoCompress bool `json:"no_compress,omitempty"` + Interval auto.Duration `json:"interval"` + Sub json.RawMessage `json:"sub"` } // Unmarshal unmarshals the config file and returns the config and subconfig @@ -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{} diff --git a/autostate/backup/config_test.go b/auto/backup/config_test.go similarity index 96% rename from autostate/backup/config_test.go rename to auto/backup/config_test.go index f4768fcf..8ccf3391 100644 --- a/autostate/backup/config_test.go +++ b/auto/backup/config_test.go @@ -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, }, } diff --git a/autostate/backup/sum.go b/auto/backup/sum.go similarity index 100% rename from autostate/backup/sum.go rename to auto/backup/sum.go diff --git a/autostate/backup/sum_test.go b/auto/backup/sum_test.go similarity index 100% rename from autostate/backup/sum_test.go rename to auto/backup/sum_test.go diff --git a/autostate/backup/uploader.go b/auto/backup/uploader.go similarity index 100% rename from autostate/backup/uploader.go rename to auto/backup/uploader.go diff --git a/autostate/backup/uploader_test.go b/auto/backup/uploader_test.go similarity index 100% rename from autostate/backup/uploader_test.go rename to auto/backup/uploader_test.go diff --git a/autostate/restore/config.go b/auto/restore/config.go similarity index 66% rename from autostate/restore/config.go rename to auto/restore/config.go index 2055cd48..70c6599c 100644 --- a/autostate/restore/config.go +++ b/auto/restore/config.go @@ -6,17 +6,17 @@ 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"` - ContinueOnFailure bool `json:"continue_on_failure,omitempty"` - Sub json.RawMessage `json:"sub"` + Version int `json:"version"` + Type auto.StorageType `json:"type"` + Timeout auto.Duration `json:"timeout,omitempty"` + ContinueOnFailure bool `json:"continue_on_failure,omitempty"` + Sub json.RawMessage `json:"sub"` } // Unmarshal unmarshals the config file and returns the config and subconfig @@ -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{} diff --git a/autostate/restore/config_test.go b/auto/restore/config_test.go similarity index 95% rename from autostate/restore/config_test.go rename to auto/restore/config_test.go index 29e6f640..1a677e3d 100644 --- a/autostate/restore/config_test.go +++ b/auto/restore/config_test.go @@ -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, }, } diff --git a/autostate/restore/downloader.go b/auto/restore/downloader.go similarity index 100% rename from autostate/restore/downloader.go rename to auto/restore/downloader.go diff --git a/autostate/restore/downloader_test.go b/auto/restore/downloader_test.go similarity index 100% rename from autostate/restore/downloader_test.go rename to auto/restore/downloader_test.go diff --git a/autostate/types.go b/auto/types.go similarity index 98% rename from autostate/types.go rename to auto/types.go index cd74a72f..f68e6113 100644 --- a/autostate/types.go +++ b/auto/types.go @@ -1,4 +1,4 @@ -package autostate +package auto import ( "encoding/json" diff --git a/cmd/rqlited/main.go b/cmd/rqlited/main.go index f9f64692..dedfb0f0 100644 --- a/cmd/rqlited/main.go +++ b/cmd/rqlited/main.go @@ -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"