This commit is contained in:
Jarek Kowalski
2016-06-08 22:43:20 -07:00
parent 1dd120822d
commit d08bbc8130
5 changed files with 12 additions and 11 deletions

View File

@@ -29,7 +29,7 @@ type Flusher interface {
Flush() error
}
// ConnectionInfoProvider exposes persistent ConnectionInfo for connecting to the storage.
// ConnectionInfoProvider exposes persistent ConnectionInfo for connecting to the Storage.
type ConnectionInfoProvider interface {
ConnectionInfo() ConnectionInfo
}

View File

@@ -129,8 +129,8 @@ func runCreateCommand(context *kingpin.ParseContext) error {
}
if err := vlt.SetRepository(vault.RepositoryConfig{
Storage: cip.ConnectionInfo(),
Format: repoFormat,
Connection: cip.ConnectionInfo(),
Format: repoFormat,
}); err != nil {
return fmt.Errorf("unable to save repository configuration in vault: %v", err)
}

View File

@@ -21,6 +21,7 @@
minLocatorSizeBytes = 16
)
// ObjectReader allows reading, seeking and closing of a repository object.
type ObjectReader interface {
io.Reader
io.Seeker

View File

@@ -38,6 +38,6 @@ func (f *Format) ensureUniqueID() error {
}
type RepositoryConfig struct {
Storage blob.ConnectionInfo `json:"storage"`
Format *repo.Format `json:"repository"`
Connection blob.ConnectionInfo `json:"connection"`
Format *repo.Format `json:"format"`
}

View File

@@ -188,7 +188,7 @@ func (v *Vault) OpenRepository() (repo.Repository, error) {
return nil, err
}
storage, err := blob.NewStorage(rc.Storage)
storage, err := blob.NewStorage(rc.Connection)
if err != nil {
return nil, fmt.Errorf("unable to open repository: %v", err)
}
@@ -232,8 +232,8 @@ func (v *Vault) List(prefix string) ([]string, error) {
}
type vaultConfig struct {
Connection blob.ConnectionInfo `json:"connection"`
Key []byte `json:"key,omitempty"`
ConnectionInfo blob.ConnectionInfo `json:"connection"`
Key []byte `json:"key,omitempty"`
}
// Token returns a persistent opaque string that encodes the configuration of vault storage
@@ -245,8 +245,8 @@ func (v *Vault) Token() (string, error) {
}
vc := vaultConfig{
Connection: cip.ConnectionInfo(),
Key: v.masterKey,
ConnectionInfo: cip.ConnectionInfo(),
Key: v.masterKey,
}
b, err := json.Marshal(&vc)
@@ -385,7 +385,7 @@ func OpenWithToken(token string) (*Vault, error) {
return nil, fmt.Errorf("invalid vault token")
}
st, err := blob.NewStorage(vc.Connection)
st, err := blob.NewStorage(vc.ConnectionInfo)
if err != nil {
return nil, fmt.Errorf("cannot open vault storage: %v", err)
}