外观
Go SDK API 目录
查找 Go SDK 的公开类型、函数、方法、字段和常量声明。
Go SDK 用法 · Go Worker 入门 · 工具包下载
字段和嵌入类型按声明列出,嵌入类型提升的方法不重复展开。常量保留声明块以呈现 iota 上下文。平台条件见各文件;权限、错误及生命周期请结合用法指南。
bulk.go
包:neomega
签名中使用的导入:
go
import (
"bytes"
"context"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"regexp"
"strconv"
"strings"
"time"
)UploadBulk
go
func UploadBulk(ctx context.Context, descriptor map[string]any, data []byte) (map[string]any, error)text
UploadBulk transfers at most 16 MiB. Success retains the grant for Host
consumption; failure releases it without retrying the upload.DownloadBulk
go
func DownloadBulk(ctx context.Context, descriptor map[string]any) ([]byte, error)text
DownloadBulk returns bytes only after length and SHA-256 verification. The
authenticated loopback grant is released after either success or failure.EncodeBusValue
go
func EncodeBusValue(ctx context.Context, peer Caller, value any, deadline time.Time) (any, error)text
EncodeBusValue preserves tagged values, using bulk for values above 32 KiB.DecodeBusValue
go
func DecodeBusValue(ctx context.Context, value any) (any, error)busapi/busapi.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/busapi.go; DO NOT EDIT.
Package busapi defines the neutral author and caller contracts for the module
bus. It depends only on the standard library, not on a Frame implementation.签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"fmt"
"time"
)Identity.Installation
go
Installation string `json:"installation"`Identity.Generation
go
Generation int64 `json:"generation"`Identity
go
type Identity struct {
Installation string `json:"installation"`
Generation int64 `json:"generation"`
}text
Identity identifies one installation generation.Kind
go
type Kind stringtext
Kind classifies a bus member.Read
go
const (
Read Kind = "read"
Op Kind = "op"
Service Kind = "service"
Data Kind = "data"
Event Kind = "event"
)Op
go
const (
Read Kind = "read"
Op Kind = "op"
Service Kind = "service"
Data Kind = "data"
Event Kind = "event"
)Service
go
const (
Read Kind = "read"
Op Kind = "op"
Service Kind = "service"
Data Kind = "data"
Event Kind = "event"
)Data
go
const (
Read Kind = "read"
Op Kind = "op"
Service Kind = "service"
Data Kind = "data"
Event Kind = "event"
)Event
go
const (
Read Kind = "read"
Op Kind = "op"
Service Kind = "service"
Data Kind = "data"
Event Kind = "event"
)Contract.Major
go
Major uint32 `json:"major"`Contract.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`Contract.Schema
go
Schema json.RawMessage `json:"schema"`Contract
go
type Contract struct {
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
Schema json.RawMessage `json:"schema"`
}text
Contract identifies a structural member contract. Catalog entries include
Schema; calls bind Major and SchemaDigest and do not trust a supplied Schema.Declaration.Name
go
Name string `json:"name"`Declaration.Kind
go
Kind Kind `json:"kind"`Declaration.Major
go
Major uint32 `json:"major"`Declaration.Shared
go
Shared bool `json:"shared"`Declaration.CandidateReadable
go
CandidateReadable bool `json:"candidate_readable"`Declaration
go
type Declaration struct {
Name string `json:"name"`
Kind Kind `json:"kind"`
Major uint32 `json:"major"`
Shared bool `json:"shared"`
CandidateReadable bool `json:"candidate_readable"`
}text
Declaration describes a member local to the module's namespace. A zero Kind
selects Read and a zero Major selects version 1. Shared permits multiple
providers of the same contract; it never grants caller authorization.Entry.Member
go
Member string `json:"member"`Entry.Kind
go
Kind Kind `json:"kind"`Entry.Contract
go
Contract Contract `json:"contract"`Entry.Provider
go
Provider Identity `json:"provider"`Entry.Availability
go
Availability string `json:"availability"`Entry.Authorized
go
Authorized bool `json:"authorized"`Entry.CandidateReadable
go
CandidateReadable bool `json:"candidate_readable"`Entry.Shared
go
Shared bool `json:"shared"`Entry
go
type Entry struct {
Member string `json:"member"`
Kind Kind `json:"kind"`
Contract Contract `json:"contract"`
Provider Identity `json:"provider"`
Availability string `json:"availability"`
Authorized bool `json:"authorized"`
CandidateReadable bool `json:"candidate_readable"`
Shared bool `json:"shared"`
}text
Entry describes one provider of a catalog member for the current caller.CallRequest.Member
go
Member string `json:"member"`CallRequest.Kind
go
Kind Kind `json:"kind"`CallRequest.Contract
go
Contract Contract `json:"contract"`CallRequest.Target
go
Target *Identity `json:"target"`CallRequest.Arguments
go
Arguments json.RawMessage `json:"arguments"`CallRequest.Intent
go
Intent *OpIntent `json:"intent,omitempty"`CallRequest.Cause
go
Cause string `json:"cause,omitempty"`text
Cause names the ongoing invocation handled by this caller. Unfrozen calls
fill it from the injected Call context; wire callers supply only the ID,
never a claimed depth or ancestry. Durable retries use a retained FrozenOp.CallRequest.ScopeID
go
ScopeID string `json:"scope_id,omitempty"`CallRequest.SessionID
go
SessionID string `json:"session_id,omitempty"`CallRequest
go
type CallRequest struct {
Member string `json:"member"`
Kind Kind `json:"kind"`
Contract Contract `json:"contract"`
Target *Identity `json:"target"`
Arguments json.RawMessage `json:"arguments"`
Intent *OpIntent `json:"intent,omitempty"`
Cause string `json:"cause,omitempty"`
ScopeID string `json:"scope_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
}text
CallRequest binds a member call to the discovered major and structural digest.
Target may select a provider explicitly when a member has multiple providers.CallRequest.OpCauseFrozen
go
func (r CallRequest) OpCauseFrozen() booltext
OpCauseFrozen reports whether an op request came from a retained FrozenOp.
Only op admission uses this flag; read/service calls always propagate their
current handler context. It is not an authorization or admission assertion.Call.(context.Context)
go
context.ContextCall.ID
go
ID stringCall.Caller
go
Caller IdentityCall.Provider
go
Provider IdentityCall.AcceptedAt
go
AcceptedAt time.TimeCall.Member
go
Member stringCall.Kind
go
Kind KindCall.Contract
go
Contract ContractCall.Arguments
go
Arguments json.RawMessagetext
Arguments is a private copy of the strictly validated tagged request.
Mutating it cannot change the handler's input or another invocation.Call
go
type Call struct {
context.Context
ID string
Caller Identity
Provider Identity
AcceptedAt time.Time
Member string
Kind Kind
Contract Contract
Arguments json.RawMessage
}text
Call is injected by the host by its type, never by a parameter name. Its
identities and times describe the admitted invocation, not user arguments.
Cancellation asks the handler to stop; the provider slot is retained until
the handler actually returns.Module.OnInit
go
OnInit(RegHandle) errorModule
go
type Module interface {
OnInit(RegHandle) error
}text
Module stages its declarations using the candidate registration handle.RegHandle.Identity
go
Identity() IdentityRegHandle.Context
go
Context() context.ContextRegHandle.Config
go
Config() json.RawMessageRegHandle.Provide
go
Provide(Declaration, any) errorRegHandle.ProvideView
go
ProvideView(Declaration, ViewSource) errorRegHandle.Watch
go
Watch(WatchRequest, any) errorRegHandle.OpenWatch
go
OpenWatch(context.Context, WatchRequest) (Watch, error)RegHandle.OnPacket
go
OnPacket(any, any) errorRegHandle.OnBusData
go
OnBusData(string, any, ...EventHandlerOption) errorRegHandle.Publish
go
Publish(string, any, ...PublishOption) PublisherRegHandle.Catalog
go
Catalog(context.Context) ([]Entry, error)RegHandle.FreezeOp
go
FreezeOp(context.Context, CallRequest) (FrozenOp, error)RegHandle.Call
go
Call(context.Context, CallRequest) (json.RawMessage, error)RegHandle
go
type RegHandle interface {
Identity() Identity
Context() context.Context
Config() json.RawMessage
Provide(Declaration, any) error
ProvideView(Declaration, ViewSource) error
Watch(WatchRequest, any) error
OpenWatch(context.Context, WatchRequest) (Watch, error)
OnPacket(any, any) error
OnBusData(string, any, ...EventHandlerOption) error
Publish(string, any, ...PublishOption) Publisher
Catalog(context.Context) ([]Entry, error)
FreezeOp(context.Context, CallRequest) (FrozenOp, error)
Call(context.Context, CallRequest) (json.RawMessage, error)
}text
RegHandle belongs to one installation generation. Provide stages declarations
during OnInit; reads remain subject to caller authorization and candidate rules.Client.Catalog
go
Catalog(context.Context) ([]Entry, error)Client.FreezeOp
go
FreezeOp(context.Context, CallRequest) (FrozenOp, error)Client.Call
go
Call(context.Context, CallRequest) (json.RawMessage, error)Client.OpenWatch
go
OpenWatch(context.Context, WatchRequest) (Watch, error)Client
go
type Client interface {
Catalog(context.Context) ([]Entry, error)
FreezeOp(context.Context, CallRequest) (FrozenOp, error)
Call(context.Context, CallRequest) (json.RawMessage, error)
OpenWatch(context.Context, WatchRequest) (Watch, error)
}text
Client exposes the generic catalog and call methods to an authorized caller.
FreezeOp takes a complete local snapshot before the first op call; admission
still validates caller authority and recognizes retained duplicates first.ErrInvalid
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrClosed
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrForbidden
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrCandidate
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrNotFound
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrUnavailable
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrInstanceReplaced
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.
ErrInstanceReplaced is emitted only after the replacement is readable.
It remains an unavailable instance for callers using the broader code.ErrStreamPaused
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.
ErrStreamPaused is a definite non-admission during a trusted handoff.
It never implies that a request may be replayed without an explicit resume.ErrBusy
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrAmbiguousProvider
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrContractChanged
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrConflict
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrInit
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrInvalidCause
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrCycleRejected
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.ErrDepthExceeded
go
// Stable error codes support errors.Is even when an implementation adds context.
var (
ErrInvalid = errors.New("invalid")
ErrClosed = errors.New("closed")
ErrForbidden = errors.New("forbidden")
ErrCandidate = errors.New("candidate")
ErrNotFound = errors.New("not_found")
ErrUnavailable = errors.New("unavailable")
// ErrInstanceReplaced is emitted only after the replacement is readable.
// It remains an unavailable instance for callers using the broader code.
ErrInstanceReplaced = fmt.Errorf("instance_replaced: %w", ErrUnavailable)
// ErrStreamPaused is a definite non-admission during a trusted handoff.
// It never implies that a request may be replayed without an explicit resume.
ErrStreamPaused = errors.New("stream_paused")
ErrBusy = errors.New("provider_busy")
ErrAmbiguousProvider = errors.New("ambiguous_provider")
ErrContractChanged = errors.New("contract_changed")
ErrConflict = errors.New("conflict")
ErrInit = errors.New("init")
ErrInvalidCause = errors.New("invalid_cause")
ErrCycleRejected = errors.New("cycle_rejected")
ErrDepthExceeded = errors.New("depth_exceeded")
)text
Stable error codes support errors.Is even when an implementation adds context.busapi/frozen_op.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/frozen_op.go; DO NOT EDIT.签名中使用的导入:
go
import (
"bytes"
"encoding/json"
"io"
)FrozenOp
go
type FrozenOp struct {
}text
FrozenOp retains a complete operation request, including an absent cause.
Obtain it with Client.FreezeOp before the first admission attempt. Retain this
value (or its JSON) for reconciliation after an interrupted or unknown result;
constructing another intent cannot recover an earlier causal parent.
It contains no context, client capability, or evidence of authorization.NewFrozenOp
go
func NewFrozenOp(request CallRequest) (FrozenOp, error)text
NewFrozenOp snapshots an explicitly supplied request without capturing any
context or doing IO. Client.FreezeOp also captures the current handler cause.
Deadline/provider/parent liveness is checked at admission, after duplicates.FrozenOp.Request
go
func (o FrozenOp) Request() CallRequesttext
Request returns an isolated copy for Client.Call. Its private marker preserves
an empty cause through Go value copies. To persist the frozen state, marshal
FrozenOp itself and restore it as FrozenOp, not as an ordinary CallRequest.FrozenOp.MarshalJSON
go
func (o FrozenOp) MarshalJSON() ([]byte, error)FrozenOp.UnmarshalJSON
go
func (o *FrozenOp) UnmarshalJSON(data []byte) errorbusapi/op.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/op.go; DO NOT EDIT.签名中使用的导入:
go
import (
"encoding/json"
"time"
)LeafContext.Deadline
go
Deadline() (time.Time, bool)LeafContext.Done
go
Done() <-chan struct{}LeafContext.Err
go
Err() errorLeafContext
go
type LeafContext interface {
Deadline() (time.Time, bool)
Done() <-chan struct{}
Err() error
}text
LeafContext carries only the lifetime of an executing leaf operation. It does
not expose the caller's context values, a registration handle, or bus methods.
A leaf handler has the shape func(LeafContext, Args) (OpResult, error).OpIntent.IdempotencyKey
go
IdempotencyKey string `json:"idempotency_key"`OpIntent.Session
go
Session string `json:"session"`OpIntent.Deadline
go
Deadline time.Time `json:"deadline"`OpIntent
go
type OpIntent struct {
IdempotencyKey string `json:"idempotency_key"`
Session string `json:"session"`
Deadline time.Time `json:"deadline"`
}text
OpIntent binds a durable operation submission to its original idempotency
key, session and execution deadline. A caller stopping its wait does not
change this intent or cancel an already admitted operation.OpResult.State
go
State string `json:"state"`OpResult.Evidence
go
Evidence string `json:"evidence,omitempty"`OpResult.Reason
go
Reason string `json:"reason,omitempty"`OpResult.Result
go
Result json.RawMessage `json:"result,omitempty"`OpResult.PartialEffects
go
PartialEffects json.RawMessage `json:"partial_effects,omitempty"`OpResult.KnownUnsent
go
KnownUnsent bool `json:"known_unsent,omitempty"`OpResult.CausalEvidence
go
CausalEvidence json.RawMessage `json:"causal_evidence,omitempty"`OpResult.RecoveryRequired
go
RecoveryRequired bool `json:"recovery_required,omitempty"`OpResult
go
type OpResult struct {
State string `json:"state"`
Evidence string `json:"evidence,omitempty"`
Reason string `json:"reason,omitempty"`
Result json.RawMessage `json:"result,omitempty"`
PartialEffects json.RawMessage `json:"partial_effects,omitempty"`
KnownUnsent bool `json:"known_unsent,omitempty"`
CausalEvidence json.RawMessage `json:"causal_evidence,omitempty"`
RecoveryRequired bool `json:"recovery_required,omitempty"`
}text
OpResult preserves the existing operation receipt envelope. State, evidence,
reason and recovery semantics are owned by the operations runtime; declaring
a bus leaf does not introduce another result state machine. Result and
PartialEffects contain the operation's original JSON payloads.busapi/op_admission.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/op_admission.go; DO NOT EDIT.OpAdmission.OperationID
go
OperationID string `json:"operation_id"`OpAdmission.State
go
State string `json:"state"`OpAdmission.ExpiresAt
go
ExpiresAt string `json:"expires_at"`OpAdmission.Duplicate
go
Duplicate bool `json:"duplicate"`OpAdmission.SchedulingPending
go
SchedulingPending bool `json:"scheduling_pending"`OpAdmission
go
type OpAdmission struct {
OperationID string `json:"operation_id"`
State string `json:"state"`
ExpiresAt string `json:"expires_at"`
Duplicate bool `json:"duplicate"`
SchedulingPending bool `json:"scheduling_pending"`
}text
OpAdmission is the durable bus.call acknowledgement. It references the
retained operation; it is neither its final OpResult nor proof of a send.
ExpiresAt is RFC3339Nano text so the public tagged schema has no Go time hook.busapi/operation_admitted.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/operation_admitted.go; DO NOT EDIT.OperationAdmitted.OperationID
go
OperationID string `json:"operation_id"`OperationAdmitted.Operation
go
Operation string `json:"operation"`OperationAdmitted.Major
go
Major uint32 `json:"major"`OperationAdmitted.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`OperationAdmitted.Caller
go
Caller Identity `json:"caller"`OperationAdmitted.SourceKind
go
SourceKind string `json:"source_kind"`OperationAdmitted.SourceID
go
SourceID string `json:"source_id"`OperationAdmitted.AdmissionSequence
go
AdmissionSequence int64 `json:"admission_sequence"`OperationAdmitted.AdmittedAtUnixMS
go
AdmittedAtUnixMS int64 `json:"admitted_at_unix_ms"`OperationAdmitted
go
type OperationAdmitted struct {
OperationID string `json:"operation_id"`
Operation string `json:"operation"`
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
Caller Identity `json:"caller"`
SourceKind string `json:"source_kind"`
SourceID string `json:"source_id"`
AdmissionSequence int64 `json:"admission_sequence"`
AdmittedAtUnixMS int64 `json:"admitted_at_unix_ms"`
}text
OperationAdmitted is the online projection of a committed admission fact,
not an operation completion. SourceKind/SourceID identify the durable fact.
AdmissionSequence is its journal position, independent of BusEvent.Sequence
and any consumer's input sequence or checkpoint.busapi/pubsub.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/pubsub.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"time"
)PublishOption.Major
go
Major uint32PublishOption.Shared
go
Shared boolPublishOption
go
type PublishOption struct {
Major uint32
Shared bool
}text
PublishOption describes a staged event declaration. Major zero selects 1.Shared
go
var Shared = PublishOption{Shared: true}Publisher.Send
go
Send(any) errorPublisher.SendContext
go
SendContext(context.Context, any) errorPublisher
go
type Publisher interface {
Send(any) error
SendContext(context.Context, any) error
}text
Publisher acknowledges online admission only. SendContext cancellation stops
waiting; it does not retract an admitted event. Implementations serialize
sends and never retry an uncertain admission.EventContext.(context.Context)
go
context.ContextEventContext.PublisherID
go
PublisherID stringEventContext.Publisher
go
Publisher IdentityEventContext.Member
go
Member stringEventContext.Major
go
Major uint32EventContext.SchemaDigest
go
SchemaDigest stringEventContext.Sequence
go
Sequence uint64EventContext.AcceptedAt
go
AcceptedAt time.TimeEventContext
go
type EventContext struct {
context.Context
PublisherID string
Publisher Identity
Member string
Major uint32
SchemaDigest string
Sequence uint64
AcceptedAt time.Time
}text
EventContext is trusted metadata injected by exact type into event handlers.EventTermination.Member
go
Member stringEventTermination.Major
go
Major uint32EventTermination.SchemaDigest
go
SchemaDigest stringEventTermination.Reason
go
Reason stringEventTermination.Gap
go
Gap boolEventTermination
go
type EventTermination struct {
Member string
Major uint32
SchemaDigest string
Reason string
Gap bool
}text
EventTermination describes the first terminal state of a subscription.
It is not a business event and does not acknowledge queued values.EventHandlerOption.OnTerminal
go
OnTerminal func(EventTermination) errorEventHandlerOption
go
type EventHandlerOption struct {
OnTerminal func(EventTermination) error
}text
EventHandlerOption optionally observes termination in the subscription's
existing task, after its business callback returns and before actual drain.
OnTerminal runs once, including on normal close, and must return for drain
to complete. Failures are bounded message snapshots, not retained error
chains, observable through supervision and the owner's lifecycle result.EventLimits.MaxEvents
go
MaxEvents int `json:"max_events"`EventLimits.MaxBytes
go
MaxBytes int `json:"max_bytes"`EventLimits
go
type EventLimits struct {
MaxEvents int `json:"max_events"`
MaxBytes int `json:"max_bytes"`
}PublisherGrant.PublisherID
go
PublisherID string `json:"publisher_id"`PublisherGrant.Member
go
Member string `json:"member"`PublisherGrant.Major
go
Major uint32 `json:"major"`PublisherGrant.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`PublisherGrant
go
type PublisherGrant struct {
PublisherID string `json:"publisher_id"`
Member string `json:"member"`
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
}PublishReceipt.Accepted
go
Accepted bool `json:"accepted"`PublishReceipt.Sequence
go
Sequence uint64 `json:"sequence,omitempty"`PublishReceipt
go
type PublishReceipt struct {
Accepted bool `json:"accepted"`
Sequence uint64 `json:"sequence,omitempty"`
}SubscriptionGrant.SubscriptionID
go
SubscriptionID string `json:"subscription_id"`SubscriptionGrant.Member
go
Member string `json:"member"`SubscriptionGrant.Major
go
Major uint32 `json:"major"`SubscriptionGrant.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`SubscriptionGrant
go
type SubscriptionGrant struct {
SubscriptionID string `json:"subscription_id"`
Member string `json:"member"`
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
}BusEvent.PublisherID
go
PublisherID string `json:"publisher_id"`BusEvent.Publisher
go
Publisher Identity `json:"publisher"`BusEvent.Member
go
Member string `json:"member"`BusEvent.Major
go
Major uint32 `json:"major"`BusEvent.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`BusEvent.Sequence
go
Sequence uint64 `json:"sequence"`BusEvent.AcceptedAtUnixMS
go
AcceptedAtUnixMS int64 `json:"accepted_at_unix_ms"`BusEvent.Value
go
Value json.RawMessage `json:"value"`BusEvent
go
type BusEvent struct {
PublisherID string `json:"publisher_id"`
Publisher Identity `json:"publisher"`
Member string `json:"member"`
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
Sequence uint64 `json:"sequence"`
AcceptedAtUnixMS int64 `json:"accepted_at_unix_ms"`
Value json.RawMessage `json:"value"`
}EventBatch.Events
go
Events []BusEvent `json:"events"`EventBatch.Terminal
go
Terminal string `json:"terminal,omitempty"`EventBatch.Gap
go
Gap bool `json:"gap"`EventBatch
go
type EventBatch struct {
Events []BusEvent `json:"events"`
Terminal string `json:"terminal,omitempty"`
Gap bool `json:"gap"`
}ErrEventOverflow
go
var (
ErrEventOverflow = errors.New("event_overflow")
ErrEventReadLimit = errors.New("event_read_limit")
)ErrEventReadLimit
go
var (
ErrEventOverflow = errors.New("event_overflow")
ErrEventReadLimit = errors.New("event_read_limit")
)busapi/recovery.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/recovery.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
)Recoverer.Recover
go
Recover(context.Context) (json.RawMessage, error)Recoverer
go
type Recoverer interface {
Recover(context.Context) (json.RawMessage, error)
}text
Recoverer is an optional trusted module lifecycle hook. Only the host's
recovery coordinator may invoke it, after sealing action admission and
joining actual world execution. It supplies fresh evidence; it does not
clear durable fences, resolve unknown receipts or replay operations.
Recover is deliberately absent from RegHandle and Client.busapi/scope.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/scope.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
)ScopeRef.ScopeID
go
ScopeID stringScopeRef.SessionID
go
SessionID stringScopeRef
go
type ScopeRef struct {
ScopeID string
SessionID string
}text
ScopeRef names an authority-owned scope. Neither this value nor its context
wrapper confers ownership; Host checks the authenticated identity and session.WithScope
go
func WithScope(ctx context.Context, scopeID, sessionID string) context.ContextScopeFromContext
go
func ScopeFromContext(ctx context.Context) (ScopeRef, bool)ScopeCondition.Kind
go
Kind string `json:"kind"`ScopeCondition.ArgumentsJSON
go
ArgumentsJSON string `json:"arguments_json"`ScopeCondition
go
type ScopeCondition struct {
Kind string `json:"kind"`
ArgumentsJSON string `json:"arguments_json"`
}text
Scope wire DTOs contain only structural Bus values. JSON condition arguments
and evidence are explicitly encoded strings; timestamps use RFC3339Nano.ScopeSpec.Resources
go
Resources []string `json:"resources"`ScopeSpec.Conditions
go
Conditions []ScopeCondition `json:"conditions"`ScopeSpec.LeaseMillis
go
LeaseMillis int64 `json:"lease_ms"`ScopeSpec
go
type ScopeSpec struct {
Resources []string `json:"resources"`
Conditions []ScopeCondition `json:"conditions"`
LeaseMillis int64 `json:"lease_ms"`
}ScopeAcquireRequest.RequestID
go
RequestID string `json:"request_id"`ScopeAcquireRequest.Spec
go
Spec ScopeSpec `json:"spec"`ScopeAcquireRequest
go
type ScopeAcquireRequest struct {
RequestID string `json:"request_id"`
Spec ScopeSpec `json:"spec"`
}ScopeIDRequest.ScopeID
go
ScopeID string `json:"scope_id"`ScopeIDRequest
go
type ScopeIDRequest struct {
ScopeID string `json:"scope_id"`
}ScopeLookupRequest.RequestID
go
RequestID string `json:"request_id"`ScopeLookupRequest
go
type ScopeLookupRequest struct {
RequestID string `json:"request_id"`
}ScopeRenewRequest.ScopeID
go
ScopeID string `json:"scope_id"`ScopeRenewRequest.ExpiresAt
go
ExpiresAt string `json:"expires_at"`ScopeRenewRequest
go
type ScopeRenewRequest struct {
ScopeID string `json:"scope_id"`
ExpiresAt string `json:"expires_at"`
}ScopeSessionRequest.SessionID
go
SessionID string `json:"session_id"`ScopeSessionRequest
go
type ScopeSessionRequest struct {
SessionID string `json:"session_id"`
}ScopeSession.SessionID
go
SessionID string `json:"session_id"`ScopeSession.ExpiresAt
go
ExpiresAt string `json:"expires_at"`ScopeSession
go
type ScopeSession struct {
SessionID string `json:"session_id"`
ExpiresAt string `json:"expires_at"`
}ScopeHandle.ID
go
ID string `json:"id"`ScopeHandle.RequestID
go
RequestID string `json:"request_id"`ScopeHandle.Installation
go
Installation string `json:"installation"`ScopeHandle.Generation
go
Generation int64 `json:"generation"`ScopeHandle.SessionID
go
SessionID string `json:"session_id"`ScopeHandle.Epoch
go
Epoch string `json:"epoch"`ScopeHandle.ActionSession
go
ActionSession string `json:"action_session"`ScopeHandle.State
go
State string `json:"state"`ScopeHandle.Resources
go
Resources []string `json:"resources"`ScopeHandle.ExpiresAt
go
ExpiresAt string `json:"expires_at"`ScopeHandle.MaxExpiresAt
go
MaxExpiresAt string `json:"max_expires_at"`ScopeHandle.OperationIDs
go
OperationIDs []string `json:"operation_ids"`ScopeHandle.PendingOperationIDs
go
PendingOperationIDs []string `json:"pending_operation_ids"`ScopeHandle.Frontier
go
Frontier int64 `json:"frontier"`ScopeHandle.Pending
go
Pending int64 `json:"pending"`ScopeHandle
go
type ScopeHandle struct {
ID string `json:"id"`
RequestID string `json:"request_id"`
Installation string `json:"installation"`
Generation int64 `json:"generation"`
SessionID string `json:"session_id"`
Epoch string `json:"epoch"`
ActionSession string `json:"action_session"`
State string `json:"state"`
Resources []string `json:"resources"`
ExpiresAt string `json:"expires_at"`
MaxExpiresAt string `json:"max_expires_at"`
OperationIDs []string `json:"operation_ids"`
PendingOperationIDs []string `json:"pending_operation_ids"`
Frontier int64 `json:"frontier"`
Pending int64 `json:"pending"`
}ScopeEvidenceRequest.ScopeID
go
ScopeID string `json:"scope_id"`ScopeEvidenceRequest.Resources
go
Resources []string `json:"resources"`ScopeEvidenceRequest
go
type ScopeEvidenceRequest struct {
ScopeID string `json:"scope_id"`
Resources []string `json:"resources"`
}ScopeEvidence.EvidenceJSON
go
EvidenceJSON string `json:"evidence_json"`ScopeEvidence
go
type ScopeEvidence struct {
EvidenceJSON string `json:"evidence_json"`
}WithCause
go
func WithCause(ctx context.Context, cause string) context.Contexttext
WithCause carries a correlation reference only. The receiving Host validates
the provider, live parent and ancestry before accepting delegated work.CauseFromContext
go
func CauseFromContext(ctx context.Context) stringbusapi/watch.go
包:busapi
text
Code generated by sdk/go/sync-public.py from pkg/busapi/watch.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
)View
go
const View Kind = "view"WatchRequest.Member
go
Member string `json:"member"`WatchRequest.Contract
go
Contract Contract `json:"contract"`WatchRequest.Target
go
Target *Identity `json:"target"`WatchRequest
go
type WatchRequest struct {
Member string `json:"member"`
Contract Contract `json:"contract"`
Target *Identity `json:"target"`
}text
WatchRequest binds one snapshot/delta contract to a provider. Its two schema
roots describe snapshot and delta respectively; neither is a call argument.ViewSnapshot.Instance
go
Instance Identity `json:"instance"`ViewSnapshot.Epoch
go
Epoch string `json:"epoch"`ViewSnapshot.Revision
go
Revision uint64 `json:"revision"`ViewSnapshot.Complete
go
Complete bool `json:"complete"`ViewSnapshot.Reason
go
Reason string `json:"reason"`ViewSnapshot.Snapshot
go
Snapshot json.RawMessage `json:"snapshot"`ViewSnapshot
go
type ViewSnapshot struct {
Instance Identity `json:"instance"`
Epoch string `json:"epoch"`
Revision uint64 `json:"revision"`
Complete bool `json:"complete"`
Reason string `json:"reason"`
Snapshot json.RawMessage `json:"snapshot"`
}ViewDelta.Instance
go
Instance Identity `json:"instance"`ViewDelta.Epoch
go
Epoch string `json:"epoch"`ViewDelta.Revision
go
Revision uint64 `json:"revision"`ViewDelta.Complete
go
Complete bool `json:"complete"`ViewDelta.Reason
go
Reason string `json:"reason"`ViewDelta.Delta
go
Delta json.RawMessage `json:"delta"`ViewDelta
go
type ViewDelta struct {
Instance Identity `json:"instance"`
Epoch string `json:"epoch"`
Revision uint64 `json:"revision"`
Complete bool `json:"complete"`
Reason string `json:"reason"`
Delta json.RawMessage `json:"delta"`
}ViewSource.Contract
go
Contract() ContractViewSource.Open
go
Open(context.Context) (ViewSnapshot, ViewStream, error)ViewSource
go
type ViewSource interface {
Contract() Contract
Open(context.Context) (ViewSnapshot, ViewStream, error)
}text
ViewSource is trusted provider code. Open atomically captures a baseline and
subscribes to its successor revisions; it must be bounded and return promptly.
Frame supplies Instance, validates payloads, and joins actual stream shutdown.
A nonnil returned stream belongs to the caller even when Open returns an error.ViewStream.Next
go
Next(context.Context) (ViewDelta, error)ViewStream.Close
go
Close() errorViewStream
go
type ViewStream interface {
Next(context.Context) (ViewDelta, error)
Close() error
}text
Close must be safe concurrently with Next and should unblock it. Cancellation
requests shutdown; Frame retains ownership until both methods actually return.Watch.Initial
go
Initial() ViewSnapshotWatch.Next
go
Next(context.Context) (ViewDelta, error)Watch.Poll
go
Poll(context.Context) (ViewDelta, bool, error)Watch.Close
go
Close() errorWatch
go
type Watch interface {
Initial() ViewSnapshot
Next(context.Context) (ViewDelta, error)
Poll(context.Context) (ViewDelta, bool, error)
Close() error
}text
Watch is tied to its original instance and epoch. Poll returns immediately
with false when no delta is buffered. Any terminal error requires a new Open;
callers must never append a new baseline to an old cursor.WatchState.Err
go
Err() errorWatchState
go
type WatchState interface {
Err() error
}text
WatchState optionally exposes terminal invalidation without consuming a delta or
waiting for stream progress. A nil error is not a world-freshness guarantee.ViewUpdateKind
go
type ViewUpdateKind stringViewSnapshotUpdate
go
const (
ViewSnapshotUpdate ViewUpdateKind = "snapshot"
ViewDeltaUpdate ViewUpdateKind = "delta"
ViewInvalidatedUpdate ViewUpdateKind = "invalidated"
)ViewDeltaUpdate
go
const (
ViewSnapshotUpdate ViewUpdateKind = "snapshot"
ViewDeltaUpdate ViewUpdateKind = "delta"
ViewInvalidatedUpdate ViewUpdateKind = "invalidated"
)ViewInvalidatedUpdate
go
const (
ViewSnapshotUpdate ViewUpdateKind = "snapshot"
ViewDeltaUpdate ViewUpdateKind = "delta"
ViewInvalidatedUpdate ViewUpdateKind = "invalidated"
)ViewUpdate.Kind
go
Kind ViewUpdateKindViewUpdate.Instance
go
Instance IdentityViewUpdate.Epoch
go
Epoch stringViewUpdate.Revision
go
Revision uint64ViewUpdate.Complete
go
Complete boolViewUpdate.Reason
go
Reason stringViewUpdate.Snapshot
go
Snapshot *SViewUpdate.Delta
go
Delta *DViewUpdate.Err
go
Err errorViewUpdate
go
type ViewUpdate[S, D any] struct {
Kind ViewUpdateKind
Instance Identity
Epoch string
Revision uint64
Complete bool
Reason string
Snapshot *S
Delta *D
Err error
}text
ViewUpdate is delivered to func(context.Context, ViewUpdate[S,D]) error.
Exactly one payload is present; invalidation carries Err and no payload.ErrViewInvalidated
go
var (
ErrViewInvalidated = errors.New("view_invalidated")
ErrViewOverflow = errors.New("view_overflow")
)ErrViewOverflow
go
var (
ErrViewInvalidated = errors.New("view_invalidated")
ErrViewOverflow = errors.New("view_overflow")
)bushttp/client.go
包:bushttp
text
Code generated by sdk/go/sync-public.py from pkg/bushttp/client.go; DO NOT EDIT.
Package bushttp adapts the existing Agent HTTP Bus to busapi.Client. It
supports inline tagged values; binary grants retain their separate transport.签名中使用的导入:
go
import (
"bytes"
"context"
"crypto/rand"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"net/http"
"net/url"
"regexp"
"strings"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
)Config.BaseURL
go
BaseURL stringConfig.Token
go
Token stringConfig.HTTPClient
go
HTTPClient *http.ClientConfig
go
type Config struct {
BaseURL string
Token string
HTTPClient *http.Client
}text
Config binds a transport credential, not a caller-supplied identity. Host
authenticates each request and resolves its installation and generation.
BaseURL is a bare HTTPS origin, or HTTP on numeric loopback for local use.
HTTPClient may supply TLS roots or a transport. Its Timeout must be zero for
long-lived watches; contexts bound individual calls. Redirects are disabled.Client
go
type Client struct {
}New
go
func New(cfg Config) (*Client, error)Error.Code
go
Code stringError.HTTPStatus
go
HTTPStatus intError.RequestID
go
RequestID stringError.CallID
go
CallID stringError
go
type Error struct {
Code string
HTTPStatus int
RequestID string
CallID string
}text
Error preserves stable remote codes without exposing response bodies or
credentials. HTTPStatus is zero for a terminal Bus receipt or SSE event.Error.Error
go
func (e *Error) Error() stringError.Unwrap
go
func (e *Error) Unwrap() errorErrInlineOnly
go
// ErrInlineOnly means this adapter cannot transport a binary grant. It never
// follows a descriptor URL, so the existing binary loopback boundary is intact.
var ErrInlineOnly = errors.New("bus HTTP adapter supports inline values only")text
ErrInlineOnly means this adapter cannot transport a binary grant. It never
follows a descriptor URL, so the existing binary loopback boundary is intact.Client.Catalog
go
func (c *Client) Catalog(ctx context.Context) ([]busapi.Entry, error)Client.FreezeOp
go
func (c *Client) FreezeOp(ctx context.Context, r busapi.CallRequest) (busapi.FrozenOp, error)Client.Call
go
func (c *Client) Call(ctx context.Context, r busapi.CallRequest) (reply json.RawMessage, callErr error)text
Call never retries an admission. Ops return their durable admission envelope;
read/service calls poll the admitted call ID and return the original tagged
result. Transport failure is not evidence that an operation was unadmitted.bushttp/operation.go
包:bushttp
text
Code generated by sdk/go/sync-public.py from pkg/bushttp/operation.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
"net/http"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
)OperationReceipt.RequestID
go
RequestID string `json:"request_id"`OperationReceipt.OperationID
go
OperationID string `json:"operation_id"`OperationReceipt.State
go
State string `json:"state"`OperationReceipt.ExpiresAt
go
ExpiresAt time.Time `json:"expires_at"`OperationReceipt.Result
go
Result *busapi.OpResult `json:"result"`OperationReceipt.CanRetry
go
CanRetry bool `json:"can_retry"`OperationReceipt
go
type OperationReceipt struct {
RequestID string `json:"request_id"`
OperationID string `json:"operation_id"`
State string `json:"state"`
ExpiresAt time.Time `json:"expires_at"`
Result *busapi.OpResult `json:"result"`
CanRetry bool `json:"can_retry"`
}text
OperationReceipt is the existing owner-scoped durable operation response.
Result is absent until completion. Unknown results remain unknown; observing
this receipt does not retry or cancel any effect. Original evidence and raw
result payloads are preserved, including opaque binary references, which this
adapter never dereferences.Client.Operation
go
func (c *Client) Operation(ctx context.Context, operationID string) (OperationReceipt, error)text
Operation reads the original receipt through the existing runtime operation
route. Host checks the credential's trusted principal and exact generation;
the caller cannot select an owner. This method never submits an operation.bushttp/watch.go
包:bushttp
text
Code generated by sdk/go/sync-public.py from pkg/bushttp/watch.go; DO NOT EDIT.签名中使用的导入:
go
import (
"bufio"
"context"
"encoding/json"
"errors"
"io"
"math"
"net/http"
"strings"
"sync"
"github.com/OmineDev/neomega-sdk-go/busapi"
)Client.OpenWatch
go
func (c *Client) OpenWatch(ctx context.Context, r busapi.WatchRequest) (busapi.Watch, error)text
OpenWatch starts at a new atomic snapshot. EOF, invalidation or overflow
terminates this cursor; projection recovery must open a new baseline.busvalue/binding.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/binding.go; DO NOT EDIT.签名中使用的导入:
go
import (
"encoding"
"encoding/json"
"fmt"
"reflect"
"sort"
"strings"
)Optional.Present
go
Present boolOptional.Value
go
Value TOptional
go
type Optional[T any] struct {
Present bool
Value T
}text
Optional preserves absence independently of a nullable Value.Union.Value
go
Value anyUnion
go
type Union[A, B any] struct{ Value any }text
Union is a closed two-variant union. UnionOf declares larger flat unions.UnionOf.Value
go
Value anyUnionOf
go
type UnionOf[V any] struct{ Value any }text
UnionOf declares a finite union from the field types of V, which must be a
struct with exported, non-embedded fields. Field names do not affect identity.
For example, UnionOf[struct{ Text string; Count int32; Enabled bool }].Float32Bits
go
type Float32Bits uint32Float64Bits
go
type Float64Bits uint64Value.Schema
go
Schema SchemaValue.Root
go
Root intValue.Wire
go
Wire json.RawMessageValue
go
type Value struct {
Schema Schema
Root int
Wire json.RawMessage
}text
Value is a validated dynamic projection, never an untyped JSON escape hatch.Binding.Schema
go
Schema SchemaBinding.Digest
go
Digest stringBinding.Root
go
Root intBinding
go
type Binding struct {
Schema Schema
Digest string
Root int
}Signature.Schema
go
Schema SchemaSignature.Digest
go
Digest stringSignature.Request
go
Request *BindingSignature.Response
go
Response *BindingSignature
go
type Signature struct {
Schema Schema
Digest string
Request *Binding
Response *Binding
}Compile
go
func Compile(t reflect.Type) (*Binding, error)CompileSignature
go
func CompileSignature(request, response reflect.Type) (*Signature, error)ParseSignature
go
func ParseSignature(raw json.RawMessage) (*Signature, error)BindingFromSchema
go
func BindingFromSchema(s Schema, root int) (*Binding, error)text
BindingFromSchema validates a canonical schema and selects a node without
changing its containing graph or contextual union indices.busvalue/codec.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/codec.go; DO NOT EDIT.签名中使用的导入:
go
import (
"bytes"
"encoding/json"
"fmt"
"math"
"reflect"
"sort"
"strconv"
"unicode/utf8"
)Binding.Validate
go
func (b *Binding) Validate(raw json.RawMessage) errorBinding.Encode
go
func (b *Binding) Encode(value any) (json.RawMessage, error)Binding.Decode
go
func (b *Binding) Decode(raw json.RawMessage, out any) errorbusvalue/json.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/json.go; DO NOT EDIT.签名中使用的导入:
go
import (
"bytes"
"encoding/json"
"fmt"
"io"
"strconv"
"unicode/utf8"
)busvalue/nbt.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/nbt.go; DO NOT EDIT.签名中使用的导入:
go
import (
"encoding/json"
"fmt"
"math"
"sort"
"strconv"
"unicode/utf8"
)NBT.Tag
go
Tag uint8NBT.Value
go
Value anyNBT
go
type NBT struct {
Tag uint8
Value any
}text
NBT preserves a Named Binary Tag's exact tag and payload type. Tags 1..12
use uint8, int16, int32, int64, float32/Float32Bits, float64/Float64Bits,
[]uint8, string, List, map[string]NBT, []int32, and []int64, respectively.
Decoding floats returns their raw bits. Collections must be non-nil.List.ElementType
go
ElementType uint8List.Values
go
Values []NBTList
go
type List struct {
ElementType uint8
Values []NBT
}text
List preserves the element tag even when Values is empty. ElementType zero
is allowed only for an empty list; all other elements must match its tag.busvalue/schema.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/schema.go; DO NOT EDIT.
Package busvalue binds native types to a name-independent structural Bus schema.签名中使用的导入:
go
import (
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"reflect"
"sort"
"strconv"
"strings"
"unicode/utf8"
)Version
go
const Version = "bus-v1"MaxSchemaNodes
go
const MaxSchemaNodes = 1024MaxDepth
go
const MaxDepth = 128MaxValueNodes
go
const MaxValueNodes = 1000000MaxBytes
go
const MaxBytes = 16 << 20Field.Name
go
Name string `json:"name"`Field.Type
go
Type int `json:"type"`Field
go
type Field struct {
Name string `json:"name"`
Type int `json:"type"`
}Node.Kind
go
Kind stringNode.Bits
go
Bits intNode.Length
go
Length intNode.Key
go
Key intNode.Elem
go
Elem intNode.Fields
go
Fields []FieldNode.Variants
go
Variants []intNode
go
type Node struct {
Kind string
Bits int
Length int
Key int
Elem int
Fields []Field
Variants []int
}Schema.Version
go
Version string `json:"version"`Schema.Roots
go
Roots []int `json:"roots"`Schema.Nodes
go
Nodes []Node `json:"nodes"`Schema
go
type Schema struct {
Version string `json:"version"`
Roots []int `json:"roots"`
Nodes []Node `json:"nodes"`
}Node.MarshalJSON
go
func (n Node) MarshalJSON() ([]byte, error)Schema.Canonical
go
func (s Schema) Canonical() (Schema, error)Schema.Digest
go
func (s Schema) Digest() (string, error)ParseSchema
go
func ParseSchema(raw json.RawMessage) (Schema, error)busvalue/transcode.go
包:busvalue
text
Code generated by sdk/go/sync-public.py from pkg/busvalue/transcode.go; DO NOT EDIT.签名中使用的导入:
go
import (
"fmt"
)busview/projection.go
包:busview
text
Code generated by sdk/go/sync-public.py from pkg/busview/projection.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"reflect"
"sync"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
"github.com/OmineDev/neomega-sdk-go/busvalue"
)Projected.Instance
go
Instance busapi.IdentityProjected.(Snapshot[S])
go
Snapshot[S]Projected
go
type Projected[S any] struct {
Instance busapi.Identity
Snapshot[S]
}text
Projected is a detached display snapshot. Complete describes the source's
observed coverage and stream continuity, not server freshness or authority.Projection
go
type Projection[S, D any] struct {
}text
Projection continuously reduces a Watch and replaces its baseline after
invalidation. It retains one encoded snapshot (at most 8 MiB), not an event
history. Slow readers may observe coalesced updates. No world action is run
or replayed by a projection.OpenProjection
go
func OpenProjection[S, D any](ctx context.Context, client busapi.Client, request busapi.WatchRequest, reducer func(S, D) (S, error)) (*Projection[S, D], error)text
OpenProjection starts a display projection using the discovered contract.
The reducer must be synchronous and pure; both arguments are private decoded
copies. It is never rerun for a delta. Close waits for an active reducer too,
so it must return promptly and must not close its own projection.Projection.Snapshot
go
func (p *Projection[S, D]) Snapshot() (Projected[S], error)text
Snapshot returns a detached copy even while disconnected. A terminal error is
returned with the last incomplete snapshot; recovered projections have no
terminal error. Reading it never makes an incomplete observation complete.Projection.Read
go
func (p *Projection[S, D]) Read(ctx context.Context) (Projected[S], error)text
Read waits for an update or invalidation and returns the latest snapshot.
Updates coalesce: this is a display cache, not an every-event subscription.
Cancelling one Read does not cancel the projection's independent lifetime.Projection.Close
go
func (p *Projection[S, D]) Close() errortext
Close invalidates the cache immediately, cancels a pending open/read, and
waits for the actual worker and Watch.Close. Remote provider cleanup remains
the Host's responsibility. Repeated Close calls retain cleanup failures.busview/publisher.go
包:busview
text
Code generated by sdk/go/sync-public.py from pkg/busview/publisher.go; DO NOT EDIT.签名中使用的导入:
go
import (
"context"
"encoding/json"
"fmt"
"math"
"reflect"
"sync"
"unicode/utf8"
"github.com/OmineDev/neomega-sdk-go/busapi"
"github.com/OmineDev/neomega-sdk-go/busvalue"
)Publisher
go
type Publisher[S, D any] struct {
}text
Publisher owns one epoch of native snapshot/delta state. Each Open atomically
captures the current snapshot and subscribes to its successor revisions.
The constructor and Publish copy native payloads through the bus codec before
adopting them; callers may mutate their values after those methods return.NewPublisher
go
func NewPublisher[S, D any](major uint32, initial Snapshot[S]) (*Publisher[S, D], error)text
NewPublisher creates a source with at most 128 subscribers. Each subscriber
retains at most 128 deltas and 8 MiB total of payload and epoch/reason bytes.
Overflow discards that subscriber's backlog and requires a fresh Open.
The caller supplies completeness and its reason; neither is inferred from data.
Epoch and reason are limited to 256 and 1024 UTF-8 bytes respectively; encoded
snapshots are limited to 8 MiB, matching the Frame view boundary.Publisher.Contract
go
func (p *Publisher[S, D]) Contract() busapi.ContractPublisher.Open
go
func (p *Publisher[S, D]) Open(ctx context.Context) (busapi.ViewSnapshot, busapi.ViewStream, error)Publisher.Publish
go
func (p *Publisher[S, D]) Publish(next Snapshot[S], delta D) errortext
Publish atomically adopts next and queues delta for every current subscriber.
next must retain the epoch and advance exactly one revision. Once incomplete,
this publisher cannot claim completeness again; create a new epoch instead.
Invalid payloads or metadata leave both the snapshot and all streams unchanged.Publisher.Close
go
func (p *Publisher[S, D]) Close() errortext
Close invalidates all streams and releases retained payloads. It is idempotent.busview/source.go
包:busview
text
Code generated by sdk/go/sync-public.py from pkg/busview/source.go; DO NOT EDIT.
Package busview adapts native snapshot/delta types to the neutral bus contract.签名中使用的导入:
go
import (
"context"
"encoding/json"
"fmt"
"reflect"
"github.com/OmineDev/neomega-sdk-go/busapi"
"github.com/OmineDev/neomega-sdk-go/busvalue"
)Snapshot.Epoch
go
Epoch stringSnapshot.Revision
go
Revision uint64Snapshot.Complete
go
Complete boolSnapshot.Reason
go
Reason stringSnapshot.Value
go
Value SSnapshot
go
type Snapshot[S any] struct {
Epoch string
Revision uint64
Complete bool
Reason string
Value S
}Delta.Epoch
go
Epoch stringDelta.Revision
go
Revision uint64Delta.Complete
go
Complete boolDelta.Reason
go
Reason stringDelta.Value
go
Value DDelta
go
type Delta[D any] struct {
Epoch string
Revision uint64
Complete bool
Reason string
Value D
}Stream.Next
go
Next(context.Context) (Delta[D], error)Stream.Close
go
Close() errorStream
go
type Stream[D any] interface {
Next(context.Context) (Delta[D], error)
Close() error
}Source
go
type Source[S, D any] struct {
}NewSource
go
func NewSource[S, D any](major uint32, open func(context.Context) (Snapshot[S], Stream[D], error)) (*Source[S, D], error)text
NewSource compiles a canonical two-root schema from native types. Open must
capture snapshot and stream atomically in the provider's own state boundary.Source.Contract
go
func (s *Source[S, D]) Contract() busapi.ContractSource.Open
go
func (s *Source[S, D]) Open(ctx context.Context) (busapi.ViewSnapshot, busapi.ViewStream, error)client.go
包:neomega
签名中使用的导入:
go
import (
"bytes"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path/filepath"
"regexp"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
)Caller.Call
go
Call(context.Context, string, any) (map[string]any, error)Caller
go
type Caller interface {
Call(context.Context, string, any) (map[string]any, error)
}text
Caller is the managed peer's RPC surface. Facades do not own its lifetime.LoadConfig
go
func LoadConfig(dst any) errortext
LoadConfig reads Host's selected configuration into dst. Prepopulate dst with
defaults. Validation is read-only; a missing file leaves those defaults intact.Intent
go
type Intent struct {
}text
Intent is an immutable JSON request. Payload returns an independent copy for
durable reconciliation; it never changes IDs, deadlines or unknown outcomes.Intent.Method
go
func (i Intent) Method() stringIntent.Payload
go
func (i Intent) Payload() json.RawMessageUncertain.Intent
go
Intent IntentUncertain.ID
go
ID stringUncertain.Err
go
Err errorUncertain
go
type Uncertain struct {
Intent Intent
ID string
Err error
}text
Uncertain retains the original request after a transport or receipt failure.
It never implies the request was unsent or safe to replay.Uncertain.Error
go
func (e *Uncertain) Error() stringUncertain.Unwrap
go
func (e *Uncertain) Unwrap() errorStorage.Peer
go
Peer CallerStorage
go
type Storage struct{ Peer Caller }text
Storage commits explicit global revision CAS transactions. It never retries.Snapshot.Revision
go
Revision int64 `json:"revision"`Snapshot.Values
go
Values map[string]json.RawMessage `json:"values"`Snapshot.Session
go
Session string `json:"session"`Snapshot
go
type Snapshot struct {
Revision int64 `json:"revision"`
Values map[string]json.RawMessage `json:"values"`
Session string `json:"session"`
}Storage.Snapshot
go
func (s Storage) Snapshot(ctx context.Context, keys []string) (Snapshot, error)Mutation.Key
go
Key string `json:"key"`Mutation.Value
go
Value json.RawMessage `json:"value,omitempty"`Mutation.Delete
go
Delete bool `json:"delete,omitempty"`Mutation
go
type Mutation struct {
Key string `json:"key"`
Value json.RawMessage `json:"value,omitempty"`
Delete bool `json:"delete,omitempty"`
}text
Mutation distinguishes deletion from writing JSON null. Use SetValue/DeleteKey.SetValue
go
func SetValue(key string, value any) (Mutation, error)DeleteKey
go
func DeleteKey(key string) MutationEventDelivery.SubscriptionID
go
SubscriptionID string `json:"subscription_id"`EventDelivery.EventID
go
EventID string `json:"event_id"`EventDelivery.DeliveryToken
go
DeliveryToken string `json:"delivery_token"`EventDelivery
go
type EventDelivery struct {
SubscriptionID string `json:"subscription_id"`
EventID string `json:"event_id"`
DeliveryToken string `json:"delivery_token"`
}text
EventDelivery contains the exact durable delivery identity from Host. Merely
receiving it never advances the subscription cursor.PrepareCommit
go
func PrepareCommit(id string, snapshot Snapshot, mutations []Mutation, actions []Intent, event *EventDelivery) (Intent, error)Storage.Submit
go
func (s Storage) Submit(ctx context.Context, i Intent) (map[string]any, error)Storage.Receipt
go
func (s Storage) Receipt(ctx context.Context, id string) (map[string]any, error)Storage.Ack
go
func (s Storage) Ack(ctx context.Context, id string, snapshot Snapshot, event EventDelivery) (Intent, map[string]any, error)text
Ack creates one event-only CAS commit. Retain the returned intent even on error.Operations.Peer
go
Peer CallerOperations.Session
go
Session stringOperations
go
type Operations struct {
Peer Caller
Session string
}text
Operations refers to the game session from capabilities.get, not hello's
installation metadata. Context cancellation does not cancel a world action.Operations.Prepare
go
func (o Operations) Prepare(operation string, arguments map[string]any, key string, deadline time.Time) (Intent, error)Operations.PrepareContext
go
func (o Operations) PrepareContext(ctx context.Context, operation string, arguments map[string]any, key string, deadline time.Time) (Intent, error)text
PrepareContext freezes the current callback cause and resource scope with the
original intent. Submit never rebinds it to a later context.Operations.Submit
go
func (o Operations) Submit(ctx context.Context, i Intent) (map[string]any, error)Operations.Get
go
func (o Operations) Get(ctx context.Context, id string) (map[string]any, error)Operations.Cancel
go
func (o Operations) Cancel(ctx context.Context, id string) (map[string]any, error)Bus.Peer
go
Peer CallerBus
go
type Bus struct{ Peer Caller }text
Bus exposes the existing tagged-value contract without pretending that a Go
struct implies a schema digest. Caller supplies catalog-derived schema/args.
Receipts retain wire bulk references; Result/Call decode them separately.BusRequest.Target
go
Target string `json:"target"`BusRequest.Major
go
Major uint32 `json:"major"`BusRequest.SchemaDigest
go
SchemaDigest string `json:"schema_digest"`BusRequest.Args
go
Args any `json:"args"`BusRequest.Deadline
go
Deadline time.Time `json:"deadline"`BusRequest.Kind
go
Kind string `json:"kind"`BusRequest.Provider
go
Provider map[string]any `json:"provider,omitempty"`BusRequest.Cause
go
Cause string `json:"cause,omitempty"`BusRequest.ScopeID
go
ScopeID string `json:"scope_id,omitempty"`BusRequest.SessionID
go
SessionID string `json:"session_id,omitempty"`BusRequest
go
type BusRequest struct {
Target string `json:"target"`
Major uint32 `json:"major"`
SchemaDigest string `json:"schema_digest"`
Args any `json:"args"`
Deadline time.Time `json:"deadline"`
Kind string `json:"kind"`
Provider map[string]any `json:"provider,omitempty"`
Cause string `json:"cause,omitempty"`
ScopeID string `json:"scope_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
}Bus.Catalog
go
func (b Bus) Catalog(ctx context.Context) (map[string]any, error)Bus.Submit
go
func (b Bus) Submit(ctx context.Context, request BusRequest) (map[string]any, error)Bus.Get
go
func (b Bus) Get(ctx context.Context, id string) (map[string]any, error)Bus.Cancel
go
func (b Bus) Cancel(ctx context.Context, id string) (map[string]any, error)Bus.Wait
go
func (b Bus) Wait(ctx context.Context, receipt map[string]any, poll time.Duration) (map[string]any, error)text
Wait consumes receipts until terminal or the caller's context expires. It
returns the last receipt with errors and never implicitly cancels or replays.
To request cancellation use Cancel with an explicit cleanup context.RestoreIntent
go
func RestoreIntent(method string, payload json.RawMessage) (Intent, error)text
RestoreIntent restores previously persisted request bytes without replacing
identity or deadlines. Submission remains an explicit caller decision.Bus.Result
go
func (b Bus) Result(ctx context.Context, receipt map[string]any) (any, error)text
Result decodes a successful receipt without modifying its original evidence.Bus.Call
go
func (b Bus) Call(ctx context.Context, request BusRequest, poll time.Duration) (map[string]any, any, error)text
Call submits once, consumes receipts, and decodes the result. Receipt and error
are returned together on terminal failure. Context cancellation stops waiting;
explicit Cancel is required to request remote cancellation.managed_bus.go
包:neomega
签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
"github.com/OmineDev/neomega-sdk-go/bushttp"
)ManagedBus
go
type ManagedBus struct{}text
ManagedBus adapts a Host-managed Worker Peer to the typed Bus used by scopes
and projections. It borrows the peer; each opened Watch must be closed.NewManagedBus
go
func NewManagedBus(peer Caller) *ManagedBusBusError.Code
go
Code stringBusError.CallID
go
CallID stringBusError
go
type BusError struct {
Code string
CallID string
}text
BusError preserves a Host rejection code for errors.Is and reconciliation.BusError.Error
go
func (e *BusError) Error() stringBusError.Unwrap
go
func (e *BusError) Unwrap() errorManagedBus.FreezeOp
go
func (b *ManagedBus) FreezeOp(ctx context.Context, r busapi.CallRequest) (busapi.FrozenOp, error)ManagedBus.Catalog
go
func (b *ManagedBus) Catalog(ctx context.Context) ([]busapi.Entry, error)ManagedBus.Call
go
func (b *ManagedBus) Call(ctx context.Context, r busapi.CallRequest) (result json.RawMessage, callErr error)managed_watch.go
包:neomega
签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"sync"
"time"
"unicode/utf8"
"github.com/OmineDev/neomega-sdk-go/busapi"
)ManagedBus.OpenWatch
go
func (b *ManagedBus) OpenWatch(ctx context.Context, r busapi.WatchRequest) (busapi.Watch, error)peer.go
包:neomega
签名中使用的导入:
go
import (
"bufio"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net"
"os"
"strconv"
"strings"
"sync"
"time"
)ErrClosed
go
var ErrClosed = errors.New("IPC closed")IPCRejected.Code
go
Code stringIPCRejected.RequestID
go
RequestID stringIPCRejected.Retryable
go
Retryable boolIPCRejected
go
type IPCRejected struct {
Code, RequestID string
Retryable bool
}text
IPCRejected is a definite Host rejection. Retryable is metadata, never a
directive to retry an admitted mutation automatically.IPCRejected.Error
go
func (e *IPCRejected) Error() stringFrame.Type
go
Type string `json:"type"`Frame.ID
go
ID string `json:"id,omitempty"`Frame.Method
go
Method string `json:"method,omitempty"`Frame.Payload
go
Payload map[string]any `json:"payload"`Frame
go
type Frame struct {
Type string `json:"type"`
ID string `json:"id,omitempty"`
Method string `json:"method,omitempty"`
Payload map[string]any `json:"payload"`
}Peer
go
type Peer struct {
}text
Peer owns both streams. Their Close methods must unblock outstanding Read and
Write calls. Close and Done join both I/O goroutines; they do not prove that
any remote mutation has finished.NewPeer
go
func NewPeer(reader io.ReadCloser, writer io.WriteCloser) *PeerPeer.Err
go
func (p *Peer) Err() errorPeer.Done
go
func (p *Peer) Done() <-chan struct{}Peer.Close
go
func (p *Peer) Close() errorPeer.Session
go
func (p *Peer) Session() map[string]anyOpen
go
func Open(ctx context.Context) (*Peer, error)text
Open takes the managed transport from the environment. Socket authentication
and hello share one ten-second budget; no connection is retried.Peer.Handshake
go
func (p *Peer) Handshake(ctx context.Context) (map[string]any, error)Peer.Call
go
func (p *Peer) Call(ctx context.Context, method string, payload any) (map[string]any, error)Peer.Respond
go
func (p *Peer) Respond(id string, payload any) errorPeer.Reject
go
func (p *Peer) Reject(id, code string, retryable bool) errorPeer.NextRequest
go
func (p *Peer) NextRequest(ctx context.Context) (Frame, error)Peer.NextEvent
go
func (p *Peer) NextEvent(ctx context.Context) (Frame, error)Peer.NextNotification
go
func (p *Peer) NextNotification(ctx context.Context) (Frame, error)Peer.EventDone
go
func (p *Peer) EventDone()Peer.WaitEvents
go
func (p *Peer) WaitEvents(ctx context.Context) errorscopes/scopes.go
包:scopes
text
Code generated by sdk/go/sync-public.py from pkg/scopes/scopes.go; DO NOT EDIT.
Package scopes provides author-owned logical sessions over the trusted Bus.
A scope coordinates resources; it does not roll back game-world effects.签名中使用的导入:
go
import (
"context"
"crypto/rand"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"reflect"
"sync"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
"github.com/OmineDev/neomega-sdk-go/busvalue"
)Spec
go
type Spec = busapi.ScopeSpecCondition
go
type Condition = busapi.ScopeConditionHandle
go
type Handle = busapi.ScopeHandleInventorySession
go
func InventorySession() stringPositionControl
go
func PositionControl() stringContainerSession
go
func ContainerSession(dimension, x, y, z int32) stringAll
go
func All(resources ...string) []stringTarget.Dimension
go
Dimension int32 `json:"dimension"`Target.Pos
go
Pos [3]float64 `json:"pos"`Target
go
type Target struct {
Dimension int32 `json:"dimension"`
Pos [3]float64 `json:"pos"`
}Near
go
func Near(target Target, distance float64) ConditionClient
go
type Client struct {
}New
go
func New(bus busapi.Client) *ClientNewRemote
go
func NewRemote(ctx context.Context, bus busapi.Client) (*Client, error)text
NewRemote opens an authenticated EP session. The caller owns Close. Losing
heartbeat seals all owned scopes; accepted operations retain their responsibility.Client.Close
go
func (c *Client) Close() errortext
Close joins scope cleanup and closes the EP session. Local clients can use it
to join all manual sessions during module teardown too.Client.Context
go
func (c *Client) Context(ctx context.Context) context.Contexttext
Context carries the Host-issued EP session and preserves an enclosing Scope.
Use Bus for lifecycle-checked calls; retaining this context never changes a
FrozenOp's original session, scope or cause.Client.Bus
go
func (c *Client) Bus() busapi.Clienttext
Bus supplies the normal single-op path, without requiring an explicit Scope.
Cleanup uses the underlying client directly after this author client seals.Panic.Value
go
Value anyPanic.Result
go
Result ResultPanic
go
type Panic struct {
Value any
Result Result
}text
Panic preserves the callback's original panic value and the final cleanup
evidence. Run still panics; recover can inspect Value and Result separately.Panic.Error
go
func (p *Panic) Error() stringPanic.Unwrap
go
func (p *Panic) Unwrap() errorError.RequestID
go
RequestID stringError.Handle
go
Handle HandleError.Err
go
Err errorError
go
type Error struct {
RequestID string
Handle Handle
Err error
}text
Error retains the original grant request, even if the transport lost its reply.Error.Error
go
func (e *Error) Error() stringError.Unwrap
go
func (e *Error) Unwrap() errorResult.Handle
go
Handle HandleResult.BusinessError
go
BusinessError errorResult.CleanupError
go
CleanupError errorResult
go
type Result struct {
Handle Handle
BusinessError error
CleanupError error
}Session
go
type Session struct {
}Session.Context
go
func (s *Session) Context() context.ContextSession.Handle
go
func (s *Session) Handle() HandleClient.Lookup
go
func (c *Client) Lookup(ctx context.Context, requestID string) (Handle, error)Client.Read
go
func (c *Client) Read(ctx context.Context, id string) (Handle, error)Client.Acquire
go
func (c *Client) Acquire(ctx context.Context, spec Spec) (*Session, error)Client.AcquireRequest
go
func (c *Client) AcquireRequest(ctx context.Context, requestID string, spec Spec) (*Session, error)text
AcquireRequest accepts a retained ID for lookup after client restart. It never
retries the callback or substitutes a different ID after an uncertain reply.Session.Close
go
func (s *Session) Close() (Handle, error)text
Close seals admission and waits at most five seconds for the durable drain.
An unfinished Handle retains the authority's actual state and responsibility.Session.Evidence
go
func (s *Session) Evidence(ctx context.Context, resources ...string) (json.RawMessage, error)Client.Run
go
func (c *Client) Run(ctx context.Context, spec Spec, fn func(*Session) error) (result Result, err error)text
Run calls fn exactly once. Both failures and the final cleanup state survive.
A panic still performs Close, then panics with *Panic containing the original
value, final Handle and cleanup error; the callback is never retried.values.go
包:neomega
签名中使用的导入:
go
import (
"bytes"
"encoding/json"
"errors"
"fmt"
"io"
"reflect"
"strconv"
"unicode/utf8"
)MaxValueBytes
go
const MaxValueBytes = 16 << 20DecodeJSON
go
func DecodeJSON(data []byte) (any, error)text
DecodeJSON decodes bounded JSON without losing integer precision. Duplicate
object keys and non-UTF-8 input are rejected rather than silently normalized.EncodeJSON
go
func EncodeJSON(value any) ([]byte, error)text
EncodeJSON retains json.Number values and applies the same bounded value
contract as DecodeJSON. Bus values remain explicit tagged wire values.worker.go
包:neomega
签名中使用的导入:
go
import (
"context"
"encoding/json"
"errors"
"fmt"
"regexp"
"sync"
"time"
"github.com/OmineDev/neomega-sdk-go/busapi"
)Callbacks.Validate
go
Validate func(context.Context, *Peer, map[string]any) (map[string]any, error)Callbacks.Activate
go
Activate func(context.Context, *Peer, map[string]any) errorCallbacks.Drain
go
Drain func(context.Context, *Peer, map[string]any) errorCallbacks.Event
go
Event func(context.Context, *Peer, map[string]any) errorCallbacks.Maintenance
go
Maintenance func(context.Context, *Peer, map[string]any) (map[string]any, error)Callbacks.Bus
go
Bus func(context.Context, *Peer, map[string]any) (any, error)Callbacks.Service
go
Service func(context.Context, *Peer, map[string]any) (map[string]any, error)Callbacks
go
type Callbacks struct {
Validate func(context.Context, *Peer, map[string]any) (map[string]any, error)
Activate func(context.Context, *Peer, map[string]any) error
Drain func(context.Context, *Peer, map[string]any) error
Event func(context.Context, *Peer, map[string]any) error
Maintenance func(context.Context, *Peer, map[string]any) (map[string]any, error)
Bus func(context.Context, *Peer, map[string]any) (any, error)
Service func(context.Context, *Peer, map[string]any) (map[string]any, error)
}text
Callbacks run with cooperative cancellation. Event runs serially and never
acknowledges durable delivery automatically. Bus callbacks may run concurrently.
Activate and Drain are required. Validate may return bus_exports, but Go stream
providers are not supported by this SDK. Maintenance may be omitted.Worker
go
type Worker struct {
}text
Worker owns the peer and all Spawn activities until actual completion. Run is
single-use. Detached goroutines are outside this ownership; uncooperative
callbacks require Host process termination, not an artificial successful drain.NewWorker
go
func NewWorker(peer *Peer, callbacks Callbacks) *WorkerWorker.Spawn
go
func (w *Worker) Spawn(fn func(context.Context) error) errortext
Spawn starts at most 32 owned activities during activation or active delivery.
A non-cancellation error fails Run even if another caller observes that error.Worker.Run
go
func (w *Worker) Run(ctx context.Context) errortext
Run handshakes if needed, serves lifecycle and events, and closes and joins
every owned activity on cancellation or failure. It never replays failed calls.