client

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestMSTimeout = time.Second
	ConnectMSTimeout = time.Second * 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetRoute gets a range and its leader Peer from MS by key.
	// The range may expire after split. Caller is responsible for caching and
	// taking care of range change.
	// Also it may return nil if MS finds no range for the key temporarily,
	// client should retry later.
	GetRoute(dbId, tableId uint64, key []byte) ([]*metapb.Route, error)
	GetNode(nodeId uint64) (*metapb.Node, error)
	GetDB(dbName string) (*metapb.DataBase, error)
	GetTable(dbName, tableName string) (*metapb.Table, error)
	GetTableById(dbId, tableId uint64) (*metapb.Table, error)
	GetColumns(dbId, tableId uint64) ([]*metapb.Column, error)
	GetColumnByName(dbId, tableId uint64, columnName string) (*metapb.Column, error)
	GetColumnByID(dbId, tableId uint64, columnId uint64) (*metapb.Column, error)
	// columns输入参数只需要填写name和data type即可
	// 返回master server处理后的columns列表(本次新增部分)
	AddColumns(dbId, tableId uint64, columns []*metapb.Column) ([]*metapb.Column, error)
	TruncateTable(dbId, tableId uint64) error
	CreateDatabase(dbName string) error
	CreateTable(dbName, tableName, properties string) error

	NodeHeartbeat(*mspb.NodeHeartbeatRequest) (*mspb.NodeHeartbeatResponse, error)
	RangeHeartbeat(*mspb.RangeHeartbeatRequest) (*mspb.RangeHeartbeatResponse, error)
	NodeLogin(*mspb.NodeLoginRequest) (*mspb.NodeLoginResponse, error)
	GetNodeId(*mspb.GetNodeIdRequest) (*mspb.GetNodeIdResponse, error)
	// Close closes the client.
	Close()
}

Client is a MS (master server) client. It should not be used after calling Close().

func NewClient

func NewClient(msAddrs []string) (Client, error)

type Conn

type Conn struct {
	Cli mspb.MsServerClient
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close()

type RPCClient

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

func (*RPCClient) AddColumns

func (c *RPCClient) AddColumns(dbId, tableId uint64, columns []*metapb.Column) ([]*metapb.Column, error)

columns输入参数只需要填写name和data type即可 返回master server处理后的columns列表(本次新增部分)

func (*RPCClient) Close

func (c *RPCClient) Close()

Close closes the client.

func (*RPCClient) CreateDatabase

func (c *RPCClient) CreateDatabase(dbName string) error

func (*RPCClient) CreateTable

func (c *RPCClient) CreateTable(dbName, tableName, properties string) error

func (*RPCClient) GetColumnByID

func (c *RPCClient) GetColumnByID(dbId, tableId uint64, columnId uint64) (*metapb.Column, error)

func (*RPCClient) GetColumnByName

func (c *RPCClient) GetColumnByName(dbId, tableId uint64, columnName string) (*metapb.Column, error)

func (*RPCClient) GetColumns

func (c *RPCClient) GetColumns(dbId, tableId uint64) ([]*metapb.Column, error)

func (*RPCClient) GetDB

func (c *RPCClient) GetDB(dbName string) (*metapb.DataBase, error)

func (*RPCClient) GetNode

func (c *RPCClient) GetNode(nodeId uint64) (*metapb.Node, error)

func (*RPCClient) GetNodeId

func (c *RPCClient) GetNodeId(req *mspb.GetNodeIdRequest) (*mspb.GetNodeIdResponse, error)

func (*RPCClient) GetRoute

func (c *RPCClient) GetRoute(dbId, tableId uint64, key []byte) ([]*metapb.Route, error)

func (*RPCClient) GetTable

func (c *RPCClient) GetTable(dbName, tableName string) (*metapb.Table, error)

func (*RPCClient) GetTableById

func (c *RPCClient) GetTableById(dbId uint64, tableId uint64) (*metapb.Table, error)

func (*RPCClient) NodeHeartbeat

func (*RPCClient) NodeLogin

func (c *RPCClient) NodeLogin(req *mspb.NodeLoginRequest) (*mspb.NodeLoginResponse, error)

func (*RPCClient) RangeHeartbeat

func (*RPCClient) TruncateTable

func (c *RPCClient) TruncateTable(dbId, tableId uint64) error

Jump to

Keyboard shortcuts

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