storage

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2023 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Package storage is used to store and retrieve built Scale Functions

Package storage is used to store and retrieve built Scale Functions

Package storage is used to store and retrieve built Scale Functions

Package storage is used to store and retrieve built Scale Functions and Scale Signatures

Index

Constants

View Source
const (
	BuildDirectory = "builds"
)
View Source
const (
	DefaultDirectory = ".config/scale"
)
View Source
const (
	FunctionDirectory = "functions"
)
View Source
const (
	SignatureDirectory = "signatures"
)

Variables

View Source
var (
	ErrInvalidName         = errors.New("invalid name")
	ErrInvalidTag          = errors.New("invalid tag")
	ErrInvalidOrganization = errors.New("invalid organization")
)

Functions

func GenerateSignature

func GenerateSignature(sig *signature.Schema, name string, tag string, org string, directory string) error

GenerateSignature generates the signature files and writes them to the given path.

Types

type Build

type Build struct {
	Path string
}

type BuildStorage

type BuildStorage struct {
	Directory string
}
var (
	DefaultBuild *BuildStorage
)

func NewBuild

func NewBuild(baseDirectory string) (*BuildStorage, error)

func (*BuildStorage) Delete

func (s *BuildStorage) Delete(b *Build) error

func (*BuildStorage) Mkdir

func (s *BuildStorage) Mkdir() (*Build, error)

Mkdir creates and returns a new build directory

type Function

type Function struct {
	Schema       *scalefunc.Schema
	Hash         string
	Organization string
}

type FunctionStorage

type FunctionStorage struct {
	Directory string
}

FunctionStorage is used to store and retrieve built Scale Functions

var (
	DefaultFunction *FunctionStorage
)

func NewFunction

func NewFunction(baseDirectory string) (*FunctionStorage, error)

func (*FunctionStorage) Delete

func (s *FunctionStorage) Delete(name string, tag string, org string, hash string) error

Delete removes the Scale Function with the given name, tag, org, and hash

func (*FunctionStorage) Get

func (s *FunctionStorage) Get(name string, tag string, org string, hash string) (*Function, error)

Get returns the Scale Function with the given name, tag, and organization. The hash parameter is optional and can be used to check for a specific hash.

func (*FunctionStorage) List

func (s *FunctionStorage) List() ([]Function, error)

List returns all the Scale Functions stored in the storage

func (*FunctionStorage) Put

func (s *FunctionStorage) Put(name string, tag string, org string, sf *scalefunc.Schema) error

Put stores the Scale Function with the given name, tag, organization, and hash

type Signature

type Signature struct {
	Name         string
	Tag          string
	Schema       *signature.Schema
	Hash         string
	Organization string
}

type SignatureStorage

type SignatureStorage struct {
	Directory string
}
var (
	DefaultSignature *SignatureStorage
)

func NewSignature

func NewSignature(baseDirectory string) (*SignatureStorage, error)

func (*SignatureStorage) Delete

func (s *SignatureStorage) Delete(name string, tag string, org string, hash string) error

Delete removes the Scale Signature with the given name, tag, org, and hash

func (*SignatureStorage) Get

func (s *SignatureStorage) Get(name string, tag string, org string, hash string) (*Signature, error)

Get returns the Scale Signature with the given name, tag, and organization. The hash parameter is optional and can be used to check for a specific hash.

func (*SignatureStorage) List

func (s *SignatureStorage) List() ([]Signature, error)

List returns all the Scale Signatures stored in the storage

func (*SignatureStorage) Path

func (s *SignatureStorage) Path(name string, tag string, org string, hash string) (string, error)

func (*SignatureStorage) Put

func (s *SignatureStorage) Put(name string, tag string, org string, sig *signature.Schema) error

Put stores the Scale Signature with the given name, tag, organization

Jump to

Keyboard shortcuts

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