treestore

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2016 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileInfoFromHeader

func FileInfoFromHeader(hdr *tar.Header) *fileInfo

func NewHashWriter

func NewHashWriter(w io.Writer) specaci.ArchiveWriter

Types

type Store

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

Store represents a store of rendered ACIs

func NewStore

func NewStore(dir string, store *imagestore.Store) (*Store, error)

func (*Store) Check

func (ts *Store) Check(id string) (string, error)

Check verifies the treestore consistency for the specified id.

func (*Store) GetID

func (ts *Store) GetID(key string) (string, error)

GetID calculates the treestore ID for the given image key. The treeStoreID is computed as an hash of the flattened dependency tree image keys. In this way the ID may change for the same key if the image's dependencies change.

func (*Store) GetIDs

func (ts *Store) GetIDs() ([]string, error)

GetIDs returns a slice containing all the treeStore's IDs available (both fully or partially rendered).

func (*Store) GetImageHash

func (ts *Store) GetImageHash(id string) (string, error)

GetImageHash returns the hash of the image that uses the tree store identified by id.

func (*Store) GetPath

func (ts *Store) GetPath(id string) string

GetPath returns the absolute path of the treestore for the provided id. It doesn't ensure that the path exists and is fully rendered. This should be done calling IsRendered()

func (*Store) GetRootFS

func (ts *Store) GetRootFS(id string) string

GetRootFS returns the absolute path of the rootfs for the provided id. It doesn't ensure that the rootfs exists and is fully rendered. This should be done calling IsRendered()

func (*Store) Hash

func (ts *Store) Hash(id string) (string, error)

Hash calculates an hash of the rendered ACI. It uses the same functions used to create a tar but instead of writing the full archive is just computes the sha512 sum of the file infos and contents.

func (*Store) IsRendered

func (ts *Store) IsRendered(id string) (bool, error)

IsRendered checks if the tree store with the provided id is fully rendered

func (*Store) Remove

func (ts *Store) Remove(id string) error

Remove removes the rendered image in tree store with the given id.

func (*Store) Render

func (ts *Store) Render(key string, rebuild bool) (id string, hash string, err error)

Render renders a treestore for the given image key if it's not already fully rendered. Users of treestore should call s.Render before using it to ensure that the treestore is completely rendered. Returns the id and hash of the rendered treestore if it is newly rendered, and only the id if it is already rendered.

func (*Store) Size

func (ts *Store) Size(id string) (int64, error)

Size returns the size of the rootfs for the provided id. It is a relatively expensive operation, it goes through all the files and adds up their size.

Jump to

Keyboard shortcuts

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