Example #1
0
// AddEngines update active set of engines and endpoints
// synchronous call.
func (vr *VbucketRoutine) AddEngines(
	opaque uint16,
	engines map[uint64]*Engine,
	endpoints map[string]c.RouterEndpoint) (uint64, error) {

	respch := make(chan []interface{}, 1)
	cmd := []interface{}{vrCmdAddEngines, opaque, engines, endpoints, respch}
	resp, err := c.FailsafeOp(vr.reqch, respch, cmd, vr.finch)
	if err = c.OpError(err, resp, 1); err != nil {
		return 0, err
	}
	return resp[0].(uint64), nil
}
Example #2
0
// AddEngines and endpoints, synchronous call.
func (kvdata *KVData) AddEngines(
	opaque uint16,
	engines map[uint64]*Engine,
	endpoints map[string]c.RouterEndpoint) (map[uint16]uint64, error) {

	// copy them to local map and then pass down the reference.
	eps := make(map[string]c.RouterEndpoint)
	for k, v := range endpoints {
		eps[k] = v
	}

	respch := make(chan []interface{}, 1)
	cmd := []interface{}{kvCmdAddEngines, opaque, engines, eps, respch}
	resp, err := c.FailsafeOp(kvdata.sbch, respch, cmd, kvdata.finch)
	if err = c.OpError(err, resp, 1); err != nil {
		return nil, err
	}
	return resp[0].(map[uint16]uint64), nil
}
Example #3
0
// SendVbmap vbmap for this connection to the other end,
// synchronous call.
func (c *Client) SendVbmap(vbmap *common.VbConnectionMap) error {
	respch := make(chan []interface{}, 1)
	cmd := []interface{}{clientCmdSendVbmap, vbmap, respch}
	resp, err := common.FailsafeOp(c.reqch, respch, cmd, c.finch)
	return common.OpError(err, resp, 0)
}
Example #4
0
// Close this endpoint.
func (endpoint *RouterEndpoint) Close() error {
	respch := make(chan []interface{}, 1)
	cmd := []interface{}{endpCmdClose, respch}
	resp, err := c.FailsafeOp(endpoint.ch, respch, cmd, endpoint.finch)
	return c.OpError(err, resp, 0)
}