Remove more constants
parent
4d666fc3dc
commit
0a0b14ba23
|
@ -23,14 +23,6 @@ type Coordinator struct {
|
|||
permissions Permissions
|
||||
}
|
||||
|
||||
// shorter constants for readability
|
||||
var (
|
||||
endStreamResponse = protocol.Response_END_STREAM
|
||||
queryResponse = protocol.Response_QUERY
|
||||
heartbeatResponse = protocol.Response_HEARTBEAT
|
||||
write = protocol.Request_WRITE
|
||||
)
|
||||
|
||||
func NewCoordinator(
|
||||
config *configuration.Configuration,
|
||||
raftServer *RaftServer,
|
||||
|
@ -535,7 +527,11 @@ func (self *Coordinator) write(db string, series []*protocol.Series, shard clust
|
|||
}
|
||||
|
||||
func (self *Coordinator) writeWithoutAssigningId(db string, series []*protocol.Series, shard cluster.Shard, sync bool) error {
|
||||
request := &protocol.Request{Type: &write, Database: &db, MultiSeries: series}
|
||||
request := &protocol.Request{
|
||||
Type: protocol.Request_WRITE.Enum(),
|
||||
Database: &db,
|
||||
MultiSeries: series,
|
||||
}
|
||||
// break the request if it's too big
|
||||
if request.Size() >= MAX_REQUEST_SIZE {
|
||||
if l := len(series); l > 1 {
|
||||
|
|
|
@ -61,7 +61,7 @@ func (prs *PingResponseServer) handleConnection(conn net.Conn) {
|
|||
|
||||
switch *request.Type {
|
||||
case protocol.Request_HEARTBEAT:
|
||||
response := &protocol.Response{RequestId: request.Id, Type: &heartbeatResponse}
|
||||
response := &protocol.Response{RequestId: request.Id, Type: protocol.Response_HEARTBEAT.Enum()}
|
||||
|
||||
data, err := response.Encode()
|
||||
if err != nil {
|
||||
|
|
|
@ -33,7 +33,10 @@ func (self *ProtobufRequestHandler) HandleRequest(request *protocol.Request, con
|
|||
case protocol.Request_QUERY:
|
||||
go self.handleQuery(request, conn)
|
||||
case protocol.Request_HEARTBEAT:
|
||||
response := &protocol.Response{RequestId: request.Id, Type: &heartbeatResponse}
|
||||
response := &protocol.Response{
|
||||
RequestId: request.Id,
|
||||
Type: protocol.Response_HEARTBEAT.Enum(),
|
||||
}
|
||||
return self.WriteResponse(conn, response)
|
||||
default:
|
||||
log.Error("unknown request type: %v", request)
|
||||
|
|
|
@ -8,6 +8,8 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"code.google.com/p/goprotobuf/proto"
|
||||
|
||||
"github.com/influxdb/influxdb/common"
|
||||
"github.com/influxdb/influxdb/parser"
|
||||
"github.com/influxdb/influxdb/protocol"
|
||||
|
@ -1018,7 +1020,7 @@ func (self *ModeAggregator) GetValues(state interface{}) [][]*protocol.FieldValu
|
|||
case float64:
|
||||
returnValues = append(returnValues, []*protocol.FieldValue{{DoubleValue: &v}})
|
||||
case nil:
|
||||
returnValues = append(returnValues, []*protocol.FieldValue{{IsNull: &TRUE}})
|
||||
returnValues = append(returnValues, []*protocol.FieldValue{{IsNull: proto.Bool(true)}})
|
||||
}
|
||||
}
|
||||
// size is really "minimum size"
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package engine
|
||||
|
||||
import "github.com/influxdb/influxdb/protocol"
|
||||
|
||||
var queryResponse = protocol.Response_QUERY
|
|
@ -2,10 +2,6 @@ package engine
|
|||
|
||||
import "github.com/influxdb/influxdb/parser"
|
||||
|
||||
var (
|
||||
TRUE = true
|
||||
)
|
||||
|
||||
type SeriesState struct {
|
||||
started bool
|
||||
trie *Trie
|
||||
|
@ -13,10 +9,6 @@ type SeriesState struct {
|
|||
lastTimestamp int64
|
||||
}
|
||||
|
||||
const (
|
||||
POINT_BATCH_SIZE = 64
|
||||
)
|
||||
|
||||
func NewQueryEngine(next Processor, query *parser.SelectQuery) (Processor, error) {
|
||||
limit := query.Limit
|
||||
|
||||
|
|
Loading…
Reference in New Issue