command

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package command Tellstone Shared Command Layer File: command.go Description: The data-command core shared by both frontends (binary and RESP). GET, SET and DEL live here exactly once: argument validation, optional EX/PX TTL parsing, the RBAC gate, the per-role command count, the audit hooks and the storage access. Each protocol only supplies Reply and its own calling conventions;

Authors:

Maximilian Hagen

Package command Tellstone Shared Command Layer File: handlers.go Description: The GET, SET and DEL handlers, plus the EX/PX TTL parser moved out of the RESP frontend. These are the single source of truth for data-command semantics; the binary and RESP frontends call Execute and encode the reply through Reply.

Authors:

Maximilian Hagen

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(c *Ctx) bool

Execute runs one data command end to end. The reply is written through a ReplyMethod

Types

type Command

type Command struct {
	Name    string
	RbacID  uint16
	Arity   int
	Keys    func([][]byte) [][]byte
	Handler func(*Ctx)
}

Command describes one data command: the minimum argument count

which arguments are keys for the gate, and what to execute.

func Lookup

func Lookup(name []byte) *Command

Lookup returns the command which matches the name or nil if not found

type Ctx

type Ctx struct {
	Store    Store
	Args     [][]byte
	Reply    Reply
	TTL      time.Duration
	Policy   *rbac.Store
	Session  *rbac.SessionContext
	Remote   string
	Protocol string
	Audit    *audit.LogEngine
	Logger   log.Logger
}

Ctx is built for one request. Pool the Ctx per connection

type Reply

type Reply interface {
	OK()
	Bulk(b []byte)
	Null()
	Int(n int64)
	Denied(cmd string)
	ErrorMsg(s string)
	StorageErr(err error)
}

Reply is the transport-specific wire encoder. A handler calls exactly one method per request

type Store

type Store interface {
	Get(key string) ([]byte, bool)
	Set(key string, value []byte, ttl time.Duration) error
	Delete(key string) bool
}

Store is the storage seam every handler writes to

Jump to

Keyboard shortcuts

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