author

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package author supplies typed operations and immutable guest construction. Domain authorization remains explicit on both sides of every connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call[I, O any](ctx context.Context, caller Caller, method Method[I, O], input I) (O, error)

func Register

func Register[I, O any](r *Registry, method Method[I, O], handle func(context.Context, plugin.Request, I) (O, error)) error

Types

type Caller

type Caller interface {
	Call(context.Context, plugin.ContractRef, string, json.RawMessage) (json.RawMessage, error)
}

Caller is implemented by Session and by explicit, policy-enforcing host service sessions supplied to guests. Request metadata never creates a caller.

type Method

type Method[Input, Output any] struct {
	Contract       plugin.ContractRef
	Operation      plugin.Operation
	Input          *schema.Schema
	Output         *schema.Schema
	ValidateInput  func(Input) error
	ValidateOutput func(Output) error
}

Method is a shared typed contract. Schemas are optional, but recommended for cross-language contracts. ValidateInput/Output add domain validation.

type Options

type Options struct {
	Authorize       func(context.Context, plugin.Request) error
	MaxCallDuration time.Duration
	// A binding may replace schema evaluation in this immutable guest snapshot.
	SchemaEngine SchemaEngine
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry may be built concurrently. Guest snapshots it, so subsequent registration never expands a running guest's descriptor or dispatch table.

func New

func New(identity plugin.Identity) (*Registry, error)

func NewWithSchemaEngine

func NewWithSchemaEngine(identity plugin.Identity, schemas SchemaEngine) (*Registry, error)

func (*Registry) Descriptor

func (r *Registry) Descriptor() plugin.Descriptor

func (*Registry) Guest

func (r *Registry) Guest(opts Options) (*plugin.Guest, error)

func (*Registry) Snapshot

func (r *Registry) Snapshot(opts Options) (plugin.Descriptor, plugin.GuestOptions, error)

Snapshot detaches the descriptor and dispatcher for construction by a host engine binding. Later registrations cannot expand the returned endpoint.

type SchemaEngine

type SchemaEngine interface {
	ValidateSchema(schema.Schema) error
	CheckSchema(schema.Schema, json.RawMessage) error
}

SchemaEngine lets an embedding binding supply the shared schema mechanics. Implementations must match plugin/schema and be safe for concurrent calls.

Jump to

Keyboard shortcuts

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