client

package
v0.0.0-...-118f6c1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2016 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a timestamp oracle client.

func NewClient

func NewClient(conf *Conf) *Client

NewClient creates a timestamp oracle client.

func (*Client) GoGetTimestamp

func (c *Client) GoGetTimestamp() *PipelineRequest

GoGetTimestamp returns a PipelineRequest so you can get the timestamp later.

type Conf

type Conf struct {
	// tso server address, it will be deprecated later.
	ServerAddr string

	// ZKAddr is for zookeeper address, if set, client will ignore ServerAddr
	// and find the leader tso server address in zookeeper.
	// Later ServerAddr is just for simple test and backward compatibility.
	ZKAddr string

	// root path is the tso server saving in zookeeper, like /zk/tso.
	RootPath string
}

Conf is the configuration.

type Conn

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

Conn is the connection for timestamp oracle server, it is not thread safe.

func NewConnection

func NewConnection(addr string, netTimeout time.Duration) (*Conn, error)

NewConnection creates a conn.

func (*Conn) Flush

func (c *Conn) Flush() error

Flush flushs buffered data.

func (*Conn) Read

func (c *Conn) Read(p []byte) (int, error)

Read reads data and stores it into p.

func (*Conn) Write

func (c *Conn) Write(p []byte) (int, error)

Write writes p.

type PipelineRequest

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

PipelineRequest let you get the timestamp with pipeline.

func (*PipelineRequest) GetTS

func (pr *PipelineRequest) GetTS() (*proto.Timestamp, error)

GetTS gets the timestamp.

func (*PipelineRequest) MarkDone

func (pr *PipelineRequest) MarkDone(reply *proto.Response, err error)

MarkDone sets the repsone for current request.

Jump to

Keyboard shortcuts

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