gs: minor comment cleanups

* Remove a reference to S3.
* Config can only be used for GCS, not other "gcs compatibile servers".
* Make comments complete sentences.
This commit is contained in:
Michael Pratt 2017-09-24 10:10:56 -07:00
parent 49d397a419
commit 5f4f997126
2 changed files with 9 additions and 9 deletions

View file

@ -8,8 +8,8 @@ import (
"github.com/restic/restic/internal/options" "github.com/restic/restic/internal/options"
) )
// Config contains all configuration necessary to connect to an gcs compatible // Config contains all configuration necessary to connect to a Google Cloud
// server. // Storage bucket.
type Config struct { type Config struct {
ProjectID string ProjectID string
JSONKeyPath string JSONKeyPath string

View file

@ -1,3 +1,4 @@
// Package gs provides a restic backend for Google Cloud Storage.
package gs package gs
import ( import (
@ -31,7 +32,7 @@ type Backend struct {
backend.Layout backend.Layout
} }
// make sure that *Backend implements backend.Backend // Ensure that *Backend implements restic.Backend.
var _ restic.Backend = &Backend{} var _ restic.Backend = &Backend{}
func getStorageService(jsonKeyPath string) (*storage.Service, error) { func getStorageService(jsonKeyPath string) (*storage.Service, error) {
@ -87,21 +88,20 @@ func open(cfg Config) (*Backend, error) {
return be, nil return be, nil
} }
// Open opens the gs backend at bucket and region. // Open opens the gs backend at the specified bucket.
func Open(cfg Config) (restic.Backend, error) { func Open(cfg Config) (restic.Backend, error) {
return open(cfg) return open(cfg)
} }
// Create opens the S3 backend at bucket and region and creates the bucket if // Create opens the gs backend at the specified bucket and creates the bucket
// it does not exist yet. // if it does not exist yet.
func Create(cfg Config) (restic.Backend, error) { func Create(cfg Config) (restic.Backend, error) {
be, err := open(cfg) be, err := open(cfg)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "open") return nil, errors.Wrap(err, "open")
} }
// Create bucket if not exists // Create bucket if it doesn't exist.
if _, err := be.service.Buckets.Get(be.bucketName).Do(); err != nil { if _, err := be.service.Buckets.Get(be.bucketName).Do(); err != nil {
bucket := &storage.Bucket{ bucket := &storage.Bucket{
Name: be.bucketName, Name: be.bucketName,
@ -371,5 +371,5 @@ func (be *Backend) Delete(ctx context.Context) error {
return be.Remove(ctx, restic.Handle{Type: restic.ConfigFile}) return be.Remove(ctx, restic.Handle{Type: restic.ConfigFile})
} }
// Close does nothing // Close does nothing.
func (be *Backend) Close() error { return nil } func (be *Backend) Close() error { return nil }