Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidArtifact reports a loader or artifact state error not covered by // a more specific sentinel. ErrInvalidArtifact = errors.New("bytecode artifact: invalid artifact") // ErrInvalidHeader reports that the artifact header is malformed or // inconsistent with the payload framing. ErrInvalidHeader = errors.New("bytecode artifact: invalid header") // ErrInvalidPayload reports that the selected payload format could not decode // the serialized program. ErrInvalidPayload = errors.New("bytecode artifact: invalid payload") // ErrInvalidMagic reports that the artifact header does not start with the // Ferret artifact magic bytes. ErrInvalidMagic = errors.New("bytecode artifact: invalid magic") // ErrUnsupportedSchema reports that the artifact schema version is not // understood by the current loader. ErrUnsupportedSchema = errors.New("bytecode artifact: unsupported schema version") // ErrUnknownFormat reports that an artifact references an unknown or // unregistered payload format. ErrUnknownFormat = errors.New("bytecode artifact: unknown format") // ErrIncompatibleISA reports that an artifact or payload requires a different // bytecode ISA version than the current runtime. ErrIncompatibleISA = errors.New("bytecode artifact: incompatible ISA") )
Functions ¶
func HasMagic ¶
HasMagic reports whether data begins with the Ferret artifact magic bytes. It is intended for sniffing likely Ferret artifacts only. A true result does not guarantee that data is complete, valid, loadable, or compatible; callers that need actual artifact validation must still use Load or Unmarshal.
Types ¶
type FormatID ¶
type FormatID uint8
FormatID identifies a serialized program payload format in an artifact header.
const ( FormatJSON FormatID = 1 FormatMsgPack FormatID = 2 DefaultFormat = FormatMsgPack )
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
func NewDefaultLoader ¶
func NewDefaultLoader() *Loader
NewDefaultLoader creates a loader with the built-in artifact payload formats.
func NewLoader ¶
func NewLoader(formats ...RegisteredFormat) *Loader
NewLoader creates an artifact loader with an explicit set of registered payload formats. Nil or duplicate registrations panic.
type RegisteredFormat ¶
type RegisteredFormat struct {
Format programformat.Format
ID FormatID
}
RegisteredFormat associates an artifact format id with a payload format implementation.