blueprint

package
v0.104.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NotFoundError = errors.New("NOTFOUND")
View Source
var StoreClosedError = errors.New("STORE_CLOSED")

Functions

func BuildBlueprintFromPath

func BuildBlueprintFromPath(fs vfs.FileSystem, bpPath string) (*blueprints.Blueprint, error)

BuildBlueprintFromPath creates a read-only blueprint from an extracted blueprint.

func SetStore

func SetStore(store *Store)

SetStore returns the currently active store.

Types

type Store

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

Store describes a blueprint cache using a base filesystem. The blueprints are stored decompressed and untarred in the root of the filesystem using a hash value. root - <some hash>

  • blueprint.yaml
  • ... some other data

The hash is calculated using the component descriptor and the name of the blueprint.

func DefaultStore

func DefaultStore(fs vfs.FileSystem) (*Store, error)

DefaultStore creates a default blueprint store.

func GetBlueprintStore

func GetBlueprintStore() *Store

GetBlueprintStore returns the currently active store.

func NewStore

func NewStore(log logging.Logger, baseFs vfs.FileSystem, config config.BlueprintStore) (*Store, error)

NewStore creates a new blueprint cache using a base filesystem.

The caller should always close the cache for a graceful termination.

The store should be initialized once as this is a global singleton.

func (*Store) Close

func (s *Store) Close() error

func (*Store) CurrentSize

func (s *Store) CurrentSize() int64

CurrentSize returns the current used storage.

func (*Store) Get

func (s *Store) Get(_ context.Context, blueprintID string) (*blueprints.Blueprint, error)

Get reads the blueprint from the filesystem.

func (*Store) Put

func (s *Store) Put(ctx context.Context, blueprintID string, content *model.TypedResourceContent) (bool, error)

Put stores a blueprint on the given filesystem.

func (*Store) RunGarbageCollection

func (s *Store) RunGarbageCollection()

RunGarbageCollection runs the garbage collection of the filesystem. The gc only deletes items when the max size reached a certain threshold. If that threshold is reached the files are deleted with the following priority: - least hits - oldest - random

func (*Store) StartResetInterval

func (s *Store) StartResetInterval()

StartResetInterval starts the reset counter for the cache hits.

Jump to

Keyboard shortcuts

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