func (cli *Client) Query(metric string, tags map[string]string, minTime, maxTime int64, stat vena.Stat, velocity bool) ([]*server.Point, error) { cli.qlmtr.Open() defer cli.qlmtr.Close() spaceID := vena.Hash(metric, tags) cli.lk.Lock() x := cli.metric.Nearest(spaceID.ShardKey(), 1)[0].(*shard).X cli.lk.Unlock() // Don't recover from dead shard panic retrn := x.Call("Query", spaceID, minTime, maxTime, stat, velocity) if retrn[1] != nil { return nil, retrn[1].(error) } return retrn[0].([]*server.Point), nil }
func (cli *Client) Put(time vena.Time, metric string, tags map[string]string, value float64) error { cli.almtr.Open() defer cli.almtr.Close() spaceID := vena.Hash(metric, tags) cli.lk.Lock() x := cli.metric.Nearest(spaceID.ShardKey(), 1)[0].(*shard).X cli.lk.Unlock() // Don't recover from dead shard panic, since we need to re-discover a different shard worker retrn := x.Call("Put", time, spaceID, value) if retrn[0] != nil { return retrn[0].(error) } return nil }