runtime

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPluginNil               = errors.New("plugin is nil")
	ErrPluginTypeEmpty         = errors.New("plugin type is empty")
	ErrPluginAlreadyRegistered = errors.New("plugin already registered")
	ErrPluginNotFound          = errors.New("plugin not found")
)

Functions

This section is empty.

Types

type ClientBuildInput

type ClientBuildInput struct {
	Data       *conf.Data
	Trace      *conf.Trace
	Discovery  registry.Discovery
	Logger     log.Logger
	Middleware []middleware.Middleware
}

ClientBuildInput 为 client 插件提供标准输入。

type ClientDialInput added in v0.2.2

type ClientDialInput struct {
	Protocol string
	Target   string
}

ClientDialInput 定义 client 连接建立时的统一输入。

type ClientFactory

type ClientFactory interface {
	Dial(ctx context.Context, in ClientDialInput) (Connection, error)
}

ClientFactory 定义按 DialInput 建立连接的运行时工厂。

type ClientNode

type ClientNode struct {
	Type  string
	Input ClientBuildInput
}

ClientNode 描述一个待构建的 client 节点。

type ClientPlugin

type ClientPlugin interface {
	Type() string
	Build(ctx context.Context, in ClientBuildInput) (ClientFactory, error)
}

ClientPlugin 定义 client 协议插件构建接口。

type Connection

type Connection interface {
	Value() any
	Close() error
	IsHealthy() bool
}

Connection 定义 transport client 连接的最小运行时契约。

type Graph

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

Graph 基于 registry 进行 transport 运行时编排。

func NewGraph

func NewGraph(r *Registry) *Graph

func (*Graph) Build

func (g *Graph) Build(ctx context.Context, in GraphInput) (GraphOutput, error)

type GraphInput

type GraphInput struct {
	Servers []ServerNode
	Clients []ClientNode
}

GraphInput 为 runtime graph 的统一输入。

type GraphOutput

type GraphOutput struct {
	Servers map[string]Server
	Clients map[string]ClientFactory
}

GraphOutput 为 runtime graph 的统一输出。

type Registry

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

Registry 维护 client/server 插件注册表。

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Client

func (r *Registry) Client(typ string) (ClientPlugin, bool)

func (*Registry) RegisterClient

func (r *Registry) RegisterClient(p ClientPlugin) error

func (*Registry) RegisterServer

func (r *Registry) RegisterServer(p ServerPlugin) error

func (*Registry) Server

func (r *Registry) Server(typ string) (ServerPlugin, bool)

type Server

type Server interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Endpoint() (*url.URL, error)
}

Server 定义 transport server 的最小运行时契约。

type ServerBuildInput

type ServerBuildInput struct {
	Config      any
	Logger      log.Logger
	Middleware  []middleware.Middleware
	Registrars  []any
	ExtraValues map[string]any
}

ServerBuildInput 为 server 插件提供标准输入。

type ServerNode

type ServerNode struct {
	Type  string
	Input ServerBuildInput
}

ServerNode 描述一个待构建的 server 节点。

type ServerPlugin

type ServerPlugin interface {
	Type() string
	Build(ctx context.Context, in ServerBuildInput) (Server, error)
}

ServerPlugin 定义 server 协议插件构建接口。

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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