storage

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 13 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

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 (
	ExtensionDirectory = "extensions"
)
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 GenerateExtension added in v0.4.6

func GenerateExtension(ext *extension.Schema, name string, tag string, org string, directory string) error

GenerateExtension generates the extension files and writes them to the given path.

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 Extension added in v0.4.6

type Extension struct {
	Name         string
	Tag          string
	Schema       *extension.Schema
	Hash         string
	Organization string
}

type ExtensionStorage added in v0.4.6

type ExtensionStorage struct {
	Directory string
}
var (
	DefaultExtension *ExtensionStorage
)

func NewExtension added in v0.4.6

func NewExtension(baseDirectory string) (*ExtensionStorage, error)

func (*ExtensionStorage) Delete added in v0.4.6

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

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

func (*ExtensionStorage) Get added in v0.4.6

func (s *ExtensionStorage) Get(name string, tag string, org string, hash string) (*Extension, error)

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

func (*ExtensionStorage) List added in v0.4.6

func (s *ExtensionStorage) List() ([]Extension, error)

List returns all the Scale Extensions stored in the storage

func (*ExtensionStorage) Path added in v0.4.6

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

func (*ExtensionStorage) Put added in v0.4.6

func (s *ExtensionStorage) Put(name string, tag string, org string, sig *extension.Schema) error

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

type Function

type Function struct {
	Schema       *scalefunc.V1BetaSchema
	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.V1BetaSchema) 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