state

package
v2.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package state provides a store to retrieve and save container lifecycle related information This is typically used by oci-hooks for information that cannot be retrieved / updated otherwise Specifically, the state carries container start time, and transient information about possible failures during hook events processing. All store methods are safe to use concurrently and only write atomically. Since the state is transient and carrying solely informative data, errors returned from here could be treated as soft-failures. Note that locking is done at the container state directory level. state is currently used by ocihooks and for read by dockercompat (to display started-at time)

Index

Constants

This section is empty.

Variables

View Source
var ErrLifecycleStore = errors.New("lifecycle-store error")

ErrLifecycleStore will wrap all errors here

Functions

This section is empty.

Types

type Store

type Store struct {

	// StartedAt reflects the time at which we received the oci-hook onCreateRuntime event
	StartedAt   time.Time `json:"started_at"`
	CreateError bool      `json:"create_error"`
	// contains filtered or unexported fields
}

Store exposes methods to retrieve and transform state information about containers.

func New

func New(stateDir string) (*Store, error)

New will return a lifecycle struct for the container which stateDir is passed as argument

func (*Store) Delete

func (lf *Store) Delete() (err error)

Delete will destroy the lifecycle data

func (*Store) Load

func (lf *Store) Load() (err error)

Load will populate the struct with existing in-store lifecycle information

func (*Store) Transform

func (lf *Store) Transform(fun func(lf *Store) error) (err error)

Transform should be used to perform random mutations

Jump to

Keyboard shortcuts

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