server

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: BSD-2-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DatabaseLabel = "database"
	CommandLabel  = "cmd"
)

Functions

func AppendResponse added in v0.2.0

func AppendResponse(a proto.AppendRequest, db *database.Database) proto.Message

func CreateResponse added in v0.2.0

func CreateResponse(c proto.CreateTopicRequest, db *database.Database) proto.Message

func ListResponse added in v0.2.0

func ListResponse(l proto.ListRequest, db *database.Database, dbMap map[string]*database.Database) proto.Message

func NewDBStatsCollector added in v0.2.0

func NewDBStatsCollector(db *database.Database) prometheus.Collector

func QueryResponse added in v0.2.0

func QueryResponse(q proto.QueryRequest, db *database.Database) proto.Message

func VersionResponse added in v0.2.0

func VersionResponse(_ proto.VersionRequest) proto.Message

Types

type DatabaseConfig

type DatabaseConfig struct {
	Name      string
	Directory string
}

type MapMux

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

func (*MapMux) Handle

func (mm *MapMux) Handle(s string, f MessageHandler)

func (*MapMux) HandleState

func (mm *MapMux) HandleState(s string, f MessageStateHandler)

func (*MapMux) ServeMessage

func (mm *MapMux) ServeMessage(c *conn, r *proto.Request)

type MessageHandler

type MessageHandler func(proto.ResponseWriter, *proto.Request)

type MessageMux

type MessageMux interface {
	ServeMessage(c *conn, r *proto.Request)
	Handle(s string, f MessageHandler)
	HandleState(s string, f MessageStateHandler)
}

func NewMapMux

func NewMapMux() MessageMux

type MessageServer

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

func NewMessageServer

func NewMessageServer(log zerolog.Logger, metricsStore MetricsStore) MessageServer

func (*MessageServer) ListenAndServe

func (ms *MessageServer) ListenAndServe(port int, mux MessageMux) error

type MessageStateHandler

type MessageStateHandler func(proto.ResponseWriter, *conn, *proto.Request)

type MetricsStore

type MetricsStore interface {
	Registry() *prometheus.Registry
	RegisterCollector(c prometheus.Collector)
	Handler() http.Handler

	// Collection
	IncClientConnection()
	IncRequests(db, cmd string)
	ObserveResponseNS(db, cmd string, t int64)
}

func NewMetricsStore

func NewMetricsStore() MetricsStore

type Server

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

func New

func New(log zerolog.Logger, dbConfigs map[string]DatabaseConfig, port, metricsPort int) Server

func (*Server) HandleAppend

func (s *Server) HandleAppend(rw proto.ResponseWriter, r *proto.Request)

func (*Server) HandleCreate added in v0.2.0

func (s *Server) HandleCreate(rw proto.ResponseWriter, r *proto.Request)

func (*Server) HandleList

func (s *Server) HandleList(rw proto.ResponseWriter, r *proto.Request)

func (*Server) HandleQuery

func (s *Server) HandleQuery(rw proto.ResponseWriter, r *proto.Request)

func (*Server) HandleStats

func (s *Server) HandleStats(rw proto.ResponseWriter, r *proto.Request)

func (*Server) HandleUse

func (s *Server) HandleUse(rw proto.ResponseWriter, c *conn, r *proto.Request)

func (*Server) HandleVersion

func (s *Server) HandleVersion(rw proto.ResponseWriter, r *proto.Request)

func (*Server) ServeDatabase

func (s *Server) ServeDatabase()

func (*Server) ServeMetrics

func (s *Server) ServeMetrics()

Jump to

Keyboard shortcuts

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