remove commented code and fix double-NewAPI

This commit is contained in:
Matthew Jaffee 2018-04-10 09:40:28 -05:00
parent 07610560df
commit 401c9682b8
No known key found for this signature in database
GPG key ID: 51C676AF9FFCDB87
2 changed files with 1 additions and 70 deletions

View file

@ -1734,75 +1734,6 @@ type clusterResizeAbortResponse struct {
Info string `json:"info"`
}
// // InputJSONDataParser validates input json file and executes SetBit.
// func (h *Handler) InputJSONDataParser(req map[string]interface{}, index *Index, name string) (map[string][]*Bit, error) {
// inputDef, err := index.InputDefinition(name)
// if err != nil {
// return nil, err
// }
// // If field in input data is not in defined definition, return error.
// var colValue uint64
// validFields := make(map[string]bool)
// timestampFrame := make(map[string]int64)
// for _, field := range inputDef.Fields() {
// validFields[field.Name] = true
// if field.PrimaryKey {
// value, ok := req[field.Name]
// if !ok {
// return nil, fmt.Errorf("primary key does not exist")
// }
// rawValue, ok := value.(float64) // The default JSON marshalling will interpret this as a float
// if !ok {
// return nil, fmt.Errorf("float64 require, got value:%s, type: %s", value, reflect.TypeOf(value))
// }
// colValue = uint64(rawValue)
// }
// // Find frame that need to add timestamp.
// for _, action := range field.Actions {
// if action.ValueDestination == InputSetTimestamp {
// timestampFrame[action.Frame], err = GetTimeStamp(req, field.Name)
// if err != nil {
// return nil, err
// }
// }
// }
// }
// for key := range req {
// _, ok := validFields[key]
// if !ok {
// return nil, fmt.Errorf("field not found: %s", key)
// }
// }
// setBits := make(map[string][]*Bit)
// for _, field := range inputDef.Fields() {
// // skip field that defined in definition but not in input data
// if _, ok := req[field.Name]; !ok {
// continue
// }
// // Looking into timestampFrame map and set timestamp to the whole frame
// for _, action := range field.Actions {
// frame := action.Frame
// timestamp := timestampFrame[action.Frame]
// // Skip input data field values that are set to null
// if req[field.Name] == nil {
// continue
// }
// bit, err := HandleAction(action, req[field.Name], colValue, timestamp)
// if err != nil {
// return nil, fmt.Errorf("error handling action: %s, err: %s", action.ValueDestination, err)
// }
// if bit != nil {
// setBits[frame] = append(setBits[frame], bit)
// }
// }
// }
// return setBits, nil
// }
func (h *Handler) handleRecalculateCaches(w http.ResponseWriter, r *http.Request) {
err := h.API.RecalculateCaches(r.Context())
if err != nil {

View file

@ -41,7 +41,7 @@ func NewHandler() *Handler {
Handler: pilosa.NewHandler(),
}
h.API = pilosa.NewAPI()
h.Handler.API = pilosa.NewAPI()
h.Handler.API = h.API
h.Handler.API.Executor = &h.Executor
// Handler test messages can no-op.