google-cloud-go-testing: github.com/googleapis/google-cloud-go-testing/storage/stiface Index | Files

package stiface

import "github.com/googleapis/google-cloud-go-testing/storage/stiface"

Package stiface provides a set of interfaces for the types in cloud.google.com/go/storage. These can be used to create mocks or other test doubles. The package also provides adapters to enable the types of the storage package to implement these interfaces.

We do not recommend using mocks for most testing. Please read https://testing.googleblog.com/2013/05/testing-on-toilet-dont-overuse-mocks.html.

Note: This package is in alpha. Some backwards-incompatible changes may occur.

You must embed these interfaces to implement them:

type ClientMock struct {
    stiface.Client
    ...
}

This ensures that your implementations will not break when methods are added to the interfaces.

Index

Package Files

adapters.go doc.go interfaces.go

type ACLHandle Uses

type ACLHandle interface {
    Delete(context.Context, storage.ACLEntity) error
    Set(context.Context, storage.ACLEntity, storage.ACLRole) error
    List(context.Context) ([]storage.ACLRule, error)
    // contains filtered or unexported methods
}

type BucketHandle Uses

type BucketHandle interface {
    Create(context.Context, string, *storage.BucketAttrs) error
    Delete(context.Context) error
    DefaultObjectACL() ACLHandle
    Object(string) ObjectHandle
    Attrs(context.Context) (*storage.BucketAttrs, error)
    Update(context.Context, storage.BucketAttrsToUpdate) (*storage.BucketAttrs, error)
    If(storage.BucketConditions) BucketHandle
    Objects(context.Context, *storage.Query) ObjectIterator
    ACL() ACLHandle
    IAM() *iam.Handle
    UserProject(projectID string) BucketHandle
    Notifications(context.Context) (map[string]*storage.Notification, error)
    AddNotification(context.Context, *storage.Notification) (*storage.Notification, error)
    DeleteNotification(context.Context, string) error
    LockRetentionPolicy(context.Context) error
    // contains filtered or unexported methods
}

type BucketIterator Uses

type BucketIterator interface {
    SetPrefix(string)
    Next() (*storage.BucketAttrs, error)
    PageInfo() *iterator.PageInfo
    // contains filtered or unexported methods
}

type Client Uses

type Client interface {
    Bucket(name string) BucketHandle
    Buckets(ctx context.Context, projectID string) BucketIterator
    Close() error
    // contains filtered or unexported methods
}

func AdaptClient Uses

func AdaptClient(c *storage.Client) Client

AdaptClient adapts a storage.Client so that it satisfies the Client interface.

type Composer Uses

type Composer interface {
    ObjectAttrs() *storage.ObjectAttrs
    Run(context.Context) (*storage.ObjectAttrs, error)
    // contains filtered or unexported methods
}

type Copier Uses

type Copier interface {
    ObjectAttrs() *storage.ObjectAttrs
    SetRewriteToken(string)
    SetProgressFunc(func(uint64, uint64))
    SetDestinationKMSKeyName(string)
    Run(context.Context) (*storage.ObjectAttrs, error)
    // contains filtered or unexported methods
}

type ObjectHandle Uses

type ObjectHandle interface {
    ACL() ACLHandle
    Generation(int64) ObjectHandle
    If(storage.Conditions) ObjectHandle
    Key([]byte) ObjectHandle
    ReadCompressed(bool) ObjectHandle
    Attrs(context.Context) (*storage.ObjectAttrs, error)
    Update(context.Context, storage.ObjectAttrsToUpdate) (*storage.ObjectAttrs, error)
    NewReader(context.Context) (Reader, error)
    NewRangeReader(context.Context, int64, int64) (Reader, error)
    NewWriter(context.Context) Writer
    Delete(context.Context) error
    CopierFrom(ObjectHandle) Copier
    ComposerFrom(...ObjectHandle) Composer
    // contains filtered or unexported methods
}

type ObjectIterator Uses

type ObjectIterator interface {
    Next() (*storage.ObjectAttrs, error)
    PageInfo() *iterator.PageInfo
    // contains filtered or unexported methods
}

type Reader Uses

type Reader interface {
    io.ReadCloser
    Size() int64
    Remain() int64
    ContentType() string
    ContentEncoding() string
    CacheControl() string
    // contains filtered or unexported methods
}

type Writer Uses

type Writer interface {
    io.WriteCloser
    ObjectAttrs() *storage.ObjectAttrs
    SetChunkSize(int)
    SetProgressFunc(func(int64))
    SetCRC32C(uint32) // Sets both CRC32C and SendCRC32C.
    CloseWithError(err error) error
    Attrs() *storage.ObjectAttrs
    // contains filtered or unexported methods
}

Package stiface imports 5 packages (graph) and is imported by 2 packages. Updated 2019-01-09. Refresh now. Tools for package owners.