grammar

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: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	GET_REQUEST           = 1
	SET_REQUEST           = 2
	DELETE_REQUEST        = 3
	AUTH_REQUEST          = 4
	CREATE_BUCKET_REQUEST = 5
	USE_REQUEST           = 6
	QUIT_REQUEST          = 7
	CREATE_USER_REQUEST   = 8
)
View Source
const (
	REQUEST_STATUS = 1
	KEY            = 2
	BUCKET         = 3
	USER           = 4
)
View Source
const (
	LENGTH_OF_GET_REQUEST           = 1
	LENGTH_OF_SET_REQUEST           = 2
	LENGTH_OF_DELETE_REQUEST        = 1
	LENGTH_OF_AUTH_REQUEST          = 2
	LENGTH_OF_CREATE_BUCKET_REQUEST = 1
	LENGTH_OF_CREATE_USER_REQUEST   = 2
	LENGTH_OF_USE_REQUEST           = 1
)
View Source
const (
	UNKNOWN_TYPE_RESPONSE = 0            //			0000 0000
	GET_RESPONSE          = 128 + 64 + 1 // 		1100 0001
	SET_RESPONSE          = 128 + 64 + 2 // 		1100 0002
	DELETE_RESPONSE       = 128 + 64 + 3 // 		1100 0011
	AUTHORIZE_RESPONSE    = 128 + 64 + 4 //			1100 0100
	CREATE_RESPONSE       = 128 + 64 + 5 // 		1100 0101
	USE_RESPONSE          = 128 + 64 + 6 // 		1100 0110
)
View Source
const (
	RESP_STATUS_SUCCESS                      = 0
	RESP_STATUS_ERR_UNAUTHORIZED             = 1
	RESP_STATUS_ERR_NO_SUCH_BUCKET           = 2
	RESP_STATUS_ERR_KEY_NOT_FOUND            = 3
	RESP_STATUS_ERR_COULD_NOT_WRITE_TO_DISK  = 4
	RESP_STATUS_ERR_BUCKET_ALREADY_EXISTS    = 5
	RESP_STATUS_ERR_COULD_NOT_CREATE_BUCKET  = 6
	RESP_STATUS_ERR_WRONG_CREDENTIALS        = 7
	RESP_STATUS_ERR_INVALID_QUERY            = 8
	RESP_STATUS_ERR_INVALID_AMOUNT_OF_PARAMS = 9
	RESP_STATUS_ERR_UNKNOWN_COMMAND          = 10
	RESP_STATUS_ERR_USERNAME_EXISTS          = 11
)

Variables

This section is empty.

Functions

func BuildRawRequest

func BuildRawRequest(request Request) (buffer []byte)

func GetBufferFromResponse

func GetBufferFromResponse(response Response) []byte

func ResponseToString

func ResponseToString(response Response) (str string)

Types

type Request

type Request struct {
	Type        byte
	Status      byte
	RequestData []string
}

func ParseRequest

func ParseRequest(data []byte) (Request, error)

type Response

type Response struct {
	Type   byte
	Status byte
	Data   string
}

func GetResponseFromBuffer

func GetResponseFromBuffer(buffer []byte) (response Response)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL