Merge branch 'master' into mutexFixes

This commit is contained in:
tgruben 2021-09-07 12:45:04 -05:00 committed by GitHub
commit 2a3a5285de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,14 +33,14 @@ import (
"time"
"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/opentracing/opentracing-go"
"github.com/molecula/featurebase/v2"
pilosa "github.com/molecula/featurebase/v2"
"github.com/molecula/featurebase/v2/logger"
pnet "github.com/molecula/featurebase/v2/net"
"github.com/molecula/featurebase/v2/pb"
"github.com/molecula/featurebase/v2/pql"
"github.com/molecula/featurebase/v2/roaring"
"github.com/molecula/featurebase/v2/stats"
"github.com/opentracing/opentracing-go"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
@ -779,6 +779,34 @@ func (c *Client) readSchema() ([]SchemaIndex, error) {
return schemaInfo.Indexes, nil
}
func (c *Client) IngestSchema(reqBody map[string]interface{}) (body []byte, err error) {
data, err := json.Marshal(reqBody)
if err != nil {
return data, errors.Wrap(err, " error building Schema body to Ingest")
}
return c.IngestRequest("/internal/schema", data)
}
func (c *Client) IngestData(index string, reqBody []map[string]interface{}) (body []byte, err error) {
data, err := json.Marshal(reqBody)
if err != nil {
return data, errors.Wrap(err, " error building request body to Ingest")
}
return c.IngestRequest("/internal/ingest/"+index, data)
}
func (c *Client) IngestRequest(Uri string, data []byte) (body []byte, err error) {
var header = make(map[string]string)
header["Content-Type"] = "application/json"
header["Accept"] = "application/json"
header["User-Agent"] = "pilosa/" + pilosa.Version
_, body, err = c.HTTPRequest("POST", Uri, data, header)
if err != nil {
return nil, errors.Wrap(err, "requesting "+Uri)
}
return body, err
}
func (c *Client) shardsMax() (map[string]uint64, error) {
_, data, err := c.HTTPRequest("GET", "/internal/shards/max", nil, nil)
if err != nil {