Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) ChangeServerAddresses(servers []string)
- func (c *Client) Close() error
- func (c *Client) ForceFlushAtSeq(seq uint64) error
- func (c *Client) Recv() <-chan *Result
- func (c *Client) Send(op uint8, seq uint64, index int64, timestamp int64, data []byte) error
- func (c *Client) WaitNbdSlaveSync() error
- type Response
- type Result
Constants ¶
This section is empty.
Variables ¶
var ( // ErrClientClosed returned when client do something when // it already closed ErrClientClosed = errors.New("client already closed") // ErrWaitSlaveSyncTimeout returned when nbd slave sync couldn't be finished ErrWaitSlaveSyncTimeout = errors.New("wait nbd slave sync timed out") // ErrFlushFailed returned when client failed to do flush ErrFlushFailed = errors.New("tlogserver failed to flush") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines a Tlog Client. This client is not thread/goroutine safe.
func New ¶
func New(servers []string, vdiskID string, firstSequence uint64, resetFirstSeq bool) (*Client, error)
New creates a new tlog client for a vdisk with 'addrs' is the tlogserver addresses. Client is going to use first address and then move to next addresses if the first address is failed. 'firstSequence' is the first sequence number this client is going to send. Set 'resetFirstSeq' to true to force reset the vdisk first/expected sequence. The client is not goroutine safe.
func (*Client) ChangeServerAddresses ¶
ChangeServerAddresses change servers to the given servers
func (*Client) Close ¶
Close the open connection, making this client invalid. It is user responsibility to call this function.
func (*Client) ForceFlushAtSeq ¶
ForceFlushAtSeq force flush at given sequence NOTE : this func doesn't have retry logic, user need to add it
func (*Client) Send ¶
Send sends the transaction tlog to server. It returns error in these cases: - failed to encode the capnp. - failed to recover from broken network connection.
func (*Client) WaitNbdSlaveSync ¶
WaitNbdSlaveSync commands tlog server to wait for nbd slave to be fully synced
type Response ¶
type Response struct { Status tlog.BlockStatus // status of the call Sequences []uint64 // flushed sequences number (optional) }
Response defines a response from tlog server TODO: find a better way to return a response to the client's user,
as it might not make sense for all commands to return sequences.