server

package
Version: v0.0.0-...-ca48d25 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

View Source
const SALTS_BUCKET = "salts_bucket"
View Source
const USERS_BUCKET = "users_bucket"

Variables

This section is empty.

Functions

func HandleRequest

func HandleRequest(query []byte, conn *DatabaseConnection)

HandleRequest recieves a plain text string query, and hanles it. In most cases it adds it to the requests queue. Whilst in AUTH requests it validates the credentials and returns an answer.

func StartServer

func StartServer()

StartServer starts the database server - listens at a specific port for any incoming TCP connections.

Types

type AuthRequest

type AuthRequest struct {
	Conn     *DatabaseConnection
	Username string
	Password string
}

type CreateBucketRequest

type CreateBucketRequest struct {
	Conn       *DatabaseConnection
	BucketName string
}

CreateBucketRequest creates a database file(bucket) in the db folder

type CreateUserRequest

type CreateUserRequest struct {
	Conn     *DatabaseConnection
	Username string
	Password string
}

type DatabaseConnection

type DatabaseConnection struct {
	net.Conn
	Bucket      string
	Connections int
	Username    string
}

DatabaseConnection is an extension of the net.Conn struct, added additional required properties.

type DeleteRequest

type DeleteRequest struct {
	Conn       *DatabaseConnection
	ObjectType string
	Object     string
}

DeleteRequest describes the DELETE request to the database - when the client wants to delete a bucket or a key

type GetRequest

type GetRequest struct {
	Conn *DatabaseConnection
	Key  string
}

GetRequest describes the GET request to the database - when the client wants to know the value of a certain key

type SetRequest

type SetRequest struct {
	Conn     *DatabaseConnection
	Key      string
	Value    string
	TTL      int
	Override bool
}

SetRequest describes the SET request to the database - when the client wants to set a value to a certain key

type UseRequest

type UseRequest struct {
	Conn       *DatabaseConnection
	BucketName string
}

UseRequest is a request that sets the current bucket that is used

Jump to

Keyboard shortcuts

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