server

package
v0.0.0-...-20522ef Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 62 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FollowHost      = "follow_host"
	FollowPort      = "follow_port"
	FollowID        = "follow_id"
	FollowPos       = "follow_pos"
	ReplicaPriority = "replica-priority"
	ServerID        = "server_id"
	ReadOnly        = "read_only"
	RequirePass     = "requirepass"
	LeaderAuth      = "leaderauth"
	ProtectedMode   = "protected-mode"
	MaxMemory       = "maxmemory"
	AutoGC          = "autogc"
	KeepAlive       = "keepalive"
	LogConfig       = "logconfig"
	AnnounceIP      = "replica_announce_ip"
	AnnouncePort    = "replica_announce_port"
)

Config keys

Variables

View Source
var NOMessage = resp.SimpleStringValue("")

NOMessage is no message

Functions

func ConvertToJSON

func ConvertToJSON(val lua.LValue) string

ConvertToJSON converts lua LValue to JSON string

func ConvertToLua

func ConvertToLua(L *lua.LState, val resp.Value) lua.LValue

ConvertToLua converts RESP value to lua LValue

func ConvertToRESP

func ConvertToRESP(val lua.LValue) resp.Value

ConvertToRESP convert lua LValue to RESP value

func Default

func Default[T comparable](a, b T) T

func FenceMatch

func FenceMatch(hookName string, sw *scanWriter, fence *liveFenceSwitches, metas []FenceMeta, details *commandDetails) []string

FenceMatch executes a fence match returns back json messages for fence detection.

func Must

func Must[T any](a T, err error) T

func OKMessage

func OKMessage(msg *Message, start time.Time) resp.Value

OKMessage returns a default OK message in JSON or RESP.

func Serve

func Serve(opts Options) error

Serve starts a new tile38 server

func Sha1Sum

func Sha1Sum(s string) string

Sha1Sum returns a string with hex representation of sha1 sum of a given string

func WriteWebSocketMessage

func WriteWebSocketMessage(w io.Writer, data []byte) error

WriteWebSocketMessage write a websocket message to an io.Writer.

Types

type BinaryOp

type BinaryOp byte

BinaryOp represents various operators for expressions

const (
	NOOP BinaryOp = iota
	AND
	OR
)

expression operator enum

type Client

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

Client is an remote connection into to Tile38

func (*Client) Write

func (client *Client) Write(b []byte) (n int, err error)

Write ...

type Config

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

Config is a tile38 config

type FenceMeta

type FenceMeta struct {
	Name, Value string
}

FenceMeta is a meta key/value pair for fences

type Hook

type Hook struct {
	Key        string
	Name       string
	Endpoints  []string
	Message    *Message
	Fence      *liveFenceSwitches
	ScanWriter *scanWriter
	Metas      []FenceMeta
	// contains filtered or unexported fields
}

Hook represents a hook.

func (*Hook) Close

func (h *Hook) Close()

Close closed the hook and stop the manager function

func (*Hook) Equals

func (h *Hook) Equals(hook *Hook) bool

Equals returns true if two hooks are equal

func (*Hook) Expires

func (h *Hook) Expires() time.Time

Expires returns when the hook expires. Required by the expire.Item interface.

func (*Hook) Open

func (h *Hook) Open()

Open is called when a hook is first created. It calls the manager function in a goroutine

func (*Hook) Signal

func (h *Hook) Signal()

Signal can be called at any point to wake up the hook and notify the manager that there may be something new in the queue.

type InputStream

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

InputStream is a helper type for managing input streams from inside the Data event.

func (*InputStream) Begin

func (is *InputStream) Begin(packet []byte) (data []byte)

Begin accepts a new packet and returns a working sequence of unprocessed bytes.

func (*InputStream) End

func (is *InputStream) End(data []byte)

End shifts the stream to match the unprocessed data.

type LegacyAOFReader

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

LegacyAOFReader represents the older AOF file reader.

func NewLegacyAOFReader

func NewLegacyAOFReader(r io.Reader) *LegacyAOFReader

NewLegacyAOFReader creates a new LegacyAOFReader.

func (*LegacyAOFReader) ReadCommand

func (rd *LegacyAOFReader) ReadCommand() ([]byte, error)

ReadCommand reads an old command.

type Message

type Message struct {
	Args       []string
	ConnType   Type
	OutputType Type
	Auth       string
	Deadline   *deadline.Deadline
	// contains filtered or unexported fields
}

Message is a resp message

func (*Message) Command

func (msg *Message) Command() string

Command returns the first argument as a lowercase string

type Options

type Options struct {
	Host           string
	Port           int
	Dir            string
	UseHTTP        bool
	MetricsAddr    string
	UnixSocketPath string // path for unix socket

	// DevMode puts application in to dev mode
	DevMode bool

	// ShowDebugMessages allows for log.Debug to print to console.
	ShowDebugMessages bool

	// ProtectedMode forces Tile38 to default in protected mode.
	ProtectedMode string

	// AppendOnly allows for disabling the appendonly file.
	AppendOnly bool

	// AppendFileName allows for custom appendonly file path
	AppendFileName string

	// QueueFileName allows for custom queue.db file path
	QueueFileName string

	// Shutdown allows for shutting down the server.
	Shutdown <-chan bool
}

Options for Serve()

type PipelineReader

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

PipelineReader ...

func NewPipelineReader

func NewPipelineReader(rd io.ReadWriter) *PipelineReader

NewPipelineReader ...

func (*PipelineReader) ReadMessages

func (rd *PipelineReader) ReadMessages() ([]*Message, error)

ReadMessages ...

type RESPConn

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

RESPConn represents a simple resp connection.

func DialTimeout

func DialTimeout(address string, timeout time.Duration) (*RESPConn, error)

DialTimeout dials a resp

func (*RESPConn) Close

func (conn *RESPConn) Close() error

Close closes the connection.

func (*RESPConn) Do

func (conn *RESPConn) Do(commandName string, args ...interface{}) (
	val resp.Value, err error,
)

Do performs a command and returns a resp value.

type ScanWriterParams

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

type Server

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

Server is a tile38 controller

func (*Server) Collect

func (s *Server) Collect(ch chan<- prometheus.Metric)

func (*Server) Describe

func (s *Server) Describe(ch chan<- *prometheus.Desc)

func (*Server) MetricsHandler

func (s *Server) MetricsHandler(w http.ResponseWriter, r *http.Request)

func (*Server) MetricsIndexHandler

func (s *Server) MetricsIndexHandler(w http.ResponseWriter, r *http.Request)

func (*Server) Publish

func (s *Server) Publish(channel string, message ...string) int

Publish a message to subscribers

type Type

type Type byte

Type is resp type

const (
	Null Type = iota
	RESP
	Telnet
	Native
	HTTP
	WebSocket
	JSON
)

Protocol Types

Jump to

Keyboard shortcuts

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