core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// ListenCommand listens the input from terminal and executes the command.
	ListenCommand() error
	// Close closes the tcp connection to the database server.
	Close() error
}

Client defines the related functions of the database server.

func NewCli

func NewCli(config *ClientConfig) (Client, error)

NewCli creates a single-client of KhighDB.

type ClientConfig

type ClientConfig struct {
	Addr        string
	EnableRetry bool
	RetryTimes  int
}

ClientConfig defines the structure of the client configuration.

type KhighClient

type KhighClient struct {
	Signal chan os.Signal
	// contains filtered or unexported fields
}

KhighClient defines the structure of the KhighDB client.

func (*KhighClient) Close

func (client *KhighClient) Close() error

Close closes the tcp connection to KhighServer.

func (*KhighClient) ListenCommand

func (client *KhighClient) ListenCommand() error

ListenCommand listens the input from terminal and executes the command.

type KhighServer

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

KhighServer defines the structure of the KhighDB server.

func (*KhighServer) GetSignal

func (server *KhighServer) GetSignal() chan os.Signal

GetSignal returns the KhighServer's signal channel.

func (*KhighServer) Listen

func (server *KhighServer) Listen()

Listen starts the KhighServer to listen for KhighClient's connections.

func (*KhighServer) Stop

func (server *KhighServer) Stop()

Stop stops the KhighServer, closes the connections to KhighClient and the opened databases.

type Server

type Server interface {
	// Listen starts the Server to listen for connections.
	Listen()
	// Stop closes the resources and the connections to client.
	Stop()
	// GetSignal returns the Servers's signal channel.
	GetSignal() chan os.Signal
}

Server defines the related functions of the database server.

func NewServer

func NewServer(config *ServerConfig) Server

NewServer initializes and returns a KhighServer instance.

type ServerConfig

type ServerConfig struct {
	DBPath    string
	Host      string
	Port      uint
	Databases uint
}

ServerConfig defines the structure of the server configuration.

Jump to

Keyboard shortcuts

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