commands

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ACLCommand added in v0.1.0

type ACLCommand struct {
	CommandString
}

func (*ACLCommand) GetNext added in v0.1.0

func (c *ACLCommand) GetNext() (Command, error)

type ACLGrantCommand added in v0.1.0

type ACLGrantCommand struct {
	ACLCommand
}

ACLGrantCommand handles ACL GRANT <principal> <table> <key>

func (*ACLGrantCommand) Execute added in v0.1.0

func (c *ACLGrantCommand) Execute(ctx context.Context) ([]byte, error)

func (*ACLGrantCommand) GetNext added in v0.1.0

func (c *ACLGrantCommand) GetNext() (Command, error)

type ACLRevokeCommand added in v0.1.0

type ACLRevokeCommand struct {
	ACLCommand
}

ACLRevokeCommand handles ACL REVOKE <principal> <table> <key>

func (*ACLRevokeCommand) Execute added in v0.1.0

func (c *ACLRevokeCommand) Execute(ctx context.Context) ([]byte, error)

func (*ACLRevokeCommand) GetNext added in v0.1.0

func (c *ACLRevokeCommand) GetNext() (Command, error)

type Command

type Command interface {
	CheckMinLen(expected int) error
	CheckExactLen(expected int) error
	SelectCommand(k int) string
	SelectNormalizedCommand(k int) (string, bool)
	ReplaceCommand(original, new string) Command
	NormalizeName(string) string
	RemoveAfter(k int) Command
	Normalized() string
	Raw() string
	String() string
	GetNext() (Command, error)
	Execute(ctx context.Context) ([]byte, error)
}

type CommandString

type CommandString struct {
	// contains filtered or unexported fields
}
var EmptyCommandString *CommandString = CommandFromString("")

EmptyCommandString is an empty CommandString

func CommandFromString

func CommandFromString(command string) *CommandString

CommandFromString creates a CommandString from a string, normalizing it while still allowing access to the raw command. Supports optional request ID prefix: [ID:123] COMMAND

func (*CommandString) CheckExactLen

func (c *CommandString) CheckExactLen(expected int) error

CheckExactLen checks if the command has exactly expected arguments

func (*CommandString) CheckMinLen

func (c *CommandString) CheckMinLen(expected int) error

CheckMinLen checks if the command has at least expected arguments

func (*CommandString) Execute added in v0.1.0

func (c *CommandString) Execute(ctx context.Context) ([]byte, error)

func (*CommandString) From

func (c *CommandString) From(start int) *SqlCommand

From returns a new SqlCommand with the first n commands removed.

func (*CommandString) GetBinaryData added in v0.1.0

func (c *CommandString) GetBinaryData() []byte

GetBinaryData returns the binary data attached to this command.

func (*CommandString) GetNext added in v0.1.0

func (c *CommandString) GetNext() (Command, error)

func (*CommandString) GetRequestID added in v0.1.0

func (c *CommandString) GetRequestID() string

GetRequestID returns the request ID attached to this command.

func (*CommandString) HasRequestID added in v0.1.0

func (c *CommandString) HasRequestID() bool

HasRequestID returns true if this command has a request ID.

func (*CommandString) NormalizeName

func (c *CommandString) NormalizeName(name string) string

func (*CommandString) Normalized

func (c *CommandString) Normalized() string

func (*CommandString) NormalizedLen

func (c *CommandString) NormalizedLen() int

NormalizedLen returns the number of parts in the normalized command.

func (*CommandString) Raw

func (c *CommandString) Raw() string

func (*CommandString) RemoveAfter

func (c *CommandString) RemoveAfter(k int) Command

RemoveAfter returns a new CommandString with the last k commands removed.

func (*CommandString) ReplaceCommand

func (c *CommandString) ReplaceCommand(original, new string) Command

ReplaceCommand returns the raw command with the first occurrence of the original command replaced by the new command.

func (*CommandString) SelectCommand

func (c *CommandString) SelectCommand(k int) string

SelectCommand returns the kth command from the raw command.

func (*CommandString) SelectNormalizedCommand

func (c *CommandString) SelectNormalizedCommand(k int) (part string, ok bool)

SelectNormalizedCommand returns the kth command from the normalized command.

func (*CommandString) SetBinaryData added in v0.1.0

func (c *CommandString) SetBinaryData(data []byte)

SetBinaryData attaches binary data to this command (used for BLOB commands).

func (*CommandString) SetRequestID added in v0.1.0

func (c *CommandString) SetRequestID(id string)

SetRequestID sets the request ID for this command (used for async processing).

func (*CommandString) String

func (c *CommandString) String() string

type CountCommand added in v0.1.0

type CountCommand struct{ CommandString }

func (*CountCommand) Execute added in v0.1.0

func (c *CountCommand) Execute(ctx context.Context) ([]byte, error)

func (*CountCommand) GetNext added in v0.1.0

func (c *CountCommand) GetNext() (Command, error)

type KeyBlobGetCommand added in v0.1.0

type KeyBlobGetCommand struct {
	KeyCommand
}

func (*KeyBlobGetCommand) Execute added in v0.1.0

func (k *KeyBlobGetCommand) Execute(ctx context.Context) ([]byte, error)

func (*KeyBlobGetCommand) GetNext added in v0.1.0

func (k *KeyBlobGetCommand) GetNext() (Command, error)

type KeyBlobSetCommand added in v0.1.0

type KeyBlobSetCommand struct {
	KeyCommand
}

func (*KeyBlobSetCommand) Execute added in v0.1.0

func (k *KeyBlobSetCommand) Execute(ctx context.Context) ([]byte, error)

func (*KeyBlobSetCommand) GetNext added in v0.1.0

func (k *KeyBlobSetCommand) GetNext() (Command, error)

type KeyCommand added in v0.1.0

type KeyCommand struct {
	CommandString
}

func (*KeyCommand) FromKey added in v0.1.0

func (c *KeyCommand) FromKey(key string) []byte

func (*KeyCommand) GetKey added in v0.1.0

func (c *KeyCommand) GetKey() *KeyGetCommand

func (*KeyCommand) GetNext added in v0.1.0

func (c *KeyCommand) GetNext() (Command, error)

type KeyDelCommand added in v0.1.0

type KeyDelCommand struct {
	KeyCommand
}

func (*KeyDelCommand) Execute added in v0.1.0

func (k *KeyDelCommand) Execute(ctx context.Context) ([]byte, error)

func (*KeyDelCommand) GetNext added in v0.1.0

func (k *KeyDelCommand) GetNext() (Command, error)

type KeyGetCommand added in v0.1.0

type KeyGetCommand struct {
	KeyCommand
}

func (*KeyGetCommand) Execute added in v0.1.0

func (k *KeyGetCommand) Execute(ctx context.Context) ([]byte, error)

func (*KeyGetCommand) GetNext added in v0.1.0

func (k *KeyGetCommand) GetNext() (Command, error)

type KeyPutCommand added in v0.1.0

type KeyPutCommand struct {
	KeyCommand
}

func (*KeyPutCommand) Execute added in v0.1.0

func (k *KeyPutCommand) Execute(ctx context.Context) ([]byte, error)

func (*KeyPutCommand) GetNext added in v0.1.0

func (k *KeyPutCommand) GetNext() (Command, error)

func (*KeyPutCommand) Parse added in v0.1.0

func (k *KeyPutCommand) Parse() (*KeyPutParsed, error)

Parse extracts arguments for KEY PUT without performing any side effects. It intentionally treats a bare "WORM" token followed by no TTL/EXPIRES as part of the value.

type KeyPutParsed added in v0.1.0

type KeyPutParsed struct {
	Key       string
	Principal string
	WormTTL   *time.Duration
	WormExp   *time.Time
	Value     []byte
}

KeyPutParsed holds the parsed components of a KEY PUT command.

type NodeCommand added in v0.1.0

type NodeCommand struct{ CommandString }

func (*NodeCommand) GetNext added in v0.1.0

func (c *NodeCommand) GetNext() (Command, error)

type NodeInfoCommand added in v0.1.0

type NodeInfoCommand struct{ NodeCommand }

NodeInfoCommand shows details for a node

func (*NodeInfoCommand) Execute added in v0.1.0

func (n *NodeInfoCommand) Execute(ctx context.Context) ([]byte, error)

func (*NodeInfoCommand) GetNext added in v0.1.0

func (n *NodeInfoCommand) GetNext() (Command, error)

type NodeListCommand added in v0.1.0

type NodeListCommand struct{ NodeCommand }

NodeListCommand lists active nodes known to the repository

func (*NodeListCommand) Execute added in v0.1.0

func (n *NodeListCommand) Execute(ctx context.Context) ([]byte, error)

func (*NodeListCommand) GetNext added in v0.1.0

func (n *NodeListCommand) GetNext() (Command, error)

type NodePingCommand added in v0.1.0

type NodePingCommand struct{ NodeCommand }

NodePingCommand pings a node and reports RTT

func (*NodePingCommand) Execute added in v0.1.0

func (n *NodePingCommand) Execute(ctx context.Context) ([]byte, error)

func (*NodePingCommand) GetNext added in v0.1.0

func (n *NodePingCommand) GetNext() (Command, error)

type QuorumCommand added in v0.1.0

type QuorumCommand struct{ CommandString }

func (*QuorumCommand) GetNext added in v0.1.0

func (c *QuorumCommand) GetNext() (Command, error)

type QuorumInfoCommand added in v0.1.0

type QuorumInfoCommand struct{ QuorumCommand }

func (*QuorumInfoCommand) Execute added in v0.1.0

func (q *QuorumInfoCommand) Execute(ctx context.Context) ([]byte, error)

func (*QuorumInfoCommand) GetNext added in v0.1.0

func (q *QuorumInfoCommand) GetNext() (Command, error)

type SampleCommand added in v0.1.0

type SampleCommand struct{ CommandString }

func (*SampleCommand) Execute added in v0.1.0

func (s *SampleCommand) Execute(ctx context.Context) ([]byte, error)

func (*SampleCommand) GetNext added in v0.1.0

func (s *SampleCommand) GetNext() (Command, error)

type ScanCommand added in v0.1.0

type ScanCommand struct{ CommandString }

func (*ScanCommand) Execute added in v0.1.0

func (s *ScanCommand) Execute(ctx context.Context) ([]byte, error)

func (*ScanCommand) GetNext added in v0.1.0

func (s *ScanCommand) GetNext() (Command, error)

type SqlCommand

type SqlCommand struct {
	CommandString
}

Jump to

Keyboard shortcuts

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