protocol

package
v0.0.0-...-87f4b13 Latest Latest
Warning

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

Go to latest
Published: May 5, 2016 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package protocol provides database's socket IO primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBSocket

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

DBSocket is a sock scanner that reads commands and returns their output.

func NewSocket

func NewSocket(db storage.DB) *DBSocket

NewSocket returns new DBSocket that reads requests according to protocol specs, relays them to the Database via StorageSession and returns the output.

func (*DBSocket) Process

func (s *DBSocket) Process(rPipe io.Reader, wPipe io.Writer)

Process starts the IO pipe.

type StorageSession

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

StorageSession handles requests for a connection and returns output strings.

func NewSession

func NewSession(stor storage.DB) *StorageSession

NewSession creates and returns new StorageSession.

func (*StorageSession) Commit

func (i *StorageSession) Commit() string

Commit commits current transaction in progress. Returns nothing on success, error on unexpected error, or NO TRANSACTION if not in transaction.

func (*StorageSession) Get

func (i *StorageSession) Get(key string) string

Get returns the variable's value by its key. Returns NULL if not found or error's text on unexpected error.

func (*StorageSession) NumEqualsTo

func (i *StorageSession) NumEqualsTo(val string) uint64

NumEqualsTo returns variables' count by their value.

func (*StorageSession) Rollback

func (i *StorageSession) Rollback() string

Rollback rolls back current transaction in progress (if exists). Returns nothing on success, error on unexpected error, or NO TRANSACTION if not in transaction.

func (*StorageSession) Set

func (i *StorageSession) Set(key, value string)

Set sets the variable's value by its key.

func (*StorageSession) Tx

func (i *StorageSession) Tx() string

Tx creates and enters new transaction.

func (*StorageSession) Unset

func (i *StorageSession) Unset(key string)

Unset deletes the variable by its key.

Jump to

Keyboard shortcuts

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