controlnotify

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

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

Documentation

Overview

本文件通过内部上下文区分长连接连续性检查与普通 HTTP 权威授权,不扩张公共认证 API。

本文件使用 Core NATS 非 queue 广播,并拒绝 JetStream 捕获内部通知主题。

本文件使用 Redis 原生广播;不创建 Stream、消费组或历史数据键。

Package controlnotify 只承载 Core 可由权威状态恢复的内部瞬时通知,不承载业务事实。

Index

Constants

This section is empty.

Variables

View Source
var ErrUnavailable = errors.New("internal notification channel unavailable")

ErrUnavailable 表示通知连续性无法确认,调用者必须保护状态并重新同步权威。

Functions

func WithAuthSession

func WithAuthSession(ctx context.Context, state *AuthSessionState) context.Context

WithAuthSession 仅供 Core WebSocket 会话层标记需要连续性保护的权威检查。

Types

type AuthSessionState

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

AuthSessionState 保存一次 WebSocket 登录捕获的通知代次,可供登录、订阅和周期检查共用。

func AuthSession

func AuthSession(ctx context.Context) *AuthSessionState

AuthSession 返回内部会话标记;普通 HTTP 请求不含该值。

func (*AuthSessionState) Accept

func (s *AuthSessionState) Accept(epoch uint64, ready bool) bool

Accept 只接受首次健康连接或同一健康代次;跨断线恢复不能重新认可旧会话。

func (*AuthSessionState) Active

func (s *AuthSessionState) Active() bool

Active 报告授权管理器是否为此会话启用了共享通知连续性保护。

type Transport

type Transport interface {
	Publish(context.Context, []byte) error
	Receive(context.Context) ([]byte, error)
	Close() error
}

Transport 是框架内部的单主题广播连接;Receive 只允许单个读取者。 接收失败后不得继续使用旧连接宣告健康,应关闭并重新建立后执行权威对账。

func Open

func Open(ctx context.Context, cfg config.MQConfig, service, kind string) (Transport, error)

Open 订阅一个框架内置通知主题;ctx 只约束初始化,不拥有连接生命周期。

Jump to

Keyboard shortcuts

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