Documentation
¶
Overview ¶
Package signature implements the Signature type, that must be exported by Signatures
Index ¶
- Variables
- func CreateGoSignature(scaleFilePath string, directory string, signaturePath string) error
- func CreateRustSignature(scaleFilePath string, directory string, signaturePath string) error
- func Encode(writer io.Writer, definition *Definition) error
- func ParseSignature(signature string) (string, string, string)
- func Write(path string, definition *Definition) error
- type Context
- type Definition
- type GuestContext
- type NewSignature
- type PublishedVersion
- type PublishedVersions
- type RuntimeContext
- type Signature
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // AcceptedVersions is an array of acceptable Versions AcceptedVersions = []Version{V1Alpha} )
var (
VersionErr = errors.New("unknown or invalid version")
)
Functions ¶
func CreateGoSignature ¶
func CreateRustSignature ¶ added in v0.1.3
func Encode ¶
func Encode(writer io.Writer, definition *Definition) error
Encode writes the given definition to the given io.Writer
func ParseSignature ¶
ParseSignature parses and returns the Organization, Name, and Version of a signature string. If there is no organization, the organization will be an empty string. If there is no tag, the tag will be an empty string.
func Write ¶
func Write(path string, definition *Definition) error
Write opens a file at the given path and writes the given definition to it
Types ¶
type Context ¶
type Context interface {
GuestContext() GuestContext // GuestContext of the Context
}
Context is the interface that must be implemented by all Contexts that will be used by the Guest. The runtime does not use any of these methods.
type Definition ¶
type Definition struct {
DefinitionVersion Version `json:"definition" yaml:"definition"`
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
PublishedVersions PublishedVersions `json:"published" yaml:"published"`
}
Definition is the definition of a signature as well as the published versions
func Decode ¶
func Decode(reader io.Reader) (*Definition, error)
Decode reads the data stored in the given io.Reader and returns a *Definition
func Read ¶
func Read(path string) (*Definition, error)
Read opens a file at the given path and returns a *Definition
type GuestContext ¶
type GuestContext interface {
FromReadBuffer() error // FromReadBuffer deserializes the Context from the global buffer
ToWriteBuffer() (uint32, uint32) // ToWriteBuffer serializes the Context to a global buffer and returns the offset and length
ErrorWriteBuffer(err error) (uint32, uint32) // ErrorWriteBuffer serializes an error into a global buffer and returns the offset and length
}
GuestContext is the interface that must be implemented by the Context of a Signature in order for it to be used by the guest.
type NewSignature ¶ added in v0.1.5
type NewSignature[T Signature] func() T
NewSignature is a factory function for creating a new Signature
type PublishedVersion ¶
type PublishedVersion struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
}
PublishedVersion is the published version of the signature specific to a language
type PublishedVersions ¶
type PublishedVersions struct {
Go PublishedVersion `json:"go" yaml:"go"`
}
PublishedVersions is a list of published versions of the signature specific to a language
type RuntimeContext ¶
type RuntimeContext interface {
Read(b []byte) error // Read updates the Context by decoding the given bytes
Write() []byte // Write encodes the Context and returns the encoded bytes
Error(err error) []byte // Error encodes the given error and returns the encoded bytes
}
RuntimeContext is the interface that must be implemented by the Context of a Signature in order for it to be used by the runtime.
type Signature ¶
type Signature interface {
RuntimeContext() RuntimeContext // RuntimeContext of the Signature
}
Signature is an interface that must be implemented by all Signatures that will be used by the runtime. The guest does not use any of these methods.