tabletconn

package
v0.0.0-...-9a5932e Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2014 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_NORMAL = iota
	ERR_RETRY
	ERR_FATAL
	ERR_TX_POOL_FULL
	ERR_NOT_IN_TX
)
View Source
const (
	CONN_CLOSED = OperationalError("vttablet: Connection Closed")
)

Variables

This section is empty.

Functions

func RegisterDialer

func RegisterDialer(name string, dialer TabletDialer)

RegisterDialer is meant to be used by TabletDialer implementations to self register.

Types

type ErrFunc

type ErrFunc func() error

type OperationalError

type OperationalError string

OperationalError represents an error due to a failure to communicate with vttablet.

func (OperationalError) Error

func (e OperationalError) Error() string

type ServerError

type ServerError struct {
	Code int
	Err  string
}

ServerError represents an error that was returned from a vttablet server.

func (*ServerError) Error

func (e *ServerError) Error() string

type TabletConn

type TabletConn interface {
	// Execute executes a non-streaming query on vttablet.
	Execute(context interface{}, query string, bindVars map[string]interface{}, transactionId int64) (*mproto.QueryResult, error)

	// ExecuteBatch executes a group of queries.
	ExecuteBatch(context interface{}, queries []tproto.BoundQuery, transactionId int64) (*tproto.QueryResultList, error)

	// StreamExecute exectutes a streaming query on vttablet. It returns a channel that will stream results.
	// It also returns an ErrFunc that can be called to check if there were any errors. ErrFunc can be called
	// immediately after StreamExecute returns to check if there were errors sending the call. It should also
	// be called after finishing the iteration over the channel to see if there were other errors.
	StreamExecute(context interface{}, query string, bindVars map[string]interface{}, transactionId int64) (<-chan *mproto.QueryResult, ErrFunc)

	// Transaction support
	Begin(context interface{}) (transactionId int64, err error)
	Commit(context interface{}, transactionId int64) error
	Rollback(context interface{}, transactionId int64) error

	// Close must be called for releasing resources.
	Close()

	// GetEndPoint returns the end point info.
	EndPoint() topo.EndPoint
}

TabletConn defines the interface for a vttablet client. It should not be concurrently used across goroutines.

type TabletDialer

type TabletDialer func(context interface{}, endPoint topo.EndPoint, keyspace, shard string, timeout time.Duration) (TabletConn, error)

TabletDialer represents a function that will return a TabletConn object that can communicate with a tablet.

func GetDialer

func GetDialer() TabletDialer

GetDialer returns the dialer to use, described by the command line flag

Jump to

Keyboard shortcuts

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