voltdb-client-go: github.com/VoltDB/voltdb-client-go/voltdbclient Index | Files

package voltdbclient

import "github.com/VoltDB/voltdb-client-go/voltdbclient"

Index

Package Files

client_affinity.go constants.go distributor.go driver.go hashinator.go latency_limiter.go network_request.go network_writer.go node_conn.go procedure_invocation.go query_api.go response.go result.go rows.go statement.go table.go txn_limiter.go url.go utils.go

Constants

const (
    PingHandle      = math.MaxInt64
    AsyncTopoHandle = PingHandle - 1
)

Handles

const (
    PartitionIDBits = 14

    // maximum values for the txn id fields
    PartitionIDMaxValue = (1 << PartitionIDBits) - 1
    MPInitPID           = PartitionIDMaxValue
)

Partitions

const (
    BinArrayFormat = 0
    JSONFormat     = 1
)

Hash Config Format

const (
    // BlockDuration ...
    BlockDuration = time.Millisecond * 100
    // OutTXNsLimit defines the amount of outstanding transactions we'd allow.
    OutTXNsLimit = 20 // as many outstanding transactions as we ever want.
)
const (
    // DefaultQueryTimeout time out for queries.
    DefaultQueryTimeout time.Duration = 2 * time.Minute
)
const (
    Elastic = "Elastic"
)

Hash Type

Variables

var ErrMissingServerArgument = errors.New("voltdbclient: missing voltdb connection string")
var ProtocolVersion = 1

ProtocolVersion lists the version of the voltdb wire protocol to use. For VoltDB releases of version 5.2 and later use version 1. For releases prior to that use version 0.

func EncodePI Uses

func EncodePI(e *wire.Encoder, pi *procedureInvocation) error

func SearchToken2Partitions Uses

func SearchToken2Partitions(a []token2Partition, token int) (partition int)

SearchToken2Partitions searches the needed partition by token.

type AsyncResponseConsumer Uses

type AsyncResponseConsumer interface {

    // This method is invoked when an error is returned by an async Query
    // or an Exec.
    ConsumeError(error)
    // This method is invoked when a Result is returned by an async Exec.
    ConsumeResult(driver.Result)
    // This method is invoked when Rows is returned by an async Query.
    ConsumeRows(driver.Rows)
}

AsyncResponseConsumer is a type that consumes responses from asynchronous Queries and Execs. In the VoltDB go client, asynchronous requests are continuously processed by one or more goroutines executing in the background. When a response from the server is received for an asynchronous request, one of the methods in this interface is invoked. An instance of AyncResponseConsumer is passed when an asynchronous request is made, this instance will process the response for that request.

type Conn Uses

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

Conn holds the set of currently active connections.

func OpenConn Uses

func OpenConn(ci string) (*Conn, error)

OpenConn returns a new connection to the VoltDB server. The name is a string in a driver-specific format. The returned connection can be used by only one goroutine at a time.

By default voltdb doesn't require authentication, clients connecting to un secured database have access to everything. Supplying connection credentials doesn't affect for non secured databases

Here we authenticate if username and password are supplied, if they are not then a connection is established without doing the authentication

Connection string is similar to postgres, default port is 21212

voltdb:// voltdb://localhost voltdb://localhost:21212 voltdb://user@localhost voltdb://user:secret@localhost voltdb://other@localhost?some_param=some_value

You can omit the port,and the default port of 21212 will be automatically added for you.

Additionally you can fine tune behavior of connections when in cluster mode using query parameters.

Example localhost:21212?max_retries=10&retry=true&retry_interval=1s

retry - if true will try to reconnect with the node when the connection is lost.

max_retries - in the number of times you want to retry to connect to a node. This has no effect when retry is false.

retry_interval is the duration of time to wait until the next retry.

func OpenConnWithLatencyTarget Uses

func OpenConnWithLatencyTarget(ci string, latencyTarget int32) (*Conn, error)

OpenConnWithLatencyTarget returns a new connection to the VoltDB server. This connection will try to meet the specified latency target, potentially by throttling the rate at which asynchronous transactions are submitted.

func OpenConnWithMaxOutstandingTxns Uses

func OpenConnWithMaxOutstandingTxns(ci string, maxOutTxns int) (*Conn, error)

OpenConnWithMaxOutstandingTxns returns a new connection to the VoltDB server. This connection will limit the number of outstanding transactions as indicated. An outstanding transaction is a transaction that has been sent to the server but for which no response has been received.

func (*Conn) Begin Uses

func (c *Conn) Begin() (driver.Tx, error)

Begin starts a transaction.

func (*Conn) Close Uses

func (c *Conn) Close() error

Close closes the connection to the VoltDB server. Connections to the server are meant to be long lived; it should not be necessary to continually close and reopen connections. Close would typically be called using a defer. Operations using a closed connection cause a panic.

func (*Conn) Drain Uses

func (c *Conn) Drain()

Drain blocks until all outstanding asynchronous requests have been satisfied. Asynchronous requests are processed in a background thread; this call blocks the current thread until that background thread has finished with all asynchronous requests.

func (*Conn) Exec Uses

func (c *Conn) Exec(query string, args []driver.Value) (driver.Result, error)

Exec executes a query that doesn't return rows, such as an INSERT or UPDATE. Exec is available on both VoltConn and on VoltStatement. Uses DefaultQueryTimeout.

func (*Conn) ExecAsync Uses

func (c *Conn) ExecAsync(resCons AsyncResponseConsumer, query string, args []driver.Value)

ExecAsync is analogous to Exec but is run asynchronously. That is, an invocation of this method blocks only until a request is sent to the VoltDB server. Uses DefaultQueryTimeout.

func (*Conn) ExecAsyncTimeout Uses

func (c *Conn) ExecAsyncTimeout(resCons AsyncResponseConsumer, query string, args []driver.Value, timeout time.Duration) error

ExecAsyncTimeout is analogous to Exec but is run asynchronously. That is, an invocation of this method blocks only until a request is sent to the VoltDB server. Specifies a duration for timeout.

func (*Conn) ExecTimeout Uses

func (c *Conn) ExecTimeout(query string, args []driver.Value, timeout time.Duration) (driver.Result, error)

ExecTimeout executes a query that doesn't return rows, such as an INSERT or UPDATE. ExecTimeout is available on both VoltConn and on VoltStatement. Specifies a duration for timeout.

func (*Conn) Prepare Uses

func (c *Conn) Prepare(query string) (driver.Stmt, error)

Prepare creates a prepared statement for later queries or executions. The Statement returned by Prepare is bound to this VoltConn.

func (*Conn) Query Uses

func (c *Conn) Query(query string, args []driver.Value) (driver.Rows, error)

Query executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query. Uses DefaultQueryTimeout.

func (*Conn) QueryAsync Uses

func (c *Conn) QueryAsync(rowsCons AsyncResponseConsumer, query string, args []driver.Value)

QueryAsync executes a query asynchronously. The invoking thread will block until the query is sent over the network to the server. The eventual response will be handled by the given AsyncResponseConsumer, this processing happens in the 'response' thread. Uses DefaultQueryTimeout.

func (*Conn) QueryAsyncTimeout Uses

func (c *Conn) QueryAsyncTimeout(rowsCons AsyncResponseConsumer, query string, args []driver.Value, timeout time.Duration) error

QueryAsyncTimeout executes a query asynchronously. The invoking thread will block until the query is sent over the network to the server. The eventual response will be handled by the given AsyncResponseConsumer, this processing happens in the 'response' thread. Specifies a duration for timeout.

func (*Conn) QueryTimeout Uses

func (c *Conn) QueryTimeout(query string, args []driver.Value, timeout time.Duration) (driver.Rows, error)

QueryTimeout executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query. Specifies a duration for timeout.

type ResponseStatus Uses

type ResponseStatus int8

ResponseStatus handles the Status codes returned by the VoltDB server. Each response to a client Query or Exec has an associated status code.

const (
    Success                    ResponseStatus = 1
    UserAbort                  ResponseStatus = -1
    GracefulFailure            ResponseStatus = -2
    UnexpectedFailure          ResponseStatus = -3
    ConnectionLost             ResponseStatus = -4
    ServerUnavailable          ResponseStatus = -5
    ConnectionTimeout          ResponseStatus = -6
    ResponseUnknown            ResponseStatus = -7
    TXNRestart                 ResponseStatus = -8
    OperationalFailure         ResponseStatus = -9
    UninitializedAppStatusCode ResponseStatus = -128
)

The available ResponseStatus codes

func (ResponseStatus) String Uses

func (rs ResponseStatus) String() string

Represent a ResponseStatus as a string.

type Token2PartitionSlice Uses

type Token2PartitionSlice []token2Partition

Token2PartitionSlice holds a slice of token2Partition structures.

func (Token2PartitionSlice) Len Uses

func (s Token2PartitionSlice) Len() int

func (Token2PartitionSlice) Less Uses

func (s Token2PartitionSlice) Less(i, j int) bool

func (Token2PartitionSlice) Sort Uses

func (s Token2PartitionSlice) Sort()

Sort is a convenience method.

func (Token2PartitionSlice) Swap Uses

func (s Token2PartitionSlice) Swap(i, j int)

type VoltDriver Uses

type VoltDriver struct{}

VoltDriver implements A database/sql/driver for VoltDB. This driver is registered as 'voltdb'

func NewVoltDriver Uses

func NewVoltDriver() *VoltDriver

NewVoltDriver returns a new instance of a VoltDB driver.

func (*VoltDriver) Open Uses

func (vd *VoltDriver) Open(hostAndPort string) (driver.Conn, error)

Open a connection to the VoltDB server.

type VoltError Uses

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

VoltError type

type VoltResult Uses

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

VoltResult is an implementation of database/sql/driver.Result

func (*VoltResult) AdvanceTable Uses

func (vr *VoltResult) AdvanceTable() bool

AdvanceTable advances to the next table. Returns false if there isn't a next table.

func (*VoltResult) AdvanceToTable Uses

func (vr *VoltResult) AdvanceToTable(ti int) bool

AdvanceToTable advances to the table indicated by the index. Returns false if there is no table at the given index.

func (VoltResult) LastInsertId Uses

func (vr VoltResult) LastInsertId() (int64, error)

LastInsertId is not populated by VoltDB, calls to LastInsertId return 0.

func (VoltResult) RowsAffected Uses

func (vr VoltResult) RowsAffected() (int64, error)

RowsAffected returns the number of rows affected by the query.

type VoltRows Uses

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

VoltRows is an implementation of database/sql/driver.Rows.

A response to a query from the VoltDB server might include rows from more than one table; VoltRows includes methods used to move between tables.

VoltRows also includes two column accessors for each VoltDB column type. The value for a column can be accessed by either column index or by column name. These accessors return interface{} type; the returned interface needs to be cast to the correct type. This is how null database values are supported, a null value will be returned as nil.

func (VoltRows) AdvanceRow Uses

func (vr VoltRows) AdvanceRow() bool

AdvanceRow advances to the next row of data, returns false if there isn't a next row.

func (*VoltRows) AdvanceTable Uses

func (vr *VoltRows) AdvanceTable() bool

AdvanceTable advances to the next table. Returns false if there isn't a next table.

func (VoltRows) AdvanceToRow Uses

func (vr VoltRows) AdvanceToRow(rowIndex int32) bool

AdvanceToRow advances to the row of data indicated by the index. Returns false if there is no row at the given index.

func (*VoltRows) AdvanceToTable Uses

func (vr *VoltRows) AdvanceToTable(tableIndex int16) bool

AdvanceToTable advances to the table indicated by the index. Returns false if there is no table at the given index.

func (VoltRows) Close Uses

func (vr VoltRows) Close() error

Close is essentially a no op as the VoltDB server doesn't support cursors.

func (VoltRows) ColumnCount Uses

func (vr VoltRows) ColumnCount() int

ColumnCount returns the number of columns in the current table.

func (VoltRows) ColumnTypes Uses

func (vr VoltRows) ColumnTypes() []int8

ColumnTypes returns the column types of the columns in the current table.

func (VoltRows) Columns Uses

func (vr VoltRows) Columns() []string

Columns returns the names of the columns.

func (VoltRows) GetBigInt Uses

func (vr VoltRows) GetBigInt(colIndex int16) (interface{}, error)

GetBigInt returns the value of a BIGINT column at the given index in the current row.

func (VoltRows) GetBigIntByName Uses

func (vr VoltRows) GetBigIntByName(cn string) (interface{}, error)

GetBigIntByName returns the value of a BIGINT column with the given name in the current row.

func (VoltRows) GetDecimal Uses

func (vr VoltRows) GetDecimal(colIndex int16) (interface{}, error)

GetDecimal returns the value of a DECIMAL column at the given index in the current row.

func (VoltRows) GetDecimalByName Uses

func (vr VoltRows) GetDecimalByName(cn string) (interface{}, error)

GetDecimalByName returns the value of a DECIMAL column with the given name in the current row.

func (VoltRows) GetFloat Uses

func (vr VoltRows) GetFloat(colIndex int16) (interface{}, error)

GetFloat returns the value of a FLOAT column at the given index in the current row.

func (VoltRows) GetFloatByName Uses

func (vr VoltRows) GetFloatByName(cn string) (interface{}, error)

GetFloatByName returns the value of a FLOAT column with the given name in the current row.

func (VoltRows) GetInteger Uses

func (vr VoltRows) GetInteger(colIndex int16) (interface{}, error)

GetInteger returns the value of a INTEGER column at the given index in the current row.

func (VoltRows) GetIntegerByName Uses

func (vr VoltRows) GetIntegerByName(cn string) (interface{}, error)

GetIntegerByName returns the value of a INTEGER column with the given name in the current row.

func (VoltRows) GetSmallInt Uses

func (vr VoltRows) GetSmallInt(colIndex int16) (interface{}, error)

GetSmallInt returns the value of a SMALLINT column at the given index in the current row.

func (VoltRows) GetSmallIntByName Uses

func (vr VoltRows) GetSmallIntByName(cn string) (interface{}, error)

GetSmallIntByName returns the value of a SMALLINT column with the given name in the current row.

func (VoltRows) GetString Uses

func (vr VoltRows) GetString(colIndex int16) (interface{}, error)

GetString returns the value of a STRING column at the given index in the current row.

func (VoltRows) GetStringByName Uses

func (vr VoltRows) GetStringByName(cn string) (interface{}, error)

GetStringByName returns the value of a STRING column with the given name in the current row.

func (VoltRows) GetTimestamp Uses

func (vr VoltRows) GetTimestamp(colIndex int16) (interface{}, error)

GetTimestamp returns the value of a TIMESTAMP column at the given index in the current row.

func (VoltRows) GetTimestampByName Uses

func (vr VoltRows) GetTimestampByName(cn string) (interface{}, error)

GetTimestampByName returns the value of a TIMESTAMP column with the given name in the current row.

func (VoltRows) GetTinyInt Uses

func (vr VoltRows) GetTinyInt(colIndex int16) (interface{}, error)

GetTinyInt returns the value of a TINYINT column at the given index in the current row.

func (VoltRows) GetTinyIntByName Uses

func (vr VoltRows) GetTinyIntByName(cn string) (interface{}, error)

GetTinyIntByName returns the value of a TINYINT column with the given name in the current row.

func (VoltRows) GetVarbinary Uses

func (vr VoltRows) GetVarbinary(colIndex int16) (interface{}, error)

GetVarbinary returns the value of a VARBINARY column at the given index in the current row.

func (VoltRows) GetVarbinaryByName Uses

func (vr VoltRows) GetVarbinaryByName(cn string) (interface{}, error)

GetVarbinaryByName returns the value of a VARBINARY column with the given name in the current row.

func (VoltRows) HasNextResultSet Uses

func (vr VoltRows) HasNextResultSet() bool

HasNextResultSet implements driver.RowsNextResultSet

func (VoltRows) Next Uses

func (vr VoltRows) Next(dest []driver.Value) (err error)

Next is called to populate the next row of data into the provided slice. The provided slice will be the same size as the Columns() are wide.

func (*VoltRows) NextResultSet Uses

func (vr *VoltRows) NextResultSet() error

NextResultSet implements driver.RowsNextResultSet

type VoltStatement Uses

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

VoltStatement is an implementation of the database/sql/driver.Stmt interface

func (VoltStatement) Close Uses

func (vs VoltStatement) Close() error

Close closes the statement. Close is a noop for VoltDB as the VoltDB server does not directly support prepared statements.

func (VoltStatement) Exec Uses

func (vs VoltStatement) Exec(args []driver.Value) (driver.Result, error)

Exec executes a query that doesn't return rows, such as an INSERT or UPDATE. Uses DefaultQueryTimeout.

func (VoltStatement) ExecAsync Uses

func (vs VoltStatement) ExecAsync(resCons AsyncResponseConsumer, args []driver.Value)

ExecAsync asynchronously runs an Exec. Uses DefaultQueryTimeout.

func (VoltStatement) ExecAsyncTimeout Uses

func (vs VoltStatement) ExecAsyncTimeout(resCons AsyncResponseConsumer, args []driver.Value, timeout time.Duration)

ExecAsyncTimeout asynchronously runs an Exec. Specifies a duration for timeout.

func (VoltStatement) ExecTimeout Uses

func (vs VoltStatement) ExecTimeout(args []driver.Value, timeout time.Duration) (driver.Result, error)

ExecTimeout executes a query that doesn't return rows, such as an INSERT or UPDATE. Specifies a duration for timeout.

func (VoltStatement) NumInput Uses

func (vs VoltStatement) NumInput() int

NumInput returns the number of placeholder parameters.

func (VoltStatement) Query Uses

func (vs VoltStatement) Query(args []driver.Value) (driver.Rows, error)

Query executes a query that may return rows, such as a SELECT. Uses DefaultQueryTimeout.

func (VoltStatement) QueryAsync Uses

func (vs VoltStatement) QueryAsync(rowsCons AsyncResponseConsumer, args []driver.Value)

QueryAsync asynchronously runs a Query. Uses DefaultQueryTimeout.

func (VoltStatement) QueryAsyncTimeout Uses

func (vs VoltStatement) QueryAsyncTimeout(rowsCons AsyncResponseConsumer, args []driver.Value, timeout time.Duration)

QueryAsyncTimeout asynchronously runs a Query. Specifies a duration for timeout.

func (VoltStatement) QueryTimeout Uses

func (vs VoltStatement) QueryTimeout(args []driver.Value, timeout time.Duration) (driver.Rows, error)

QueryTimeout executes a query that may return rows, such as a SELECT. Specifies a duration for timeout.

Package voltdbclient imports 26 packages (graph) and is imported by 3 packages. Updated 2019-07-09. Refresh now. Tools for package owners.