storage

package
v2.13.7+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateImageRepo

func CreateImageRepo(reponame string, params map[string]string) error

CreateImageRepo create a repository for the image on amazon's ECR(EC2 Container Repository) if it doesn't exist as repository needs to be present before pushing and image into it.

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

func (f *FakeObjectGetter) GetContent(ctx context.Context, path string) ([]byte, error)

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

Stat is the interface definition.

type FakeStatObjectCall

type FakeStatObjectCall struct {
	Path string
}

FakeStatObjectCall represents a single call to StatObject on the FakeObjectStatter.

type ObjectGetter

type ObjectGetter interface {
	GetContent(ctx context.Context, path string) ([]byte, error)
}

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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL