contractspec

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ABIVersionMajor uint16 = 2
	ABIVersionMinor uint16 = 0
	SchemaHashLen          = 32
)

Variables

View Source
var (
	ErrIncompatibleABIMajor = errors.New("incompatible ABI major version")
	ErrIncompatibleABIMinor = errors.New("incompatible ABI minor version")
	ErrSchemaHashMismatch   = errors.New("schema hash mismatch")
	ErrCapabilityMismatch   = errors.New("required capability not provided")

	ErrContractNameEmpty    = errors.New("contract name cannot be empty")
	ErrContractHashEmpty    = errors.New("contract schema hash cannot be zero")
	ErrMethodIDDuplicate    = errors.New("method id is duplicated")
	ErrMethodNameDuplicate  = errors.New("method name is duplicated")
	ErrMethodNameEmpty      = errors.New("method name cannot be empty")
	ErrMethodRequestMissing = errors.New("method request type cannot be empty")
	ErrMethodReplyMissing   = errors.New("method response type cannot be empty")
)

Functions

func ParseSchemaHashHex

func ParseSchemaHashHex(s string) ([SchemaHashLen]byte, error)

func ValidateHandshake

func ValidateHandshake(host, plugin Handshake) error

Types

type Handshake

type Handshake struct {
	ABIMajor     uint16
	ABIMinor     uint16
	SchemaHash   [SchemaHashLen]byte
	Capabilities uint64
}

func NewHandshake

func NewHandshake(schemaHash [SchemaHashLen]byte) Handshake

func (Handshake) SchemaHashHex

func (h Handshake) SchemaHashHex() string

type Method

type Method struct {
	ID           MethodID
	Name         string
	RequestType  string
	ResponseType string
	Optional     bool
}

type MethodID

type MethodID uint32

type Schema

type Schema struct {
	Name         string
	SchemaHash   [SchemaHashLen]byte
	Capabilities uint64
	Methods      []Method
}

func (Schema) HasMethodID

func (s Schema) HasMethodID(id MethodID) bool

func (Schema) Validate

func (s Schema) Validate() error

Jump to

Keyboard shortcuts

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