Beispiel #1
0
// Send KeyVersions to other end, asynchronous call.
// Asynchronous call. Return ErrorChannelFull that can be used by caller.
func (endpoint *RouterEndpoint) Send(data interface{}) error {
	cmd := []interface{}{endpCmdSend, data}
	if endpoint.block {
		return c.FailsafeOpAsync(endpoint.ch, cmd, endpoint.finch)
	}
	return c.FailsafeOpNoblock(endpoint.ch, cmd, endpoint.finch)
}
Beispiel #2
0
// SendKeyVersions for one or more vbuckets to the other end,
// asynchronous call.
func (c *Client) SendKeyVersions(vbs []*common.VbKeyVersions, block bool) error {
	if vbs == nil || len(vbs) == 0 {
		return ErrorClientEmptyKeys
	}
	cmd := []interface{}{clientCmdSendKeyVersions, vbs}
	if block {
		return common.FailsafeOpAsync(c.reqch, cmd, c.finch)
	}
	return common.FailsafeOpNoblock(c.reqch, cmd, c.finch)
}
Beispiel #3
0
// Close client and all its active connection with downstream.
// asynchronous call.
func (c *Client) Close() error {
	cmd := []interface{}{clientCmdClose}
	return common.FailsafeOpAsync(c.reqch, cmd, c.finch)
}
Beispiel #4
0
// WaitForExit will block until endpoint exits.
func (endpoint *RouterEndpoint) WaitForExit() error {
	return c.FailsafeOpAsync(nil, []interface{}{}, endpoint.finch)
}
Beispiel #5
0
// SyncPulse will trigger vb-routine to generate a sync pulse for this
// vbucket, asychronous call.
func (vr *VbucketRoutine) SyncPulse() error {
	cmd := []interface{}{vrCmdSyncPulse}
	return c.FailsafeOpAsync(vr.reqch, cmd, vr.finch)
}
Beispiel #6
0
// Event will post an DcpEvent, asychronous call.
func (vr *VbucketRoutine) Event(m *mc.DcpEvent) error {
	cmd := []interface{}{vrCmdEvent, m}
	return c.FailsafeOpAsync(vr.reqch, cmd, vr.finch)
}