Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) ChangeServerAddrs(addrs []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, offset, timestamp uint64, data []byte, size uint64) 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 ¶
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) ChangeServerAddrs ¶
ChangeServerAddrs change server addresses to the given addresses addrs
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