Help us shape the future of Go! Take the 2026 Go Developer Survey

connect

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package connect defines non-owning, versioned Orb instance attachments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Code

func Code(err error) string

func Fail

func Fail(code string) error

func JSON

func JSON(v any) json.RawMessage

func ValidateCall

func ValidateCall(c Call) error

Types

type Call

type Call struct {
	InstanceID  string          `json:"instance_id"`
	Service     string          `json:"service"`
	Method      string          `json:"method"`
	SessionID   string          `json:"session_id,omitempty"`
	Expected    Expected        `json:"expected"`
	OperationID string          `json:"operation_id,omitempty"`
	Args        json.RawMessage `json:"args"`
}

type Endpoint

type Endpoint interface {
	Invoke(context.Context, string, json.RawMessage) (json.RawMessage, error)
	Close() error
}

Endpoint is implemented by in-process attachments and native IPC clients. Close releases remote availability; it never disposes the attached runtime.

type Error

type Error struct {
	Kind string `json:"kind"`
}

func (*Error) Error

func (e *Error) Error() string

type Event

type Event struct {
	Cursor string          `json:"cursor"`
	Data   json.RawMessage `json:"data"`
}

type Expected

type Expected struct {
	Generation string `json:"registration_generation"`
	Revision   string `json:"session_revision"`
}

type Ledger

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

func OpenLedger

func OpenLedger(store Store, quota int) (*Ledger, error)

func (*Ledger) Accept

func (l *Ledger) Accept(r Request) (Receipt, bool, error)

func (*Ledger) Get

func (l *Ledger) Get(p Principal, instance, op string) (Receipt, error)

func (*Ledger) Set

func (l *Ledger) Set(r Request, status string, result json.RawMessage, code string) (Receipt, error)

type Local

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

Local is a non-owning in-process registration channel. Closing it fences delivery without closing the runtime adapter or its operation ledger.

func NewLocal

func NewLocal(handler func(context.Context, string, json.RawMessage) (json.RawMessage, error)) *Local

func (*Local) Close

func (l *Local) Close() error

func (*Local) Invoke

func (l *Local) Invoke(ctx context.Context, method string, p json.RawMessage) (json.RawMessage, error)

type Model added in v0.9.0

type Model struct {
	ID       string   `json:"id"`
	Provider string   `json:"provider"`
	Name     string   `json:"name"`
	Thinking []string `json:"thinking,omitempty"`
}

type Principal

type Principal struct {
	PeerID  string  `json:"peer_id"`
	Subject Subject `json:"subject"`
}

type Receipt

type Receipt struct {
	InstanceID  string          `json:"instance_id"`
	SessionID   string          `json:"session_id,omitempty"`
	Method      string          `json:"method"`
	Expected    Expected        `json:"expected"`
	AcceptedAt  int64           `json:"accepted_at"`
	OperationID string          `json:"operation_id"`
	Status      string          `json:"status"`
	Result      json.RawMessage `json:"result,omitempty"`
	Error       string          `json:"error,omitempty"`
	Digest      string          `json:"digest"`
}

type Request

type Request struct {
	PageLimit  int       `json:"page_limit,omitempty"`
	Principal  Principal `json:"principal"`
	Generation string    `json:"generation"`
	Call       Call      `json:"call"`
}

type Snapshot

type Snapshot struct {
	Cursor string  `json:"cursor"`
	Events []Event `json:"events"`
}

type Store

type Store interface {
	Load() ([]byte, error)
	Save([]byte) error
}

type Stream

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

func NewStream

func NewStream(limit, quota int) *Stream

func (*Stream) Publish

func (s *Stream) Publish(data json.RawMessage)

func (*Stream) Replay

func (s *Stream) Replay(cursor string) ([]Event, error)

func (*Stream) Snapshot

func (s *Stream) Snapshot() Snapshot

type Subject

type Subject struct {
	Kind       string `json:"kind"`
	InstanceID string `json:"instance_id,omitempty"`
}

Directories

Path Synopsis
Package agent adapts an existing Orb runtime without owning its lifetime.
Package agent adapts an existing Orb runtime without owning its lifetime.
Package protocol implements the bounded, strict JSON stream used by Orb Bridge.
Package protocol implements the bounded, strict JSON stream used by Orb Bridge.

Jump to

Keyboard shortcuts

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