cache

package
v1.25.3 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2019 License: Apache-2.0 Imports: 19 Imported by: 5

Documentation

Overview

Package cache provides functionality for working with an on-disk cache of the ECS Agent image.

Package cache is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheStatus

type CacheStatus uint8

CacheStatus represents the status of the on-disk cache for agent tarballs in the cache directory. This status may be used to determine what the appropriate actions are based on the availability of agent images and communicates advice from the cache's state file.

const (
	// StatusUncached indicates that there is not an already downloaded
	// and cached agent that is suitable for loading.
	StatusUncached CacheStatus = 0
	// StatusCached indicates that there is an agent downloaded and
	// cached. This should be taken to mean that the image is suitable
	// for load if agent isn't already loaded.
	StatusCached CacheStatus = 1
	// StatusReloadNeeded indicates that the cached image should take
	// precedence over the already loaded agent image. This may be
	// specified by the packaging to cause ecs-init to load a package
	// distributed cached image on package installation, upgrades, or
	// downgrades.
	StatusReloadNeeded CacheStatus = 2
)

type Downloader

type Downloader struct {
	// contains filtered or unexported fields
}

Downloader is responsible for cache operations relating to downloading the agent

func NewDownloader

func NewDownloader() (*Downloader, error)

NewDownloader returns a Downloader with default dependencies

func (*Downloader) AgentCacheStatus

func (d *Downloader) AgentCacheStatus() CacheStatus

AgentCacheStatus inspects the on-disk cache and returns its status. See `CacheStatus` for possible cache statuses and scenarios.

func (*Downloader) DownloadAgent

func (d *Downloader) DownloadAgent() error

DownloadAgent downloads a copy of the Agent and performs an integrity check of the downloaded image

func (*Downloader) IsAgentCached

func (d *Downloader) IsAgentCached() bool

IsAgentCached returns true if there is a cached copy of the Agent present and a cache state file is not empty (no validation is performed on the tarball or cache state file contents)

func (*Downloader) LoadCachedAgent

func (d *Downloader) LoadCachedAgent() (io.ReadCloser, error)

LoadCachedAgent returns an io.ReadCloser of the Agent from the cache

func (*Downloader) LoadDesiredAgent

func (d *Downloader) LoadDesiredAgent() (io.ReadCloser, error)

LoadDesiredAgent returns an io.ReadCloser of the Agent indicated by the desiredImageLocatorFile (/var/cache/ecs/desired-image). The desiredImageLocatorFile must contain as the beginning of the file the name of the file containing the desired image (interpreted as a basename) and ending in a newline. Only the first line is read, with the rest of the file reserved for future use.

func (*Downloader) RecordCachedAgent

func (d *Downloader) RecordCachedAgent() error

RecordCachedAgent writes the StatusCached state to disk to record a newly cached or loaded agent image; this prevents StatusReloadNeeded from being interpreted after the reload.

type MockfileSizeInfo

type MockfileSizeInfo struct {
	// contains filtered or unexported fields
}

MockfileSizeInfo is a mock of fileSizeInfo interface

func NewMockfileSizeInfo

func NewMockfileSizeInfo(ctrl *gomock.Controller) *MockfileSizeInfo

NewMockfileSizeInfo creates a new mock instance

func (*MockfileSizeInfo) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockfileSizeInfo) Size

func (m *MockfileSizeInfo) Size() int64

Size mocks base method

type MockfileSizeInfoMockRecorder

type MockfileSizeInfoMockRecorder struct {
	// contains filtered or unexported fields
}

MockfileSizeInfoMockRecorder is the mock recorder for MockfileSizeInfo

func (*MockfileSizeInfoMockRecorder) Size

Size indicates an expected call of Size

type MockfileSystem

type MockfileSystem struct {
	// contains filtered or unexported fields
}

MockfileSystem is a mock of fileSystem interface

func NewMockfileSystem

func NewMockfileSystem(ctrl *gomock.Controller) *MockfileSystem

NewMockfileSystem creates a new mock instance

func (*MockfileSystem) Base

func (m *MockfileSystem) Base(path string) string

Base mocks base method

func (*MockfileSystem) Copy

func (m *MockfileSystem) Copy(dst io.Writer, src io.Reader) (int64, error)

Copy mocks base method

func (*MockfileSystem) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockfileSystem) MkdirAll

func (m *MockfileSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll mocks base method

func (*MockfileSystem) Open

func (m *MockfileSystem) Open(name string) (io.ReadCloser, error)

Open mocks base method

func (*MockfileSystem) ReadAll

func (m *MockfileSystem) ReadAll(r io.Reader) ([]byte, error)

ReadAll mocks base method

func (*MockfileSystem) Remove

func (m *MockfileSystem) Remove(path string)

Remove mocks base method

func (*MockfileSystem) Rename

func (m *MockfileSystem) Rename(oldpath, newpath string) error

Rename mocks base method

func (*MockfileSystem) Stat

func (m *MockfileSystem) Stat(name string) (fileSizeInfo, error)

Stat mocks base method

func (*MockfileSystem) TeeReader

func (m *MockfileSystem) TeeReader(r io.Reader, w io.Writer) io.Reader

TeeReader mocks base method

func (*MockfileSystem) TempFile

func (m *MockfileSystem) TempFile(dir, prefix string) (*os.File, error)

TempFile mocks base method

func (*MockfileSystem) WriteFile

func (m *MockfileSystem) WriteFile(filename string, data []byte, perm os.FileMode) error

WriteFile mocks base method

type MockfileSystemMockRecorder

type MockfileSystemMockRecorder struct {
	// contains filtered or unexported fields
}

MockfileSystemMockRecorder is the mock recorder for MockfileSystem

func (*MockfileSystemMockRecorder) Base

func (mr *MockfileSystemMockRecorder) Base(path interface{}) *gomock.Call

Base indicates an expected call of Base

func (*MockfileSystemMockRecorder) Copy

func (mr *MockfileSystemMockRecorder) Copy(dst, src interface{}) *gomock.Call

Copy indicates an expected call of Copy

func (*MockfileSystemMockRecorder) MkdirAll

func (mr *MockfileSystemMockRecorder) MkdirAll(path, perm interface{}) *gomock.Call

MkdirAll indicates an expected call of MkdirAll

func (*MockfileSystemMockRecorder) Open

func (mr *MockfileSystemMockRecorder) Open(name interface{}) *gomock.Call

Open indicates an expected call of Open

func (*MockfileSystemMockRecorder) ReadAll

func (mr *MockfileSystemMockRecorder) ReadAll(r interface{}) *gomock.Call

ReadAll indicates an expected call of ReadAll

func (*MockfileSystemMockRecorder) Remove

func (mr *MockfileSystemMockRecorder) Remove(path interface{}) *gomock.Call

Remove indicates an expected call of Remove

func (*MockfileSystemMockRecorder) Rename

func (mr *MockfileSystemMockRecorder) Rename(oldpath, newpath interface{}) *gomock.Call

Rename indicates an expected call of Rename

func (*MockfileSystemMockRecorder) Stat

func (mr *MockfileSystemMockRecorder) Stat(name interface{}) *gomock.Call

Stat indicates an expected call of Stat

func (*MockfileSystemMockRecorder) TeeReader

func (mr *MockfileSystemMockRecorder) TeeReader(r, w interface{}) *gomock.Call

TeeReader indicates an expected call of TeeReader

func (*MockfileSystemMockRecorder) TempFile

func (mr *MockfileSystemMockRecorder) TempFile(dir, prefix interface{}) *gomock.Call

TempFile indicates an expected call of TempFile

func (*MockfileSystemMockRecorder) WriteFile

func (mr *MockfileSystemMockRecorder) WriteFile(filename, data, perm interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile

type MockinstanceMetadata

type MockinstanceMetadata struct {
	// contains filtered or unexported fields
}

MockinstanceMetadata is a mock of instanceMetadata interface

func NewMockinstanceMetadata

func NewMockinstanceMetadata(ctrl *gomock.Controller) *MockinstanceMetadata

NewMockinstanceMetadata creates a new mock instance

func (*MockinstanceMetadata) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockinstanceMetadata) Region

func (m *MockinstanceMetadata) Region() (string, error)

Region mocks base method

type MockinstanceMetadataMockRecorder

type MockinstanceMetadataMockRecorder struct {
	// contains filtered or unexported fields
}

MockinstanceMetadataMockRecorder is the mock recorder for MockinstanceMetadata

func (*MockinstanceMetadataMockRecorder) Region

Region indicates an expected call of Region

type Mocks3API

type Mocks3API struct {
	// contains filtered or unexported fields
}

Mocks3API is a mock of s3API interface

func NewMocks3API

func NewMocks3API(ctrl *gomock.Controller) *Mocks3API

NewMocks3API creates a new mock instance

func (*Mocks3API) Download

func (m *Mocks3API) Download(w io.WriterAt, input *s3.GetObjectInput, options ...func(*s3manager.Downloader)) (int64, error)

Download mocks base method

func (*Mocks3API) EXPECT

func (m *Mocks3API) EXPECT() *Mocks3APIMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

type Mocks3APIMockRecorder

type Mocks3APIMockRecorder struct {
	// contains filtered or unexported fields
}

Mocks3APIMockRecorder is the mock recorder for Mocks3API

func (*Mocks3APIMockRecorder) Download

func (mr *Mocks3APIMockRecorder) Download(w, input interface{}, options ...interface{}) *gomock.Call

Download indicates an expected call of Download

type Mocks3DownloaderAPI

type Mocks3DownloaderAPI struct {
	// contains filtered or unexported fields
}

Mocks3DownloaderAPI is a mock of s3DownloaderAPI interface

func NewMocks3DownloaderAPI

func NewMocks3DownloaderAPI(ctrl *gomock.Controller) *Mocks3DownloaderAPI

NewMocks3DownloaderAPI creates a new mock instance

func (*Mocks3DownloaderAPI) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

type Mocks3DownloaderAPIMockRecorder

type Mocks3DownloaderAPIMockRecorder struct {
	// contains filtered or unexported fields
}

Mocks3DownloaderAPIMockRecorder is the mock recorder for Mocks3DownloaderAPI

Jump to

Keyboard shortcuts

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