Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ObjectExists ¶
func ObjectExists(statter ObjectStatter, objKey string) (bool, error)
ObjectExists determines whether the object in ${bucketName}/${objKey} exists, as reported by statter. Returns the following:
- false, nil if statter succeeded and reported the object doesn't exist - false, err with the appropriate error if the statter failed - true, nil if the statter succeeded and reported the object exists
func WaitForObject ¶
func WaitForObject(statter ObjectStatter, objKey string, tick, timeout time.Duration) error
WaitForObject checks statter for the object at ${bucketName}/${objKey} right away, then at every tick, then once when the timeout is up. Returns nil if it finds the object before or at timeout. Otherwise returns a non-nil error.
Types ¶
type FakeGetObjectCall ¶
type FakeGetObjectCall struct {
Path string
}
FakeGetObjectCall represents a single call to GetContent on the FakeObjectStatter.
type FakeObjectGetter ¶
type FakeObjectGetter struct { Fn func(context.Context, string) ([]byte, error) Calls []FakeGetObjectCall }
FakeObjectGetter is a mock function that can be swapped in for an ObjectGetter, so you can unit test your code.
func (*FakeObjectGetter) GetContent ¶
GetContent is the interface definition.
type FakeObjectStatter ¶
type FakeObjectStatter struct { Fn func(context.Context, string) (storagedriver.FileInfo, error) Calls []FakeStatObjectCall }
FakeObjectStatter is a mock function that can be swapped in for an ObjectStatter, so you can unit test your code.
func (*FakeObjectStatter) Stat ¶
func (f *FakeObjectStatter) Stat(ctx context.Context, path string) (storagedriver.FileInfo, error)
Stat is the interface definition.
type FakeStatObjectCall ¶
type FakeStatObjectCall struct {
Path string
}
FakeStatObjectCall represents a single call to StatObject on the FakeObjectStatter.
type ObjectGetter ¶
ObjectGetter is a *(github.com/docker/distribution/registry/storage/driver).StorageDriver compatible interface, restricted to just the GetContent function. You can use it in your code for easier unit testing without any external dependencies (like access to S3).
type ObjectStatter ¶
type ObjectStatter interface {
Stat(ctx context.Context, path string) (storagedriver.FileInfo, error)
}
ObjectStatter is a *(github.com/docker/distribution/registry/storage/driver).StorageDriver compatible interface, restricted to just the StatObject function. You can use it in your code for easier unit testing without any external dependencies (like access to S3).