Documentation ¶
Index ¶
- Constants
- type Buffer
- type Client
- func (client Client) Close()
- func (client Client) Connect()
- func (client Client) Insert(data interface{}, timeout uint16) (interface{}, error)
- func (client Client) InsertBin(data []byte, timeout uint16) (interface{}, error)
- func (client Client) IsAvailable() bool
- func (client Client) IsConnected() bool
- func (client Client) Query(query string, timeout uint16) (interface{}, error)
- type Connection
- func (conn *Connection) Close()
- func (conn *Connection) Connect(username, password, dbname string) error
- func (conn *Connection) Info() (interface{}, error)
- func (conn *Connection) Insert(data interface{}, timeout uint16) (interface{}, error)
- func (conn *Connection) InsertBin(data []byte, timeout uint16) (interface{}, error)
- func (conn *Connection) IsConnected() bool
- func (conn *Connection) Listen()
- func (conn *Connection) Manage(username, password string, tp int, options map[string]interface{}) (interface{}, error)
- func (conn *Connection) Query(query string, timeout uint16) (interface{}, error)
- func (conn *Connection) Send(tp uint8, data interface{}, timeout uint16) (interface{}, error)
- func (conn *Connection) SendBin(tp uint8, data []byte, timeout uint16) (interface{}, error)
- func (conn *Connection) ToString() string
- type Error
- type Host
- type Pkg
Constants ¶
const AdminChangePassword = 1
AdminChangePassword for changing a server account password
const AdminDropAccount = 2
AdminDropAccount for dropping a server account
const AdminDropDatabase = 6
AdminDropDatabase for dropping a database
const AdminGetAccounts = 65
AdminGetAccounts for getting all accounts on a siridb server
const AdminGetDatabases = 66
AdminGetDatabases for getting all database running on a siridb server
const AdminGetVersion = 64
AdminGetVersion for getting the siridb server version
const AdminNewAccount = 0
AdminNewAccount for create a new manage server account
const AdminNewDatabase = 3
AdminNewDatabase for creating a new database
const AdminNewPool = 4
AdminNewPool for expanding a database with a new pool
const AdminNewReplica = 5
AdminNewReplica for expanding a database with a new replica
const AppVersion = "1.0.14"
AppVersion exposes version information
const CprotoAckAdmin = 32
CprotoAckAdmin on successful manage server request
const CprotoAckAdminData = 33
CprotoAckAdminData on successful manage server request with data
const CprotoErr = 70
CprotoErr on server error
const CprotoErrAdmin = 96
CprotoErrAdmin on manage server error with message
const CprotoErrAdminInvalidRequest = 97
CprotoErrAdminInvalidRequest on invalid manage server request
const CprotoErrAuthCredentials = 72
CprotoErrAuthCredentials on server error
const CprotoErrAuthUnknownDb = 73
CprotoErrAuthUnknownDb on server error
const CprotoErrFile = 75
CprotoErrFile on server error
const CprotoErrInsert = 66
CprotoErrInsert on insert error
const CprotoErrLoadingDb = 74
CprotoErrLoadingDb on server error
const CprotoErrMsg = 64
CprotoErrMsg general error
const CprotoErrNotAuthenticated = 71
CprotoErrNotAuthenticated on server error
const CprotoErrPool = 68
CprotoErrPool on server error
const CprotoErrQuery = 65
CprotoErrQuery on query error
const CprotoErrServer = 67
CprotoErrServer on server error
const CprotoErrUserAccess = 69
CprotoErrUserAccess on server error
const CprotoReqAdmin = 32
CprotoReqAdmin for a manage server request
const CprotoReqAuth = 2
CprotoReqAuth for authentication
const CprotoReqFileGroups = 9
CprotoReqFileGroups for requesting a groups.dat file
const CprotoReqFileServers = 7
CprotoReqFileServers for requesting a server.dat file
const CprotoReqFileUsers = 8
CprotoReqFileUsers for requesting a users.dat file
const CprotoReqInfo = 4
CprotoReqInfo for requesting database info
const CprotoReqInsert = 1
CprotoReqInsert for sending inserts
const CprotoReqLoadDB = 5
CprotoReqLoadDB for loading a new database
const CprotoReqPing = 3
CprotoReqPing for ping on the connection
const CprotoReqQuery = 0
CprotoReqQuery for sending queries
const CprotoReqRegisterServer = 6
CprotoReqRegisterServer for registering a new server
const CprotoResAck = 3
CprotoResAck on ack
const CprotoResAuthSuccess = 2
CprotoResAuthSuccess on authentication success
const CprotoResFile = 5
CprotoResFile on request file response
const CprotoResInfo = 4
CprotoResInfo on database info response
const CprotoResInsert = 1
CprotoResInsert on insert response
const CprotoResQuery = 0
CprotoResQuery on query response
const HeaderSize = 8
HeaderSize if the size of a package header.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client can be used to communicate with a SiriDB cluster.
func NewClient ¶
func NewClient(username, password, dbname string, hostlist [][]interface{}, logCh chan string) *Client
NewClient returns a pointer to a new client object. Example hostlist:
[][]interface{}{ {"myhost1", 9000}, // hostname/ip and port are required {"myhost2", 9000, 2}, // an optional integer value can be used as weight // (default weight is 1) {"myhost3", 9000, true}, // if true is added as third argument the host // will be used only when other hosts are not available }
func (Client) Connect ¶
func (client Client) Connect()
Connect to SiriDB. make sure to initialize random: rand.Seed(time.Now().Unix())
func (Client) IsAvailable ¶
IsAvailable return true if at least one connection is connected
func (Client) IsConnected ¶
IsConnected return true if at least one connection is connected
type Connection ¶
type Connection struct { OnClose func() LogCh chan string // contains filtered or unexported fields }
Connection is a SiriDB Connection. Port should be the client port.
func NewConnection ¶
func NewConnection(host string, port uint16) *Connection
NewConnection creates a new connection connection
func (*Connection) Connect ¶
func (conn *Connection) Connect(username, password, dbname string) error
Connect to a SiriDB connection.
func (*Connection) Info ¶
func (conn *Connection) Info() (interface{}, error)
Info returns siridb info
func (*Connection) Insert ¶
func (conn *Connection) Insert(data interface{}, timeout uint16) (interface{}, error)
Insert sends data to a SiriDB database.
func (*Connection) InsertBin ¶
func (conn *Connection) InsertBin(data []byte, timeout uint16) (interface{}, error)
InsertBin sends binary data to a SiriDB database.
func (*Connection) IsConnected ¶
func (conn *Connection) IsConnected() bool
IsConnected returns true when connected.
func (*Connection) Manage ¶
func (conn *Connection) Manage(username, password string, tp int, options map[string]interface{}) (interface{}, error)
Manage send a manage server request.
func (*Connection) Query ¶
func (conn *Connection) Query(query string, timeout uint16) (interface{}, error)
Query sends a query and returns the result.
func (*Connection) Send ¶
func (conn *Connection) Send(tp uint8, data interface{}, timeout uint16) (interface{}, error)
Send is used to send bytes
func (*Connection) SendBin ¶
func (conn *Connection) SendBin(tp uint8, data []byte, timeout uint16) (interface{}, error)
SendBin is used to send bytes
func (*Connection) ToString ¶
func (conn *Connection) ToString() string
ToString returns a string representing the connection and port.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error can be returned by the siridb package.