switchsdk

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package switchsdk 把 Switch SDK 适配为 flowlink-plan 的 SwitchResolver。

plan 根包只认识 SwitchResolver 抽象;业务服务可以像 Switch demo 一样启动 SDK, 再把 NewResolver 返回的解析器传给 plan.Configure 或 plan.NewRuntime。

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSDKNotInitialized 表示 Switch SDK 尚未完成初始化。
	ErrSDKNotInitialized = errors.New("switch sdk is not initialized")
	// ErrRuleNotFound 表示本地规则缓存中不存在指定开关。
	ErrRuleNotFound = errors.New("switch rule not found")
)

Functions

func NewResolver

func NewResolver() plan.SwitchResolver

NewResolver 返回一个基于 Switch SDK 全局规则缓存的解析器。

调用方需要先按 Switch SDK 约定启动同步;未启动或规则不存在时会返回错误。

func Shutdown

func Shutdown()

Shutdown 关闭 Switch SDK 并清理本地规则缓存。

func Start

func Start(ctx context.Context, options StartOptions) (plan.SwitchResolver, error)

Start 按 Switch demo 的方式启动 SDK,并返回可传给 FlowLink 的 resolver。

Types

type StartOptions

type StartOptions struct {
	Domain       string
	NamespaceTag string
	EnvTag       string
	ServiceName  string
	Version      string
}

StartOptions 是使用 FlowLink 帮忙启动 Switch SDK 时需要的最小配置。

Jump to

Keyboard shortcuts

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