Documentation
¶
Overview ¶
Package scalefunc implements the Schema type, as well as any helper functions for interacting with Schema types
Index ¶
- Variables
- func ValidString(str string) bool
- func Write(path string, scaleFunc *V1BetaSchema) error
- func WriteV1Alpha(path string, scaleFunc *V1AlphaSchema) errordeprecated
- func WriteV1Beta(path string, scaleFunc *V1BetaSchema) error
- type Language
- type V1AlphaDependency
- type V1AlphaSchema
- type V1BetaExtension
- type V1BetaSchema
- type V1BetaSignature
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( ErrVersion = errors.New("unknown or invalid version") ErrLanguage = errors.New("unknown or invalid language") ErrHash = errors.New("error while verifying hash") )
var ( // AcceptedLanguages is an array of acceptable Languages AcceptedLanguages = []Language{Go, Rust, TypeScript} )
var (
InvalidStringRegex = regexp.MustCompile(`[^A-Za-z0-9-.]`)
)
var LanguageAliases = map[string]Language{ "go": Go, "golang": Go, "rust": Rust, "typescript": TypeScript, "ts": TypeScript, "javascript": TypeScript, }
Functions ¶
func ValidString ¶
ValidString returns true if the string is valid for use with Scale Functions
func Write ¶
func Write(path string, scaleFunc *V1BetaSchema) error
func WriteV1Alpha
deprecated
added in
v0.4.6
func WriteV1Alpha(path string, scaleFunc *V1AlphaSchema) error
WriteV1Alpha opens a file at the given path and writes the given WriteV1Alpha to it
Deprecated: Use V1BetaSchema instead
func WriteV1Beta ¶ added in v0.4.6
func WriteV1Beta(path string, scaleFunc *V1BetaSchema) error
WriteV1Beta opens a file at the given path and writes the given V1BetaSchema to it
Types ¶
type Language ¶
type Language string
Language is the Language the Scale Function's Source Language
func ResolveLanguage ¶ added in v0.4.7
type V1AlphaDependency ¶ added in v0.4.6
type V1AlphaDependency struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Metadata map[string]string `json:"metadata" yaml:"metadata"`
}
V1AlphaDependency is a dependency of a compiled Scale Function
type V1AlphaSchema ¶ added in v0.4.6
type V1AlphaSchema struct {
Name string `json:"name" yaml:"name"`
Tag string `json:"tag" yaml:"tag"`
SignatureName string `json:"signature_name" yaml:"signature_name"`
SignatureSchema *signatureSchema.Schema `json:"signature_schema" yaml:"signature_schema"`
SignatureHash string `json:"signature_hash" yaml:"signature_hash"`
Language Language `json:"language" yaml:"language"`
Stateless bool `json:"stateless" yaml:"stateless"`
Dependencies []V1AlphaDependency `json:"dependencies" yaml:"dependencies"`
Function []byte `json:"function" yaml:"function"`
Size uint32 `json:"size" yaml:"size"`
Hash string `json:"hash" yaml:"hash"`
}
V1AlphaSchema is the type used to define the requirements of a scale function for a Scale Runtime
func ReadV1Alpha
deprecated
added in
v0.4.6
func ReadV1Alpha(path string) (*V1AlphaSchema, error)
ReadV1Alpha opens a file at the given path and returns a *WriteV1Alpha
Deprecated: Use V1BetaSchema instead
func (*V1AlphaSchema) Decode ¶ added in v0.4.6
func (s *V1AlphaSchema) Decode(data []byte) error
Decode decodes the Schema from a byte array
func (*V1AlphaSchema) Encode
deprecated
added in
v0.4.6
func (s *V1AlphaSchema) Encode() []byte
Encode encodes the Schema into a byte array
Deprecated: Use V1BetaSchema instead
func (*V1AlphaSchema) GetHash ¶ added in v0.4.6
func (s *V1AlphaSchema) GetHash() []byte
GetHash returns the hash of the Schema
type V1BetaExtension ¶ added in v0.4.6
type V1BetaExtension struct {
Name string `json:"name" yaml:"name"`
Organization string `json:"organization" yaml:"organization"`
Tag string `json:"tag" yaml:"tag"`
Schema *extensionSchema.Schema `json:"schema" yaml:"schema"`
Hash string `json:"hash" yaml:"hash"`
}
V1BetaExtension defines the extensions used by a Scale Function
type V1BetaSchema ¶ added in v0.4.6
type V1BetaSchema struct {
Name string `json:"name" yaml:"name"`
Tag string `json:"tag" yaml:"tag"`
Signature V1BetaSignature `json:"signature" yaml:"signature"`
Extensions []V1BetaExtension `json:"extensions" yaml:"extensions"`
Language Language `json:"language" yaml:"language"`
Manifest []byte `json:"manifest" yaml:"manifest"`
Stateless bool `json:"stateless" yaml:"stateless"`
Function []byte `json:"function" yaml:"function"`
Size uint32 `json:"size" yaml:"size"`
Hash string `json:"hash" yaml:"hash"`
}
V1BetaSchema is the type used to define the requirements of a scale function for a Scale Runtime
func Read ¶
func Read(path string) (*V1BetaSchema, error)
func ReadV1Beta ¶ added in v0.4.6
func ReadV1Beta(path string) (*V1BetaSchema, error)
ReadV1Beta opens a file at the given path and returns a *V1BetaSchema
func (*V1BetaSchema) Decode ¶ added in v0.4.6
func (s *V1BetaSchema) Decode(data []byte) error
Decode decodes the Schema from a byte array
func (*V1BetaSchema) Encode ¶ added in v0.4.6
func (s *V1BetaSchema) Encode() []byte
Encode encodes the Schema into a byte array
func (*V1BetaSchema) GetHash ¶ added in v0.4.6
func (s *V1BetaSchema) GetHash() []byte
GetHash returns the hash of the Schema
type V1BetaSignature ¶ added in v0.4.6
type V1BetaSignature struct {
Name string `json:"name" yaml:"name"`
Organization string `json:"organization" yaml:"organization"`
Tag string `json:"tag" yaml:"tag"`
Schema *signatureSchema.Schema `json:"schema" yaml:"schema"`
Hash string `json:"hash" yaml:"hash"`
}
V1BetaSignature defines the signature used by a Scale Function