dispatch

package
v1.0.63 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractJSONArgument

func ExtractJSONArgument(args []string, jsonIndex int) (string, bool)

ExtractJSONArgument extracts a json argument.

Types

type ConcurrencyReleaseStore added in v1.0.63

type ConcurrencyReleaseStore interface {
	ApplyConcurrencyRelease(context.Context, cluster.ConcurrencyReleaseRequest) error
}

ConcurrencyReleaseStore atomically applies cumulative credential concurrency releases.

type ConnEnv

type ConnEnv struct {
	SubscribeConfigYAML            func() (int64, error)
	UnsubscribeConfigYAML          func() (int64, error)
	IsSubscribed                   func() bool
	SubscribeMembership            func(context.Context, int, int64) (cluster.ConnectionLifetime, error)
	AttachSubscriptionLifetimeFunc func(cluster.ConnectionLifetime) error
	FenceFingerprint               func(context.Context, string) error
	CloseLocalFingerprint          func()
	PrepareDispatchReply           func() error
	AccountedReplyFailure          func() error
	// contains filtered or unexported fields
}

func (*ConnEnv) AttachSubscriptionLifetime added in v1.0.63

func (e *ConnEnv) AttachSubscriptionLifetime(lifetime cluster.ConnectionLifetime) error

AttachSubscriptionLifetime records the lifetime attached to a subscription socket.

func (*ConnEnv) SubscriptionLifetime added in v1.0.63

func (e *ConnEnv) SubscriptionLifetime() (cluster.ConnectionLifetime, bool)

SubscriptionLifetime returns the attached subscription lifetime, when present.

type Env

type Env struct {
	Runtime *home.Runtime
	Conn    *ConnEnv

	// InFlightStore persists in-flight observation frames.
	InFlightStore InFlightSnapshotStore

	// InFlightLimits bounds the in-flight observation frame accepted by InFlightStore.
	InFlightLimits cluster.InFlightLimits

	// ConcurrencyReleaseStore applies cumulative limiter releases from this connection.
	ConcurrencyReleaseStore ConcurrencyReleaseStore

	// ClientIP is the remote TCP client's IP address as resolved by the RESP server.
	// It can be empty when the address cannot be resolved.
	ClientIP string

	// NodeID is the mTLS client certificate common name when available.
	// It can be empty in unit tests or unauthenticated contexts.
	NodeID string

	// ClientCertificateFingerprint is the SHA-256 fingerprint of the mTLS leaf certificate.
	ClientCertificateFingerprint string

	// ConnectionLifetime is fixed when the connection is accepted and cannot be
	// upgraded by a subscription performed on the same socket. Its fingerprint and
	// connected time are the only in-flight snapshot ownership identity.
	ConnectionLifetime cluster.ConnectionLifetime
}

type Handler

type Handler func(ctx context.Context, env Env, args []string) Reply

type InFlightSnapshotStore added in v1.0.63

type InFlightSnapshotStore interface {
	IngestInFlightFrame(context.Context, cluster.InFlightIngestIdentity, []byte, cluster.InFlightLimits) (cluster.InFlightIngestResult, error)
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new registry.

func (*Registry) Execute

func (r *Registry) Execute(ctx context.Context, env Env, args []string) Reply

Execute handles an execute.

func (*Registry) RegisterDirect

func (r *Registry) RegisterDirect(command string, key string, handler Handler) error

RegisterDirect handles a register direct.

func (*Registry) RegisterDynamic

func (r *Registry) RegisterDynamic(command string, typeValue string, handler Handler) error

RegisterDynamic handles a register dynamic.

func (*Registry) SetDirectDefault

func (r *Registry) SetDirectDefault(command string, handler Handler) error

SetDirectDefault sets a direct default.

func (*Registry) SetDynamicDefault

func (r *Registry) SetDynamicDefault(command string, handler Handler) error

SetDynamicDefault sets a dynamic default.

type Reply

type Reply struct {
	Kind ReplyKind

	// SubscriptionLifetime is server-only metadata and is never serialized.
	SubscriptionLifetime *cluster.ConnectionLifetime

	SimpleString       string
	BulkString         []byte
	RedisError         string
	Integer            int64
	Array              []Reply
	Sensitive          bool
	AccountedAdmission bool
	PreWriteError      error
}

func Array

func Array(elements ...Reply) Reply

Array builds a dispatch reply.

func BulkString

func BulkString(payload []byte) Reply

BulkString builds a dispatch reply.

func Err

func Err(message string) Reply

Err builds a dispatch reply.

func Integer

func Integer(value int64) Reply

Integer builds a dispatch reply.

func RedisError

func RedisError(message string) Reply

RedisError builds a dispatch reply.

func SensitiveBulkString added in v1.0.63

func SensitiveBulkString(payload []byte) Reply

func SimpleString

func SimpleString(value string) Reply

SimpleString builds a dispatch reply.

func (*Reply) ClearSensitive added in v1.0.63

func (r *Reply) ClearSensitive()

type ReplyKind

type ReplyKind int
const (
	ReplyKindSimpleString ReplyKind = iota
	ReplyKindBulkString
	ReplyKindRedisError
	ReplyKindInteger
	ReplyKindArray
)

Jump to

Keyboard shortcuts

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