server

package
v0.0.0-...-38a4c7e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: Apache-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command struct {
	Cmd   string
	Key   string
	Value []byte
}

Command struct

type Server

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

Server is the main server struct.

var ServerInstance Server

ServerInstance is the main server instance.

func (*Server) AddNode

func (s *Server) AddNode(c Command, fromClient bool) error

AddNode is a function that adds a node to the nodes list.

func (*Server) ClientHandler

func (s *Server) ClientHandler(conn net.Conn)

ServerHandler is the main server handler.

func (*Server) ConnController

func (s *Server) ConnController()

ConnController is the main connections controller.

func (*Server) Del

func (s *Server) Del(c Command) error

Delete is a function that deletes a key-value pair from the server.

func (*Server) DelNode

func (s *Server) DelNode(c Command) error

DelNode is a function that deletes a node from the server.

func (*Server) Get

func (s *Server) Get(c Command) ([]byte, error)

Get is a function that gets a value by key from the server.

func (*Server) GetCmd

func (s *Server) GetCmd(conn net.Conn) (Command, error)

GetCmd reads and parses command from client connection.

func (*Server) Info

func (s *Server) Info() (string, error)

Info is a function that retunrs server info.

func (*Server) Init

func (s *Server) Init(args argparse.Args) error

init is a function that initializes the server.

func (*Server) Listen

func (s *Server) Listen() (listenerClient net.Listener, listenerServer net.Listener)

Listen returns listeners for client/server connections.

func (*Server) MemController

func (s *Server) MemController()

MemController is a function that controls the memory usage of the server.

func (*Server) Serve

func (s *Server) Serve()

Serve starts the server.

func (*Server) ServeClient

func (s *Server) ServeClient()

ServeClient starts the client connection handler loop.

func (*Server) ServeServer

func (s *Server) ServeServer()

ServeServer starts the server connection handler loop.

func (*Server) ServerHandler

func (s *Server) ServerHandler(conn net.Conn)

ServerHandler is the main server handler.

func (*Server) Set

func (s *Server) Set(c Command) error

Set is a function that sets a key-value pair in the server.

func (*Server) SetInNodes

func (s *Server) SetInNodes(c Command) error

SetInNodes is a function that sets a key-pair to nodes.

func (*Server) SetKey

func (s *Server) SetKey(key string, value int64) error

setkey is a function that sets a value by key in the server.

func (*Server) SetReplicas

func (s *Server) SetReplicas(c Command) error

SetReplicas is a function that sets replicas number in a server

func (*Server) SetupArgs

func (s *Server) SetupArgs(args argparse.Args)

Setup the server args.

Jump to

Keyboard shortcuts

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