Documentation
¶
Index ¶
- Variables
- func BuildBlueprintFromPath(fs vfs.FileSystem, bpPath string) (*blueprints.Blueprint, error)
- func SetStore(store *Store)
- type Store
- func (s *Store) Close() error
- func (s *Store) CurrentSize() int64
- func (s *Store) Get(_ context.Context, blueprintID string) (*blueprints.Blueprint, error)
- func (s *Store) Put(ctx context.Context, blueprintID string, content *model.TypedResourceContent) (bool, error)
- func (s *Store) RunGarbageCollection()
- func (s *Store) StartResetInterval()
Constants ¶
This section is empty.
Variables ¶
var NotFoundError = errors.New("NOTFOUND")
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.
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) CurrentSize ¶
CurrentSize returns the current used storage.
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.