internal

package
v0.0.0-...-05feb3a Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNonExistent = errors.New("No such entry found in the database")
)

Functions

This section is empty.

Types

type Dir

type Dir struct {
	/// The name of this directory. Must not include any `/`.
	DirName string `json:"dirname"`

	/// Total size of this directory including all of its subdirectories in bytes
	TotalSize int64 `json:"total_size"`

	/// Map of all files in this immediate directory (i.e. not in subdirectories).
	///
	/// Each file is a single entry in the map and the corresponding value is its size in bytes
	Files map[string]int64 `json:"files"`

	/// Map of all immediate subdirectories of this directory.
	Directiories map[string]Dir `json:"directories"`
}

/ A structure to store the file sizes of a directory including all subdirectories.

func MakeDir

func MakeDir(dirname string) Dir

/ Creates an empty directory with the given directory name `dirname`.

func (*Dir) InsertIntoDir

func (d *Dir) InsertIntoDir(filePath string, size int64)

/ Insert the file with the given path `filePath` into the directory structure starting at `d`. / / Any non-existing directories leading up to `filePath` are created and the file is inserted into the correct spot. / The total size of all directories is adjusted accordingly.

type ImageEntry

type ImageEntry struct {
	// database primary key
	ID int64

	/// The name of this image
	Name string
}

type ImageHistory

type ImageHistory struct {
	ImageEntry

	/// map of the container hashes and the corresponding entry
	History map[string]ImageHistoryEntry
}

/ The full image history.

type ImageHistoryEntry

type ImageHistoryEntry struct {
	Tags        []string
	Contents    LayerSizes
	InspectInfo types.ImageInspectInfo
	// contains filtered or unexported fields
}

/ A single entry in the history of an image

type Layer

type Layer struct {
	Dir

	/// The command that was used to create this layer
	CreatedBy string
}

func NewLayer

func NewLayer() Layer

type LayerSizes

type LayerSizes map[string]Layer

/ The size tree of all layers of a container image / The key is the hash of each layer, the value is the calculated directory sizes

type SQLiteBackend

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

func CreateSQLiteBackend

func CreateSQLiteBackend(dbFileName string) (*SQLiteBackend, error)

func (*SQLiteBackend) Create

func (s *SQLiteBackend) Create(imageHistory *ImageHistory) (*ImageHistory, error)

func (*SQLiteBackend) Delete

func (s *SQLiteBackend) Delete(imageHistory *ImageHistory) error

func (*SQLiteBackend) DeleteByName

func (s *SQLiteBackend) DeleteByName(imageName string) error

func (*SQLiteBackend) Destroy

func (s *SQLiteBackend) Destroy() error

func (*SQLiteBackend) Migrate

func (b *SQLiteBackend) Migrate() error

func (*SQLiteBackend) Read

func (s *SQLiteBackend) Read(imageName string) ([]ImageHistory, error)

func (*SQLiteBackend) ReadAll

func (s *SQLiteBackend) ReadAll() ([]ImageEntry, error)

func (*SQLiteBackend) ReadById

func (s *SQLiteBackend) ReadById(imageId int64) (*ImageHistory, error)

func (*SQLiteBackend) Update

func (s *SQLiteBackend) Update(imageHistory *ImageHistory) (*ImageHistory, error)

type StorageBackend

type StorageBackend interface {
	Migrate() error
	Read(imageName string) ([]ImageHistory, error)
	Create(imageHistory ImageHistory) (*ImageHistory, error)
	Update(imageHistory *ImageHistory) (*ImageHistory, error)
	Delete(imageHistory *ImageHistory) error
}

Jump to

Keyboard shortcuts

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