From 48c0dbaee75bf5c9e13216add47c3e6d1cdc85b1 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 17 Oct 2017 11:35:01 +0300 Subject: [PATCH 1/9] Initial client refactoring --- client.go | 75 +++++++++++++++++++++++++----------------------- client_test.go | 35 ++++++++++++++-------- ctl/bench.go | 9 ++++-- executor.go | 60 ++++++++------------------------------ fragment.go | 6 +++- holder_test.go | 5 +++- server.go | 5 +++- test/executor.go | 3 +- uri.go | 5 ++++ uri_test.go | 11 +++++++ 10 files changed, 111 insertions(+), 103 deletions(-) diff --git a/client.go b/client.go index fbd0d3717..3babe2919 100644 --- a/client.go +++ b/client.go @@ -43,8 +43,8 @@ type ClientOptions struct { // Client represents a client to the Pilosa cluster. type Client struct { - host *URI - options *ClientOptions + defaultURI *URI + options *ClientOptions // The client to use for HTTP communication. HTTPClient *http.Client @@ -64,10 +64,7 @@ func NewClient(host string, options *ClientOptions) (*Client, error) { return NewClientFromURI(uri, options) } -func NewClientFromURI(uri *URI, options *ClientOptions) (*Client, error) { - if uri == nil { - return nil, ErrHostRequired - } +func NewClientFromURI(defaultURI *URI, options *ClientOptions) (*Client, error) { if options == nil { options = &ClientOptions{} } @@ -77,13 +74,13 @@ func NewClientFromURI(uri *URI, options *ClientOptions) (*Client, error) { } client := &http.Client{Transport: transport} return &Client{ - host: uri, + defaultURI: defaultURI, HTTPClient: client, }, nil } // Host returns the host the client was initialized with. -func (c *Client) Host() *URI { return c.host } +func (c *Client) Host() *URI { return c.defaultURI } // MaxSliceByIndex returns the number of slices on a server by index. func (c *Client) MaxSliceByIndex(ctx context.Context) (map[string]uint64, error) { @@ -98,7 +95,7 @@ func (c *Client) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, // maxSliceByIndex returns the number of slices on a server by index. func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string]uint64, error) { // Execute request against the host. - u := uriPathToURL(c.host, "/slices/max") + u := uriPathToURL(c.defaultURI, "/slices/max") u.RawQuery = (&url.Values{ "inverse": {strconv.FormatBool(inverse)}, }).Encode() @@ -131,7 +128,7 @@ func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string] // Schema returns all index and frame schema information. func (c *Client) Schema(ctx context.Context) ([]*IndexInfo, error) { // Execute request against the host. - u := uriPathToURL(c.host, "/schema") + u := uriPathToURL(c.defaultURI, "/schema") // Build request. req, err := http.NewRequest("GET", u.String(), nil) @@ -168,7 +165,7 @@ func (c *Client) CreateIndex(ctx context.Context, index string, opt IndexOptions } // Create URL & HTTP request. - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s", index)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s", index)) req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) if err != nil { return err @@ -205,7 +202,7 @@ func (c *Client) CreateIndex(ctx context.Context, index string, opt IndexOptions // FragmentNodes returns a list of nodes that own a slice. func (c *Client) FragmentNodes(ctx context.Context, index string, slice uint64) ([]*Node, error) { // Execute request against the host. - u := uriPathToURL(c.host, "/fragment/nodes") + u := uriPathToURL(c.defaultURI, "/fragment/nodes") u.RawQuery = (url.Values{"index": {index}, "slice": {strconv.FormatUint(slice, 10)}}).Encode() // Build request. @@ -234,28 +231,30 @@ func (c *Client) FragmentNodes(ctx context.Context, index string, slice uint64) } // ExecuteQuery executes query against index on the server. -func (c *Client) ExecuteQuery(ctx context.Context, index, query string, allowRedirect bool) (result interface{}, err error) { +func (c *Client) ExecuteQuery(ctx context.Context, index string, queryRequest *internal.QueryRequest) (*internal.QueryResponse, error) { if index == "" { return nil, ErrIndexRequired - } else if query == "" { + } else if queryRequest.Query == "" { return nil, ErrQueryRequired } - // Encode query request. - buf, err := proto.Marshal(&internal.QueryRequest{ - Query: query, - Remote: !allowRedirect, - }) - if err != nil { - return nil, fmt.Errorf("marshal: %s", err) - } - - // Create URL & HTTP request. - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/query", index)) - req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) + // Encode request object. + buf, err := proto.Marshal(queryRequest) if err != nil { return nil, err } + + // Create HTTP request. + clientURI := c.defaultURI + if contextURI, ok := ctx.Value("uri").(*URI); ok { + clientURI = contextURI + } + u := clientURI.Path(fmt.Sprintf("/index/%s/query", index)) + req, err := http.NewRequest("POST", u, bytes.NewReader(buf)) + if err != nil { + return nil, err + } + req.Header.Set("Content-Length", strconv.Itoa(len(buf))) req.Header.Set("Content-Type", "application/x-protobuf") req.Header.Set("Accept", "application/x-protobuf") @@ -276,8 +275,8 @@ func (c *Client) ExecuteQuery(ctx context.Context, index, query string, allowRed return nil, errors.New(string(body)) } - var qresp internal.QueryResponse - if err := proto.Unmarshal(body, &qresp); err != nil { + qresp := &internal.QueryResponse{} + if err := proto.Unmarshal(body, qresp); err != nil { return nil, fmt.Errorf("unmarshal response: %s", err) } else if s := qresp.Err; s != "" { return nil, errors.New(s) @@ -288,7 +287,7 @@ func (c *Client) ExecuteQuery(ctx context.Context, index, query string, allowRed // ExecutePQL executes query string against index on the server. func (c *Client) ExecutePQL(ctx context.Context, index, query string) (interface{}, error) { - u := uriPathToURL(c.host, "/query") + u := uriPathToURL(c.defaultURI, "/query") u.RawQuery = url.Values{"index": {index}}.Encode() req, err := http.NewRequest("POST", u.String(), bytes.NewReader([]byte(query))) @@ -811,7 +810,7 @@ func (c *Client) CreateFrame(ctx context.Context, index, frame string, opt Frame } // Create URL & HTTP request. - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/frame/%s", index, frame)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s", index, frame)) req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) if err != nil { return err @@ -847,7 +846,7 @@ func (c *Client) CreateFrame(ctx context.Context, index, frame string, opt Frame // RestoreFrame restores an entire frame from a host in another cluster. func (c *Client) RestoreFrame(ctx context.Context, host, index, frame string) error { - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/frame/%s/restore", index, frame)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/restore", index, frame)) u.RawQuery = url.Values{ "host": {host}, }.Encode() @@ -878,7 +877,7 @@ func (c *Client) RestoreFrame(ctx context.Context, host, index, frame string) er // FrameViews returns a list of view names for a frame. func (c *Client) FrameViews(ctx context.Context, index, frame string) ([]string, error) { // Create URL & HTTP request. - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/frame/%s/views", index, frame)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/views", index, frame)) req, err := http.NewRequest("GET", u.String(), nil) if err != nil { return nil, err @@ -914,7 +913,7 @@ func (c *Client) FrameViews(ctx context.Context, index, frame string) ([]string, // FragmentBlocks returns a list of block checksums for a fragment on a host. // Only returns blocks which contain data. func (c *Client) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error) { - u := uriPathToURL(c.host, "/fragment/blocks") + u := uriPathToURL(c.defaultURI, "/fragment/blocks") u.RawQuery = url.Values{ "index": {index}, "frame": {frame}, @@ -967,7 +966,7 @@ func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice return nil, nil, err } - u := uriPathToURL(c.host, "/fragment/block/data") + u := uriPathToURL(c.defaultURI, "/fragment/block/data") req, err := http.NewRequest("GET", u.String(), bytes.NewReader(buf)) if err != nil { return nil, nil, err @@ -1004,7 +1003,7 @@ func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice // ColumnAttrDiff returns data from differing blocks on a remote host. func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/attr/diff", index)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/attr/diff", index)) // Encode request. buf, err := json.Marshal(postIndexAttrDiffRequest{Blocks: blks}) @@ -1044,7 +1043,7 @@ func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBl // RowAttrDiff returns data from differing blocks on a remote host. func (c *Client) RowAttrDiff(ctx context.Context, index, frame string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { - u := uriPathToURL(c.host, fmt.Sprintf("/index/%s/frame/%s/attr/diff", index, frame)) + u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/attr/diff", index, frame)) // Encode request. buf, err := json.Marshal(postFrameAttrDiffRequest{Blocks: blks}) @@ -1229,3 +1228,7 @@ func nodePathToURL(node *Node, path string) url.URL { Path: path, } } + +type InternalClient interface { + ExecuteQuery(ctx context.Context, index string, queryRequest *internal.QueryRequest) (*internal.QueryResponse, error) +} diff --git a/client_test.go b/client_test.go index 70ea6c669..509039618 100644 --- a/client_test.go +++ b/client_test.go @@ -54,7 +54,10 @@ func TestClient_MultiNode(t *testing.T) { } s[0].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e := pilosa.NewExecutor(nil) + e, err := pilosa.NewExecutor(nil) + if err != nil { + t.Fatal(err) + } e.Holder = hldr[0].Holder e.Scheme = cluster.Nodes[0].Scheme e.Host = cluster.Nodes[0].Host @@ -62,7 +65,10 @@ func TestClient_MultiNode(t *testing.T) { return e.Execute(ctx, index, query, slices, opt) } s[1].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e := pilosa.NewExecutor(nil) + e, err := pilosa.NewExecutor(nil) + if err != nil { + t.Fatal(err) + } e.Holder = hldr[1].Holder e.Scheme = cluster.Nodes[1].Scheme e.Host = cluster.Nodes[1].Host @@ -70,7 +76,10 @@ func TestClient_MultiNode(t *testing.T) { return e.Execute(ctx, index, query, slices, opt) } s[2].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e := pilosa.NewExecutor(nil) + e, err := pilosa.NewExecutor(nil) + if err != nil { + t.Fatal(err) + } e.Holder = hldr[2].Holder e.Scheme = cluster.Nodes[2].Scheme e.Host = cluster.Nodes[2].Host @@ -140,15 +149,17 @@ func TestClient_MultiNode(t *testing.T) { client[2] = test.MustNewClient(s[2].Host()) topN := 4 - q := fmt.Sprintf(`TopN(frame="%s", n=%d)`, "f", topN) - - result, err := client[0].ExecuteQuery(context.Background(), "i", q, true) + queryRequest := &internal.QueryRequest{ + Query: fmt.Sprintf(`TopN(frame="%s", n=%d)`, "f", topN), + Remote: false, + } + result, err := client[0].ExecuteQuery(context.Background(), "i", queryRequest) if err != nil { t.Fatal(err) } // Check the results before every node has the correct max slice value. - pairs := result.(internal.QueryResponse).Results[0].Pairs + pairs := result.Results[0].Pairs for _, pair := range pairs { if pair.Key == 22 && pair.Count != 3 { t.Fatalf("Invalid Cluster wide MaxSlice prevents accurate calculation of %s", pair) @@ -160,13 +171,13 @@ func TestClient_MultiNode(t *testing.T) { hldr[1].Index("i").SetRemoteMaxSlice(maxSlice) hldr[2].Index("i").SetRemoteMaxSlice(maxSlice) - result, err = client[0].ExecuteQuery(context.Background(), "i", q, true) + result, err = client[0].ExecuteQuery(context.Background(), "i", queryRequest) if err != nil { t.Fatal(err) } // Test must return exactly N results. - if len(result.(internal.QueryResponse).Results[0].Pairs) != topN { + if len(result.Results[0].Pairs) != topN { t.Fatalf("unexpected number of TopN results: %s", spew.Sdump(result)) } p := []*internal.Pair{ @@ -176,15 +187,15 @@ func TestClient_MultiNode(t *testing.T) { {Key: 99, Count: 7}} // Valdidate the Top 4 result counts. - if !reflect.DeepEqual(result.(internal.QueryResponse).Results[0].Pairs, p) { + if !reflect.DeepEqual(result.Results[0].Pairs, p) { t.Fatalf("Invalid TopN result set: %s", spew.Sdump(result)) } - result1, err := client[1].ExecuteQuery(context.Background(), "i", q, true) + result1, err := client[1].ExecuteQuery(context.Background(), "i", queryRequest) if err != nil { t.Fatal(err) } - result2, err := client[2].ExecuteQuery(context.Background(), "i", q, true) + result2, err := client[2].ExecuteQuery(context.Background(), "i", queryRequest) if err != nil { t.Fatal(err) } diff --git a/ctl/bench.go b/ctl/bench.go index 24e6e7658..2f1e7a52f 100644 --- a/ctl/bench.go +++ b/ctl/bench.go @@ -23,6 +23,7 @@ import ( "time" "github.com/pilosa/pilosa" + "github.com/pilosa/pilosa/internal" ) // BenchCommand represents a command for benchmarking index operations. @@ -89,9 +90,11 @@ func (cmd *BenchCommand) runSetBit(ctx context.Context, client *pilosa.Client) e rowID := rand.Intn(maxRowID) columnID := rand.Intn(maxColumnID) - q := fmt.Sprintf(`SetBit(id=%d, frame="%s", columnID=%d)`, rowID, cmd.Frame, columnID) - - if _, err := client.ExecuteQuery(ctx, cmd.Index, q, true); err != nil { + queryRequest := &internal.QueryRequest{ + Query: fmt.Sprintf(`SetBit(id=%d, frame="%s", columnID=%d)`, rowID, cmd.Frame, columnID), + Remote: false, + } + if _, err := client.ExecuteQuery(ctx, cmd.Index, queryRequest); err != nil { return err } } diff --git a/executor.go b/executor.go index 64a068149..8d70cb2f1 100644 --- a/executor.go +++ b/executor.go @@ -15,16 +15,12 @@ package pilosa import ( - "bytes" "context" "errors" "fmt" - "io/ioutil" - "net/http" "sort" "time" - "github.com/gogo/protobuf/proto" "github.com/pilosa/pilosa/internal" "github.com/pilosa/pilosa/pql" ) @@ -47,26 +43,25 @@ type Executor struct { Host string Cluster *Cluster - // Client used for remote HTTP requests. - HTTPClient *http.Client + // Client used for remote requests. + client InternalClient // Maximum number of SetBit() or ClearBit() commands per request. MaxWritesPerRequest int } // NewExecutor returns a new instance of Executor. -func NewExecutor(clientOptions *ClientOptions) *Executor { +func NewExecutor(clientOptions *ClientOptions) (*Executor, error) { if clientOptions == nil { clientOptions = &ClientOptions{} } - transport := &http.Transport{} - if clientOptions.TLS != nil { - transport.TLSClientConfig = clientOptions.TLS + client, err := NewClientFromURI(nil, clientOptions) + if err != nil { + return nil, err } - client := &http.Client{Transport: transport} return &Executor{ - HTTPClient: client, - } + client: client, + }, nil } // Execute executes a PQL query. @@ -1377,48 +1372,17 @@ func (e *Executor) exec(ctx context.Context, node *Node, index string, q *pql.Qu Slices: slices, Remote: true, } - buf, err := proto.Marshal(pbreq) + uri, err := NewURIFromAddress(node.Host) if err != nil { return nil, err } - - // Create HTTP request. - u := nodePathToURL(node, fmt.Sprintf("/index/%s/query", index)) - u.Scheme = e.Scheme - req, err := http.NewRequest("POST", (&u).String(), bytes.NewReader(buf)) + uri.SetScheme(node.Scheme) + ctx = context.WithValue(ctx, "uri", uri) + pb, err := e.client.ExecuteQuery(ctx, index, pbreq) if err != nil { return nil, err } - // Require protobuf encoding. - req.Header.Set("Accept", "application/x-protobuf") - req.Header.Set("Content-Type", "application/x-protobuf") - req.Header.Set("User-Agent", "pilosa/"+Version) - - // Send request to remote node. - resp, err := e.HTTPClient.Do(req) - if err != nil { - return nil, err - } - defer resp.Body.Close() - - // Read response into buffer. - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - // Check status code. - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("invalid status Executor.exec: code=%d, err=%s, req: %v", resp.StatusCode, body, req) - } - - // Decode response object. - var pb internal.QueryResponse - if err := proto.Unmarshal(body, &pb); err != nil { - return nil, err - } - // Return an error, if specified on response. if err := decodeError(pb.Err); err != nil { return nil, err diff --git a/fragment.go b/fragment.go index 67f9ff000..cdc8c00ff 100644 --- a/fragment.go +++ b/fragment.go @@ -1848,7 +1848,11 @@ func (s *FragmentSyncer) syncBlock(id int) error { } // Execute query. - _, err := clients[i].ExecuteQuery(context.Background(), f.Index(), buf.String(), false) + queryRequest := &internal.QueryRequest{ + Query: buf.String(), + Remote: true, + } + _, err := clients[i].ExecuteQuery(context.Background(), f.Index(), queryRequest) if err != nil { return err } diff --git a/holder_test.go b/holder_test.go index 104bd1bb0..cb33045e6 100644 --- a/holder_test.go +++ b/holder_test.go @@ -314,7 +314,10 @@ func TestHolderSyncer_SyncHolder(t *testing.T) { defer s.Close() s.Handler.Holder = hldr1.Holder s.Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e := pilosa.NewExecutor(nil) + e, err := pilosa.NewExecutor(nil) + if err != nil { + t.Fatal(err) + } e.Holder = hldr1.Holder e.Scheme = cluster.Nodes[1].Scheme e.Host = cluster.Nodes[1].Host diff --git a/server.go b/server.go index 773cf9025..e73354cf2 100644 --- a/server.go +++ b/server.go @@ -164,7 +164,10 @@ func (s *Server) Open() error { s.createDefaultClient() // Create executor for executing queries. - e := NewExecutor(&ClientOptions{TLS: s.TLS}) + e, err := NewExecutor(&ClientOptions{TLS: s.TLS}) + if err != nil { + return err + } e.Holder = s.Holder e.Scheme = s.URI.Scheme() e.Host = s.URI.HostPort() diff --git a/test/executor.go b/test/executor.go index 73445a1cd..4ef99d351 100644 --- a/test/executor.go +++ b/test/executor.go @@ -15,7 +15,8 @@ type Executor struct { // NewExecutor returns a new instance of Executor. // The executor always matches the hostname of the first cluster node. func NewExecutor(holder *pilosa.Holder, cluster *pilosa.Cluster) *Executor { - e := &Executor{Executor: pilosa.NewExecutor(nil)} + executor, _ := pilosa.NewExecutor(nil) + e := &Executor{Executor: executor} e.Holder = holder e.Cluster = cluster e.Scheme = cluster.Nodes[0].Scheme diff --git a/uri.go b/uri.go index de6e4bae6..ee5d23d75 100644 --- a/uri.go +++ b/uri.go @@ -144,6 +144,11 @@ func (u URI) Equals(other *URI) bool { u.port == other.port } +// Path returns URI with path +func (u *URI) Path(path string) string { + return fmt.Sprintf("%s%s", u.Normalize(), path) +} + // The following methods are required to implement pflag Value interface. // Set sets the time quantum value. diff --git a/uri_test.go b/uri_test.go index 33ccd35f9..70ea3f273 100644 --- a/uri_test.go +++ b/uri_test.go @@ -83,6 +83,17 @@ func TestNormalizedAddress(t *testing.T) { } } +func TestURIPath(t *testing.T) { + uri, err := NewURIFromAddress("http+protobuf://big-data.pilosa.com:6888") + if err != nil { + t.Fatal(err) + } + target := "http://big-data.pilosa.com:6888/index/foo" + if uri.Path("/index/foo") != target { + t.Fatalf("%s != %s", uri.Path("/index/foo"), target) + } +} + func TestEquals(t *testing.T) { uri1 := DefaultURI() if uri1.Equals(nil) { From 0f8f59637623abe648367958506b289fb36073ae Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 17 Oct 2017 12:07:45 +0300 Subject: [PATCH 2/9] Trivial NewClientFromURI simplification --- client.go | 7 ++++--- executor.go | 6 +----- handler.go | 6 +----- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/client.go b/client.go index 3babe2919..70cb18047 100644 --- a/client.go +++ b/client.go @@ -61,10 +61,11 @@ func NewClient(host string, options *ClientOptions) (*Client, error) { return nil, err } - return NewClientFromURI(uri, options) + client := NewClientFromURI(uri, options) + return client, nil } -func NewClientFromURI(defaultURI *URI, options *ClientOptions) (*Client, error) { +func NewClientFromURI(defaultURI *URI, options *ClientOptions) *Client { if options == nil { options = &ClientOptions{} } @@ -76,7 +77,7 @@ func NewClientFromURI(defaultURI *URI, options *ClientOptions) (*Client, error) return &Client{ defaultURI: defaultURI, HTTPClient: client, - }, nil + } } // Host returns the host the client was initialized with. diff --git a/executor.go b/executor.go index 8d70cb2f1..7aee4e472 100644 --- a/executor.go +++ b/executor.go @@ -55,12 +55,8 @@ func NewExecutor(clientOptions *ClientOptions) (*Executor, error) { if clientOptions == nil { clientOptions = &ClientOptions{} } - client, err := NewClientFromURI(nil, clientOptions) - if err != nil { - return nil, err - } return &Executor{ - client: client, + client: NewClientFromURI(nil, clientOptions), }, nil } diff --git a/handler.go b/handler.go index 016e3a348..811ab14f1 100644 --- a/handler.go +++ b/handler.go @@ -1506,11 +1506,7 @@ func (h *Handler) handlePostFrameRestore(w http.ResponseWriter, r *http.Request) } // Create a client for the remote cluster. - client, err := NewClientFromURI(host, h.ClientOptions) - if err != nil { - http.Error(w, err.Error(), http.StatusInternalServerError) - return - } + client := NewClientFromURI(host, h.ClientOptions) // Determine the maximum number of slices. maxSlices, err := client.MaxSliceByIndex(r.Context()) From c9f526f5bf42c755e6767bc823fad8761ee40e55 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 17 Oct 2017 14:56:43 +0300 Subject: [PATCH 3/9] Removed unused Client.ExecutePQL function --- client.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/client.go b/client.go index 70cb18047..af28b068c 100644 --- a/client.go +++ b/client.go @@ -286,34 +286,6 @@ func (c *Client) ExecuteQuery(ctx context.Context, index string, queryRequest *i return qresp, nil } -// ExecutePQL executes query string against index on the server. -func (c *Client) ExecutePQL(ctx context.Context, index, query string) (interface{}, error) { - u := uriPathToURL(c.defaultURI, "/query") - u.RawQuery = url.Values{"index": {index}}.Encode() - - req, err := http.NewRequest("POST", u.String(), bytes.NewReader([]byte(query))) - if err != nil { - return nil, err - } - req.Header.Set("User-Agent", "pilosa/"+Version) - - resp, err := c.HTTPClient.Do(req.WithContext(ctx)) - - if err != nil { - return nil, err - } - defer resp.Body.Close() - - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } else if resp.StatusCode != http.StatusOK { - return nil, errors.New(string(body)) - } - return string(body), nil - -} - // Import bulk imports bits for a single slice to a host. func (c *Client) Import(ctx context.Context, index, frame string, slice uint64, bits []Bit) error { if index == "" { From e201afe241668c147fe4529e8457ec17dc421f45 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 17 Oct 2017 15:53:42 +0300 Subject: [PATCH 4/9] Replaced all http.Clients with InternalClient; updated InternalClient interface. --- client.go | 52 +++++++++++++++++++++++++++++++++++++-------------- ctl/bench.go | 2 +- ctl/import.go | 2 +- fragment.go | 2 +- server.go | 32 +++++++------------------------ 5 files changed, 48 insertions(+), 42 deletions(-) diff --git a/client.go b/client.go index af28b068c..74e051758 100644 --- a/client.go +++ b/client.go @@ -96,7 +96,7 @@ func (c *Client) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, // maxSliceByIndex returns the number of slices on a server by index. func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string]uint64, error) { // Execute request against the host. - u := uriPathToURL(c.defaultURI, "/slices/max") + u := uriPathToURL(c.clientURI(ctx), "/slices/max") u.RawQuery = (&url.Values{ "inverse": {strconv.FormatBool(inverse)}, }).Encode() @@ -129,10 +129,10 @@ func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string] // Schema returns all index and frame schema information. func (c *Client) Schema(ctx context.Context) ([]*IndexInfo, error) { // Execute request against the host. - u := uriPathToURL(c.defaultURI, "/schema") + u := c.defaultURI.Path("/schema") // Build request. - req, err := http.NewRequest("GET", u.String(), nil) + req, err := http.NewRequest("GET", u, nil) if err != nil { return nil, err } @@ -246,11 +246,7 @@ func (c *Client) ExecuteQuery(ctx context.Context, index string, queryRequest *i } // Create HTTP request. - clientURI := c.defaultURI - if contextURI, ok := ctx.Value("uri").(*URI); ok { - clientURI = contextURI - } - u := clientURI.Path(fmt.Sprintf("/index/%s/query", index)) + u := c.clientURI(ctx).Path(fmt.Sprintf("/index/%s/query", index)) req, err := http.NewRequest("POST", u, bytes.NewReader(buf)) if err != nil { return nil, err @@ -294,7 +290,7 @@ func (c *Client) Import(ctx context.Context, index, frame string, slice uint64, return ErrFrameRequired } - buf, err := MarshalImportPayload(index, frame, slice, bits) + buf, err := marshalImportPayload(index, frame, slice, bits) if err != nil { return fmt.Errorf("Error Creating Payload: %s", err) } @@ -331,8 +327,8 @@ func (c *Client) EnsureFrame(ctx context.Context, indexName string, frameName st return err } -// MarshalImportPayload marshalls the import parameters into a protobuf byte slice. -func MarshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte, error) { +// marshalImportPayload marshalls the import parameters into a protobuf byte slice. +func marshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte, error) { // Separate row and column IDs to reduce allocations. rowIDs := Bits(bits).RowIDs() columnIDs := Bits(bits).ColumnIDs() @@ -399,7 +395,7 @@ func (c *Client) ImportValue(ctx context.Context, index, frame, field string, sl return ErrFrameRequired } - buf, err := MarshalImportValuePayload(index, frame, field, slice, vals) + buf, err := marshalImportValuePayload(index, frame, field, slice, vals) if err != nil { return fmt.Errorf("Error Creating Payload: %s", err) } @@ -420,8 +416,8 @@ func (c *Client) ImportValue(ctx context.Context, index, frame, field string, sl return nil } -// MarshalImportValuePayload marshalls the import parameters into a protobuf byte slice. -func MarshalImportValuePayload(index, frame, field string, slice uint64, vals []FieldValue) ([]byte, error) { +// marshalImportValuePayload marshalls the import parameters into a protobuf byte slice. +func marshalImportValuePayload(index, frame, field string, slice uint64, vals []FieldValue) ([]byte, error) { // Separate row and column IDs to reduce allocations. columnIDs := FieldValues(vals).ColumnIDs() values := FieldValues(vals).Values() @@ -1056,6 +1052,14 @@ func (c *Client) RowAttrDiff(ctx context.Context, index, frame string, blks []At return rsp.Attrs, nil } +func (c *Client) clientURI(ctx context.Context) *URI { + clientURI := c.defaultURI + if contextURI, ok := ctx.Value("uri").(*URI); ok { + clientURI = contextURI + } + return clientURI +} + // Bit represents the location of a single bit. type Bit struct { RowID uint64 @@ -1203,5 +1207,25 @@ func nodePathToURL(node *Node, path string) url.URL { } type InternalClient interface { + MaxSliceByIndex(ctx context.Context) (map[string]uint64, error) + MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, error) + Schema(ctx context.Context) ([]*IndexInfo, error) + CreateIndex(ctx context.Context, index string, opt IndexOptions) error + FragmentNodes(ctx context.Context, index string, slice uint64) ([]*Node, error) ExecuteQuery(ctx context.Context, index string, queryRequest *internal.QueryRequest) (*internal.QueryResponse, error) + Import(ctx context.Context, index, frame string, slice uint64, bits []Bit) error + EnsureIndex(ctx context.Context, name string, options IndexOptions) error + EnsureFrame(ctx context.Context, indexName string, frameName string, options FrameOptions) error + ImportValue(ctx context.Context, index, frame, field string, slice uint64, vals []FieldValue) error + ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error + BackupTo(ctx context.Context, w io.Writer, index, frame, view string) error + BackupSlice(ctx context.Context, index, frame, view string, slice uint64) (io.ReadCloser, error) + RestoreFrom(ctx context.Context, r io.Reader, index, frame, view string) error + CreateFrame(ctx context.Context, index, frame string, opt FrameOptions) error + RestoreFrame(ctx context.Context, host, index, frame string) error + FrameViews(ctx context.Context, index, frame string) ([]string, error) + FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error) + BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error) + ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) + RowAttrDiff(ctx context.Context, index, frame string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) } diff --git a/ctl/bench.go b/ctl/bench.go index 2f1e7a52f..01e07cc14 100644 --- a/ctl/bench.go +++ b/ctl/bench.go @@ -71,7 +71,7 @@ func (cmd *BenchCommand) Run(ctx context.Context) error { } // runSetBit executes a benchmark of random SetBit() operations. -func (cmd *BenchCommand) runSetBit(ctx context.Context, client *pilosa.Client) error { +func (cmd *BenchCommand) runSetBit(ctx context.Context, client pilosa.InternalClient) error { if cmd.N == 0 { return errors.New("operation count required") } else if cmd.Index == "" { diff --git a/ctl/import.go b/ctl/import.go index e3eda260e..d2f888956 100644 --- a/ctl/import.go +++ b/ctl/import.go @@ -58,7 +58,7 @@ type ImportCommand struct { Sort bool `json:"sort"` // Reusable client. - Client *pilosa.Client `json:"-"` + Client pilosa.InternalClient `json:"-"` // Standard input/output *pilosa.CmdIO diff --git a/fragment.go b/fragment.go index cdc8c00ff..148fd6a48 100644 --- a/fragment.go +++ b/fragment.go @@ -1782,7 +1782,7 @@ func (s *FragmentSyncer) syncBlock(id int) error { // Read pairs from each remote block. var pairSets []PairSet - var clients []*Client + var clients []InternalClient for _, node := range s.Cluster.FragmentNodes(f.Index(), f.Slice()) { if s.Host == node.Host { continue diff --git a/server.go b/server.go index e73354cf2..3ce2883c3 100644 --- a/server.go +++ b/server.go @@ -19,7 +19,6 @@ import ( "errors" "fmt" "io" - "io/ioutil" "log" "net" "net/http" @@ -35,6 +34,7 @@ import ( "github.com/CAFxX/gcnotifier" "github.com/gogo/protobuf/proto" "github.com/pilosa/pilosa/internal" + "golang.org/x/net/context" ) // Default server settings. @@ -76,7 +76,7 @@ type Server struct { LogOutput io.Writer - defaultClient *http.Client + defaultClient InternalClient } // NewServer returns a new instance of Server. @@ -483,31 +483,13 @@ func (s *Server) checkMaxSlices(scheme string, hostPort string) (map[string]uint req.Header.Set("Content-Type", "application/x-protobuf") req.Header.Set("User-Agent", "pilosa/"+Version) - resp, err := s.defaultClient.Do(req) + nodeURI, err := NewURIFromAddress(hostPort) if err != nil { return nil, err } - defer resp.Body.Close() - - // Read response into buffer. - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, err - } - - // Check status code. - if resp.StatusCode != http.StatusOK { - return nil, fmt.Errorf("invalid status checkMaxSlices: code=%d, err=%s, req=%v", resp.StatusCode, body, req) - } - - // Decode response object. - pb := internal.MaxSlicesResponse{} - - if err = proto.Unmarshal(body, &pb); err != nil { - return nil, err - } - - return pb.MaxSlices, nil + nodeURI.SetScheme(scheme) + ctx := context.WithValue(context.Background(), "uri", nodeURI) + return s.defaultClient.MaxSliceByIndex(ctx) } // monitorRuntime periodically polls the Go runtime metrics. @@ -558,7 +540,7 @@ func (s *Server) createDefaultClient() { if s.TLS != nil { transport.TLSClientConfig = s.TLS } - s.defaultClient = &http.Client{Transport: transport} + s.defaultClient = NewClientFromURI(nil, &ClientOptions{TLS: s.TLS}) } // CountOpenFiles on opperating systems that support lsof From 838d56011cb411ea98fb7919a385b07cc446a8ab Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 17 Oct 2017 16:04:42 +0300 Subject: [PATCH 5/9] Renamed Client to InternalHTTPClient --- client.go | 74 +++++++++++++++++++++---------------------- ctl/common.go | 4 +-- server/server_test.go | 2 +- test/client.go | 4 +-- 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/client.go b/client.go index 74e051758..8528e52dd 100644 --- a/client.go +++ b/client.go @@ -36,13 +36,13 @@ import ( "github.com/pilosa/pilosa/internal" ) -// ClientOptions represents the configuration for a Client +// ClientOptions represents the configuration for a InternalHTTPClient type ClientOptions struct { TLS *tls.Config } -// Client represents a client to the Pilosa cluster. -type Client struct { +// InternalHTTPClient represents a client to the Pilosa cluster. +type InternalHTTPClient struct { defaultURI *URI options *ClientOptions @@ -50,8 +50,8 @@ type Client struct { HTTPClient *http.Client } -// NewClient returns a new instance of Client to connect to host. -func NewClient(host string, options *ClientOptions) (*Client, error) { +// NewClient returns a new instance of InternalHTTPClient to connect to host. +func NewClient(host string, options *ClientOptions) (*InternalHTTPClient, error) { if host == "" { return nil, ErrHostRequired } @@ -65,7 +65,7 @@ func NewClient(host string, options *ClientOptions) (*Client, error) { return client, nil } -func NewClientFromURI(defaultURI *URI, options *ClientOptions) *Client { +func NewClientFromURI(defaultURI *URI, options *ClientOptions) *InternalHTTPClient { if options == nil { options = &ClientOptions{} } @@ -74,27 +74,27 @@ func NewClientFromURI(defaultURI *URI, options *ClientOptions) *Client { transport.TLSClientConfig = options.TLS } client := &http.Client{Transport: transport} - return &Client{ + return &InternalHTTPClient{ defaultURI: defaultURI, HTTPClient: client, } } // Host returns the host the client was initialized with. -func (c *Client) Host() *URI { return c.defaultURI } +func (c *InternalHTTPClient) Host() *URI { return c.defaultURI } // MaxSliceByIndex returns the number of slices on a server by index. -func (c *Client) MaxSliceByIndex(ctx context.Context) (map[string]uint64, error) { +func (c *InternalHTTPClient) MaxSliceByIndex(ctx context.Context) (map[string]uint64, error) { return c.maxSliceByIndex(ctx, false) } // MaxInverseSliceByIndex returns the number of inverse slices on a server by index. -func (c *Client) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, error) { +func (c *InternalHTTPClient) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, error) { return c.maxSliceByIndex(ctx, true) } // maxSliceByIndex returns the number of slices on a server by index. -func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string]uint64, error) { +func (c *InternalHTTPClient) maxSliceByIndex(ctx context.Context, inverse bool) (map[string]uint64, error) { // Execute request against the host. u := uriPathToURL(c.clientURI(ctx), "/slices/max") u.RawQuery = (&url.Values{ @@ -127,7 +127,7 @@ func (c *Client) maxSliceByIndex(ctx context.Context, inverse bool) (map[string] } // Schema returns all index and frame schema information. -func (c *Client) Schema(ctx context.Context) ([]*IndexInfo, error) { +func (c *InternalHTTPClient) Schema(ctx context.Context) ([]*IndexInfo, error) { // Execute request against the host. u := c.defaultURI.Path("/schema") @@ -156,7 +156,7 @@ func (c *Client) Schema(ctx context.Context) ([]*IndexInfo, error) { } // CreateIndex creates a new index on the server. -func (c *Client) CreateIndex(ctx context.Context, index string, opt IndexOptions) error { +func (c *InternalHTTPClient) CreateIndex(ctx context.Context, index string, opt IndexOptions) error { // Encode query request. buf, err := json.Marshal(&postIndexRequest{ Options: opt, @@ -201,7 +201,7 @@ func (c *Client) CreateIndex(ctx context.Context, index string, opt IndexOptions } // FragmentNodes returns a list of nodes that own a slice. -func (c *Client) FragmentNodes(ctx context.Context, index string, slice uint64) ([]*Node, error) { +func (c *InternalHTTPClient) FragmentNodes(ctx context.Context, index string, slice uint64) ([]*Node, error) { // Execute request against the host. u := uriPathToURL(c.defaultURI, "/fragment/nodes") u.RawQuery = (url.Values{"index": {index}, "slice": {strconv.FormatUint(slice, 10)}}).Encode() @@ -232,7 +232,7 @@ func (c *Client) FragmentNodes(ctx context.Context, index string, slice uint64) } // ExecuteQuery executes query against index on the server. -func (c *Client) ExecuteQuery(ctx context.Context, index string, queryRequest *internal.QueryRequest) (*internal.QueryResponse, error) { +func (c *InternalHTTPClient) ExecuteQuery(ctx context.Context, index string, queryRequest *internal.QueryRequest) (*internal.QueryResponse, error) { if index == "" { return nil, ErrIndexRequired } else if queryRequest.Query == "" { @@ -283,7 +283,7 @@ func (c *Client) ExecuteQuery(ctx context.Context, index string, queryRequest *i } // Import bulk imports bits for a single slice to a host. -func (c *Client) Import(ctx context.Context, index, frame string, slice uint64, bits []Bit) error { +func (c *InternalHTTPClient) Import(ctx context.Context, index, frame string, slice uint64, bits []Bit) error { if index == "" { return ErrIndexRequired } else if frame == "" { @@ -311,7 +311,7 @@ func (c *Client) Import(ctx context.Context, index, frame string, slice uint64, return nil } -func (c *Client) EnsureIndex(ctx context.Context, name string, options IndexOptions) error { +func (c *InternalHTTPClient) EnsureIndex(ctx context.Context, name string, options IndexOptions) error { err := c.CreateIndex(ctx, name, options) if err == nil || err == ErrIndexExists { return nil @@ -319,7 +319,7 @@ func (c *Client) EnsureIndex(ctx context.Context, name string, options IndexOpti return err } -func (c *Client) EnsureFrame(ctx context.Context, indexName string, frameName string, options FrameOptions) error { +func (c *InternalHTTPClient) EnsureFrame(ctx context.Context, indexName string, frameName string, options FrameOptions) error { err := c.CreateFrame(ctx, indexName, frameName, options) if err == nil || err == ErrFrameExists { return nil @@ -350,7 +350,7 @@ func marshalImportPayload(index, frame string, slice uint64, bits []Bit) ([]byte } // importNode sends a pre-marshaled import request to a node. -func (c *Client) importNode(ctx context.Context, node *Node, buf []byte) error { +func (c *InternalHTTPClient) importNode(ctx context.Context, node *Node, buf []byte) error { // Create URL & HTTP request. u := nodePathToURL(node, "/import") req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) @@ -388,7 +388,7 @@ func (c *Client) importNode(ctx context.Context, node *Node, buf []byte) error { } // ImportValue bulk imports field values for a single slice to a host. -func (c *Client) ImportValue(ctx context.Context, index, frame, field string, slice uint64, vals []FieldValue) error { +func (c *InternalHTTPClient) ImportValue(ctx context.Context, index, frame, field string, slice uint64, vals []FieldValue) error { if index == "" { return ErrIndexRequired } else if frame == "" { @@ -438,7 +438,7 @@ func marshalImportValuePayload(index, frame, field string, slice uint64, vals [] } // importValueNode sends a pre-marshaled import request to a node. -func (c *Client) importValueNode(ctx context.Context, node *Node, buf []byte) error { +func (c *InternalHTTPClient) importValueNode(ctx context.Context, node *Node, buf []byte) error { // Create URL & HTTP request. u := nodePathToURL(node, "/import-value") req, err := http.NewRequest("POST", u.String(), bytes.NewReader(buf)) @@ -476,7 +476,7 @@ func (c *Client) importValueNode(ctx context.Context, node *Node, buf []byte) er } // ExportCSV bulk exports data for a single slice from a host to CSV format. -func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error { +func (c *InternalHTTPClient) ExportCSV(ctx context.Context, index, frame, view string, slice uint64, w io.Writer) error { if index == "" { return ErrIndexRequired } else if frame == "" { @@ -508,7 +508,7 @@ func (c *Client) ExportCSV(ctx context.Context, index, frame, view string, slice } // exportNode copies a CSV export from a node to w. -func (c *Client) exportNodeCSV(ctx context.Context, node *Node, index, frame, view string, slice uint64, w io.Writer) error { +func (c *InternalHTTPClient) exportNodeCSV(ctx context.Context, node *Node, index, frame, view string, slice uint64, w io.Writer) error { // Create URL. u := nodePathToURL(node, "/export") u.RawQuery = url.Values{ @@ -547,7 +547,7 @@ func (c *Client) exportNodeCSV(ctx context.Context, node *Node, index, frame, vi } // BackupTo backs up an entire frame from a cluster to w. -func (c *Client) BackupTo(ctx context.Context, w io.Writer, index, frame, view string) error { +func (c *InternalHTTPClient) BackupTo(ctx context.Context, w io.Writer, index, frame, view string) error { if index == "" { return ErrIndexRequired } else if frame == "" { @@ -588,7 +588,7 @@ func (c *Client) BackupTo(ctx context.Context, w io.Writer, index, frame, view s } // backupSliceTo backs up a single slice to tw. -func (c *Client) backupSliceTo(ctx context.Context, tw *tar.Writer, index, frame, view string, slice uint64) error { +func (c *InternalHTTPClient) backupSliceTo(ctx context.Context, tw *tar.Writer, index, frame, view string, slice uint64) error { // Return error if unable to backup from any slice. r, err := c.BackupSlice(ctx, index, frame, view, slice) if err != nil { @@ -626,7 +626,7 @@ func (c *Client) backupSliceTo(ctx context.Context, tw *tar.Writer, index, frame // BackupSlice retrieves a streaming backup from a single slice. // This function tries slice owners until one succeeds. -func (c *Client) BackupSlice(ctx context.Context, index, frame, view string, slice uint64) (io.ReadCloser, error) { +func (c *InternalHTTPClient) BackupSlice(ctx context.Context, index, frame, view string, slice uint64) (io.ReadCloser, error) { // Retrieve a list of nodes that own the slice. nodes, err := c.FragmentNodes(ctx, index, slice) if err != nil { @@ -649,7 +649,7 @@ func (c *Client) BackupSlice(ctx context.Context, index, frame, view string, sli return nil, fmt.Errorf("unable to connect to any owner") } -func (c *Client) backupSliceNode(ctx context.Context, index, frame, view string, slice uint64, node *Node) (io.ReadCloser, error) { +func (c *InternalHTTPClient) backupSliceNode(ctx context.Context, index, frame, view string, slice uint64, node *Node) (io.ReadCloser, error) { u := nodePathToURL(node, "/fragment/data") u.RawQuery = url.Values{ "index": {index}, @@ -685,7 +685,7 @@ func (c *Client) backupSliceNode(ctx context.Context, index, frame, view string, } // RestoreFrom restores a frame from a backup file to an entire cluster. -func (c *Client) RestoreFrom(ctx context.Context, r io.Reader, index, frame, view string) error { +func (c *InternalHTTPClient) RestoreFrom(ctx context.Context, r io.Reader, index, frame, view string) error { if index == "" { return ErrIndexRequired } else if frame == "" { @@ -724,7 +724,7 @@ func (c *Client) RestoreFrom(ctx context.Context, r io.Reader, index, frame, vie } // restoreSliceFrom restores a single slice to all owning nodes. -func (c *Client) restoreSliceFrom(ctx context.Context, buf []byte, index, frame, view string, slice uint64) error { +func (c *InternalHTTPClient) restoreSliceFrom(ctx context.Context, buf []byte, index, frame, view string, slice uint64) error { // Retrieve a list of nodes that own the slice. nodes, err := c.FragmentNodes(ctx, index, slice) if err != nil { @@ -765,7 +765,7 @@ func (c *Client) restoreSliceFrom(ctx context.Context, buf []byte, index, frame, } // CreateFrame creates a new frame on the server. -func (c *Client) CreateFrame(ctx context.Context, index, frame string, opt FrameOptions) error { +func (c *InternalHTTPClient) CreateFrame(ctx context.Context, index, frame string, opt FrameOptions) error { if index == "" { return ErrIndexRequired } @@ -814,7 +814,7 @@ func (c *Client) CreateFrame(ctx context.Context, index, frame string, opt Frame } // RestoreFrame restores an entire frame from a host in another cluster. -func (c *Client) RestoreFrame(ctx context.Context, host, index, frame string) error { +func (c *InternalHTTPClient) RestoreFrame(ctx context.Context, host, index, frame string) error { u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/restore", index, frame)) u.RawQuery = url.Values{ "host": {host}, @@ -844,7 +844,7 @@ func (c *Client) RestoreFrame(ctx context.Context, host, index, frame string) er } // FrameViews returns a list of view names for a frame. -func (c *Client) FrameViews(ctx context.Context, index, frame string) ([]string, error) { +func (c *InternalHTTPClient) FrameViews(ctx context.Context, index, frame string) ([]string, error) { // Create URL & HTTP request. u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/views", index, frame)) req, err := http.NewRequest("GET", u.String(), nil) @@ -881,7 +881,7 @@ func (c *Client) FrameViews(ctx context.Context, index, frame string) ([]string, // FragmentBlocks returns a list of block checksums for a fragment on a host. // Only returns blocks which contain data. -func (c *Client) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error) { +func (c *InternalHTTPClient) FragmentBlocks(ctx context.Context, index, frame, view string, slice uint64) ([]FragmentBlock, error) { u := uriPathToURL(c.defaultURI, "/fragment/blocks") u.RawQuery = url.Values{ "index": {index}, @@ -923,7 +923,7 @@ func (c *Client) FragmentBlocks(ctx context.Context, index, frame, view string, } // BlockData returns row/column id pairs for a block. -func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error) { +func (c *InternalHTTPClient) BlockData(ctx context.Context, index, frame, view string, slice uint64, block int) ([]uint64, []uint64, error) { buf, err := proto.Marshal(&internal.BlockDataRequest{ Index: index, Frame: frame, @@ -971,7 +971,7 @@ func (c *Client) BlockData(ctx context.Context, index, frame, view string, slice } // ColumnAttrDiff returns data from differing blocks on a remote host. -func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { +func (c *InternalHTTPClient) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/attr/diff", index)) // Encode request. @@ -1011,7 +1011,7 @@ func (c *Client) ColumnAttrDiff(ctx context.Context, index string, blks []AttrBl } // RowAttrDiff returns data from differing blocks on a remote host. -func (c *Client) RowAttrDiff(ctx context.Context, index, frame string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { +func (c *InternalHTTPClient) RowAttrDiff(ctx context.Context, index, frame string, blks []AttrBlock) (map[uint64]map[string]interface{}, error) { u := uriPathToURL(c.defaultURI, fmt.Sprintf("/index/%s/frame/%s/attr/diff", index, frame)) // Encode request. @@ -1052,7 +1052,7 @@ func (c *Client) RowAttrDiff(ctx context.Context, index, frame string, blks []At return rsp.Attrs, nil } -func (c *Client) clientURI(ctx context.Context) *URI { +func (c *InternalHTTPClient) clientURI(ctx context.Context) *URI { clientURI := c.defaultURI if contextURI, ok := ctx.Value("uri").(*URI); ok { clientURI = contextURI diff --git a/ctl/common.go b/ctl/common.go index 975f19898..52b4e6e7e 100644 --- a/ctl/common.go +++ b/ctl/common.go @@ -19,8 +19,8 @@ func SetTLSConfig(flags *pflag.FlagSet, certificatePath *string, certificateKeyP flags.BoolVarP(skipVerify, "tls.skip-verify", "", false, "Skip TLS certificate verification (not secure)") } -// CommandClient returns a pilosa.Client for the command -func CommandClient(cmd CommandWithTLSSupport) (*pilosa.Client, error) { +// CommandClient returns a pilosa.InternalHTTPClient for the command +func CommandClient(cmd CommandWithTLSSupport) (*pilosa.InternalHTTPClient, error) { tlsConfig := cmd.TLSConfiguration() var clientOptions *pilosa.ClientOptions if tlsConfig.CertificatePath != "" && tlsConfig.CertificateKeyPath != "" { diff --git a/server/server_test.go b/server/server_test.go index a5de5d68c..f03e3331b 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -696,7 +696,7 @@ func (m *Main) Reopen() error { func (m *Main) URL() string { return "http://" + m.Server.Addr().String() } // Client returns a client to connect to the program. -func (m *Main) Client() *pilosa.Client { +func (m *Main) Client() *pilosa.InternalHTTPClient { client, err := pilosa.NewClient(m.Server.URI.HostPort(), nil) if err != nil { panic(err) diff --git a/test/client.go b/test/client.go index 10ef6368e..d9044df66 100644 --- a/test/client.go +++ b/test/client.go @@ -6,7 +6,7 @@ import ( // Client represents a test wrapper for pilosa.Client. type Client struct { - *pilosa.Client + *pilosa.InternalHTTPClient } // MustNewClient returns a new instance of Client. Panic on error. @@ -15,5 +15,5 @@ func MustNewClient(host string) *Client { if err != nil { panic(err) } - return &Client{Client: c} + return &Client{InternalHTTPClient: c} } From 66650ec1f727fd48b425060dc13f488aacc0ab15 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 18 Oct 2017 17:38:20 +0300 Subject: [PATCH 6/9] NewExecutor doesn't return an error; renamed NewClient to NewInternalHTTPClient --- client.go | 4 ++-- client_test.go | 15 +++------------ ctl/common.go | 2 +- executor.go | 4 ++-- fragment.go | 4 ++-- holder.go | 4 ++-- holder_test.go | 5 +---- server.go | 5 +---- server/server_test.go | 6 +++--- test/client.go | 2 +- test/executor.go | 2 +- 11 files changed, 19 insertions(+), 34 deletions(-) diff --git a/client.go b/client.go index 8528e52dd..3c9ff0709 100644 --- a/client.go +++ b/client.go @@ -50,8 +50,8 @@ type InternalHTTPClient struct { HTTPClient *http.Client } -// NewClient returns a new instance of InternalHTTPClient to connect to host. -func NewClient(host string, options *ClientOptions) (*InternalHTTPClient, error) { +// NewInternalHTTPClient returns a new instance of InternalHTTPClient to connect to host. +func NewInternalHTTPClient(host string, options *ClientOptions) (*InternalHTTPClient, error) { if host == "" { return nil, ErrHostRequired } diff --git a/client_test.go b/client_test.go index 509039618..20f601fe7 100644 --- a/client_test.go +++ b/client_test.go @@ -54,10 +54,7 @@ func TestClient_MultiNode(t *testing.T) { } s[0].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e, err := pilosa.NewExecutor(nil) - if err != nil { - t.Fatal(err) - } + e := pilosa.NewExecutor(nil) e.Holder = hldr[0].Holder e.Scheme = cluster.Nodes[0].Scheme e.Host = cluster.Nodes[0].Host @@ -65,10 +62,7 @@ func TestClient_MultiNode(t *testing.T) { return e.Execute(ctx, index, query, slices, opt) } s[1].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e, err := pilosa.NewExecutor(nil) - if err != nil { - t.Fatal(err) - } + e := pilosa.NewExecutor(nil) e.Holder = hldr[1].Holder e.Scheme = cluster.Nodes[1].Scheme e.Host = cluster.Nodes[1].Host @@ -76,10 +70,7 @@ func TestClient_MultiNode(t *testing.T) { return e.Execute(ctx, index, query, slices, opt) } s[2].Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e, err := pilosa.NewExecutor(nil) - if err != nil { - t.Fatal(err) - } + e := pilosa.NewExecutor(nil) e.Holder = hldr[2].Holder e.Scheme = cluster.Nodes[2].Scheme e.Host = cluster.Nodes[2].Host diff --git a/ctl/common.go b/ctl/common.go index 52b4e6e7e..dc64c0bee 100644 --- a/ctl/common.go +++ b/ctl/common.go @@ -34,7 +34,7 @@ func CommandClient(cmd CommandWithTLSSupport) (*pilosa.InternalHTTPClient, error } clientOptions = &pilosa.ClientOptions{TLS: TLSConfig} } - client, err := pilosa.NewClient(cmd.TLSHost(), clientOptions) + client, err := pilosa.NewInternalHTTPClient(cmd.TLSHost(), clientOptions) if err != nil { return nil, err } diff --git a/executor.go b/executor.go index 7aee4e472..6cb4aad0d 100644 --- a/executor.go +++ b/executor.go @@ -51,13 +51,13 @@ type Executor struct { } // NewExecutor returns a new instance of Executor. -func NewExecutor(clientOptions *ClientOptions) (*Executor, error) { +func NewExecutor(clientOptions *ClientOptions) *Executor { if clientOptions == nil { clientOptions = &ClientOptions{} } return &Executor{ client: NewClientFromURI(nil, clientOptions), - }, nil + } } // Execute executes a PQL query. diff --git a/fragment.go b/fragment.go index 148fd6a48..e5fbb7988 100644 --- a/fragment.go +++ b/fragment.go @@ -1714,7 +1714,7 @@ func (s *FragmentSyncer) SyncFragment() error { } // Retrieve remote blocks. - client, err := NewClient(node.Host, s.ClientOptions) + client, err := NewInternalHTTPClient(node.Host, s.ClientOptions) if err != nil { return err } @@ -1793,7 +1793,7 @@ func (s *FragmentSyncer) syncBlock(id int) error { return nil } - client, err := NewClient(node.Host, s.ClientOptions) + client, err := NewInternalHTTPClient(node.Host, s.ClientOptions) if err != nil { return err } diff --git a/holder.go b/holder.go index f3713faa2..f3b4247d0 100644 --- a/holder.go +++ b/holder.go @@ -515,7 +515,7 @@ func (s *HolderSyncer) syncIndex(index string) error { // Sync with every other host. for _, node := range Nodes(s.Cluster.Nodes).FilterHost(s.URI.HostPort()) { - client, err := NewClient(node.Host, s.ClientOptions) + client, err := NewInternalHTTPClient(node.Host, s.ClientOptions) if err != nil { return err } @@ -560,7 +560,7 @@ func (s *HolderSyncer) syncFrame(index, name string) error { // Sync with every other host. for _, node := range Nodes(s.Cluster.Nodes).FilterHost(s.URI.HostPort()) { - client, err := NewClient(node.Host, s.ClientOptions) + client, err := NewInternalHTTPClient(node.Host, s.ClientOptions) if err != nil { return err } diff --git a/holder_test.go b/holder_test.go index cb33045e6..104bd1bb0 100644 --- a/holder_test.go +++ b/holder_test.go @@ -314,10 +314,7 @@ func TestHolderSyncer_SyncHolder(t *testing.T) { defer s.Close() s.Handler.Holder = hldr1.Holder s.Handler.Executor.ExecuteFn = func(ctx context.Context, index string, query *pql.Query, slices []uint64, opt *pilosa.ExecOptions) ([]interface{}, error) { - e, err := pilosa.NewExecutor(nil) - if err != nil { - t.Fatal(err) - } + e := pilosa.NewExecutor(nil) e.Holder = hldr1.Holder e.Scheme = cluster.Nodes[1].Scheme e.Host = cluster.Nodes[1].Host diff --git a/server.go b/server.go index 3ce2883c3..7c255079e 100644 --- a/server.go +++ b/server.go @@ -164,10 +164,7 @@ func (s *Server) Open() error { s.createDefaultClient() // Create executor for executing queries. - e, err := NewExecutor(&ClientOptions{TLS: s.TLS}) - if err != nil { - return err - } + e := NewExecutor(&ClientOptions{TLS: s.TLS}) e.Holder = s.Holder e.Scheme = s.URI.Scheme() e.Host = s.URI.HostPort() diff --git a/server/server_test.go b/server/server_test.go index f03e3331b..484753a4b 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -53,7 +53,7 @@ func TestMain_Set_Quick(t *testing.T) { defer m.Close() // Create client. - client, err := pilosa.NewClient(m.Server.URI.HostPort(), nil) + client, err := pilosa.NewInternalHTTPClient(m.Server.URI.HostPort(), nil) if err != nil { t.Fatal(err) } @@ -326,7 +326,7 @@ func TestMain_FrameRestore(t *testing.T) { defer m2.Close() // Import from first cluster. - client, err := pilosa.NewClient(m2.Server.URI.HostPort(), nil) + client, err := pilosa.NewInternalHTTPClient(m2.Server.URI.HostPort(), nil) if err != nil { t.Fatal(err) } else if err := m2.Client().CreateIndex(context.Background(), "i", pilosa.IndexOptions{}); err != nil && err != pilosa.ErrIndexExists { @@ -697,7 +697,7 @@ func (m *Main) URL() string { return "http://" + m.Server.Addr().String() } // Client returns a client to connect to the program. func (m *Main) Client() *pilosa.InternalHTTPClient { - client, err := pilosa.NewClient(m.Server.URI.HostPort(), nil) + client, err := pilosa.NewInternalHTTPClient(m.Server.URI.HostPort(), nil) if err != nil { panic(err) } diff --git a/test/client.go b/test/client.go index d9044df66..4ea2fbbad 100644 --- a/test/client.go +++ b/test/client.go @@ -11,7 +11,7 @@ type Client struct { // MustNewClient returns a new instance of Client. Panic on error. func MustNewClient(host string) *Client { - c, err := pilosa.NewClient(host, nil) + c, err := pilosa.NewInternalHTTPClient(host, nil) if err != nil { panic(err) } diff --git a/test/executor.go b/test/executor.go index 4ef99d351..be370908d 100644 --- a/test/executor.go +++ b/test/executor.go @@ -15,7 +15,7 @@ type Executor struct { // NewExecutor returns a new instance of Executor. // The executor always matches the hostname of the first cluster node. func NewExecutor(holder *pilosa.Holder, cluster *pilosa.Cluster) *Executor { - executor, _ := pilosa.NewExecutor(nil) + executor := pilosa.NewExecutor(nil) e := &Executor{Executor: executor} e.Holder = holder e.Cluster = cluster From 642bf3180fdbc64689b82341ce158bee1b649ae9 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Wed, 18 Oct 2017 21:17:25 +0300 Subject: [PATCH 7/9] Rename NewClientFromURI to NewInternalHTTPClientFromURI --- client.go | 4 ++-- executor.go | 2 +- handler.go | 2 +- server.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client.go b/client.go index 3c9ff0709..185b09f93 100644 --- a/client.go +++ b/client.go @@ -61,11 +61,11 @@ func NewInternalHTTPClient(host string, options *ClientOptions) (*InternalHTTPCl return nil, err } - client := NewClientFromURI(uri, options) + client := NewInternalHTTPClientFromURI(uri, options) return client, nil } -func NewClientFromURI(defaultURI *URI, options *ClientOptions) *InternalHTTPClient { +func NewInternalHTTPClientFromURI(defaultURI *URI, options *ClientOptions) *InternalHTTPClient { if options == nil { options = &ClientOptions{} } diff --git a/executor.go b/executor.go index 6cb4aad0d..2f5acf3c0 100644 --- a/executor.go +++ b/executor.go @@ -56,7 +56,7 @@ func NewExecutor(clientOptions *ClientOptions) *Executor { clientOptions = &ClientOptions{} } return &Executor{ - client: NewClientFromURI(nil, clientOptions), + client: NewInternalHTTPClientFromURI(nil, clientOptions), } } diff --git a/handler.go b/handler.go index 811ab14f1..0f224c31d 100644 --- a/handler.go +++ b/handler.go @@ -1506,7 +1506,7 @@ func (h *Handler) handlePostFrameRestore(w http.ResponseWriter, r *http.Request) } // Create a client for the remote cluster. - client := NewClientFromURI(host, h.ClientOptions) + client := NewInternalHTTPClientFromURI(host, h.ClientOptions) // Determine the maximum number of slices. maxSlices, err := client.MaxSliceByIndex(r.Context()) diff --git a/server.go b/server.go index 7c255079e..3460bec46 100644 --- a/server.go +++ b/server.go @@ -537,7 +537,7 @@ func (s *Server) createDefaultClient() { if s.TLS != nil { transport.TLSClientConfig = s.TLS } - s.defaultClient = NewClientFromURI(nil, &ClientOptions{TLS: s.TLS}) + s.defaultClient = NewInternalHTTPClientFromURI(nil, &ClientOptions{TLS: s.TLS}) } // CountOpenFiles on opperating systems that support lsof From c9cb92c96b8dcaff4ae9c2bc44df5c765fd1ca00 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Mon, 23 Oct 2017 17:34:04 +0300 Subject: [PATCH 8/9] Added Travis's note about InteraClient interface --- client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client.go b/client.go index 185b09f93..9297f4718 100644 --- a/client.go +++ b/client.go @@ -32,6 +32,7 @@ import ( "time" "crypto/tls" + "github.com/gogo/protobuf/proto" "github.com/pilosa/pilosa/internal" ) @@ -1206,6 +1207,12 @@ func nodePathToURL(node *Node, path string) url.URL { } } +// InternalClient should be implemented by any struct that enables any transport between nodes +// TODO: Refactor +// Note from Travis: Typically an interface containing more than two or three methods is an indication that +// something hasn't been architected correctly. +// While I understand that putting the entire Client behind an interface might require this many methods, +// I don't want to let it go unquestioned. type InternalClient interface { MaxSliceByIndex(ctx context.Context) (map[string]uint64, error) MaxInverseSliceByIndex(ctx context.Context) (map[string]uint64, error) From 197e05b04a0baef81a11cc2e7ade1294d0d0b4c1 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Tue, 24 Oct 2017 01:37:41 +0300 Subject: [PATCH 9/9] Adds scheme to the node status --- internal/private.pb.go | 867 +++++++++++++++++++++++++++++------------ internal/private.proto | 1 + internal/public.pb.go | 477 +++++++++++++++++------ server.go | 1 + 4 files changed, 972 insertions(+), 374 deletions(-) diff --git a/internal/private.pb.go b/internal/private.pb.go index 786279cf6..e5cc6516f 100644 --- a/internal/private.pb.go +++ b/internal/private.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: private.proto -// DO NOT EDIT! /* Package internal is a generated protocol buffer package. @@ -63,6 +62,20 @@ func (m *IndexMeta) String() string { return proto.CompactTextString( func (*IndexMeta) ProtoMessage() {} func (*IndexMeta) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{0} } +func (m *IndexMeta) GetColumnLabel() string { + if m != nil { + return m.ColumnLabel + } + return "" +} + +func (m *IndexMeta) GetTimeQuantum() string { + if m != nil { + return m.TimeQuantum + } + return "" +} + type FrameMeta struct { RowLabel string `protobuf:"bytes,1,opt,name=RowLabel,proto3" json:"RowLabel,omitempty"` InverseEnabled bool `protobuf:"varint,2,opt,name=InverseEnabled,proto3" json:"InverseEnabled,omitempty"` @@ -78,6 +91,48 @@ func (m *FrameMeta) String() string { return proto.CompactTextString( func (*FrameMeta) ProtoMessage() {} func (*FrameMeta) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{1} } +func (m *FrameMeta) GetRowLabel() string { + if m != nil { + return m.RowLabel + } + return "" +} + +func (m *FrameMeta) GetInverseEnabled() bool { + if m != nil { + return m.InverseEnabled + } + return false +} + +func (m *FrameMeta) GetCacheType() string { + if m != nil { + return m.CacheType + } + return "" +} + +func (m *FrameMeta) GetCacheSize() uint32 { + if m != nil { + return m.CacheSize + } + return 0 +} + +func (m *FrameMeta) GetTimeQuantum() string { + if m != nil { + return m.TimeQuantum + } + return "" +} + +func (m *FrameMeta) GetRangeEnabled() bool { + if m != nil { + return m.RangeEnabled + } + return false +} + func (m *FrameMeta) GetFields() []*Field { if m != nil { return m.Fields @@ -94,6 +149,13 @@ func (m *ImportResponse) String() string { return proto.CompactTextSt func (*ImportResponse) ProtoMessage() {} func (*ImportResponse) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{2} } +func (m *ImportResponse) GetErr() string { + if m != nil { + return m.Err + } + return "" +} + type BlockDataRequest struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"` @@ -107,6 +169,41 @@ func (m *BlockDataRequest) String() string { return proto.CompactText func (*BlockDataRequest) ProtoMessage() {} func (*BlockDataRequest) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{3} } +func (m *BlockDataRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *BlockDataRequest) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + +func (m *BlockDataRequest) GetView() string { + if m != nil { + return m.View + } + return "" +} + +func (m *BlockDataRequest) GetSlice() uint64 { + if m != nil { + return m.Slice + } + return 0 +} + +func (m *BlockDataRequest) GetBlock() uint64 { + if m != nil { + return m.Block + } + return 0 +} + type BlockDataResponse struct { RowIDs []uint64 `protobuf:"varint,1,rep,packed,name=RowIDs" json:"RowIDs,omitempty"` ColumnIDs []uint64 `protobuf:"varint,2,rep,packed,name=ColumnIDs" json:"ColumnIDs,omitempty"` @@ -117,6 +214,20 @@ func (m *BlockDataResponse) String() string { return proto.CompactTex func (*BlockDataResponse) ProtoMessage() {} func (*BlockDataResponse) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{4} } +func (m *BlockDataResponse) GetRowIDs() []uint64 { + if m != nil { + return m.RowIDs + } + return nil +} + +func (m *BlockDataResponse) GetColumnIDs() []uint64 { + if m != nil { + return m.ColumnIDs + } + return nil +} + type Cache struct { IDs []uint64 `protobuf:"varint,1,rep,packed,name=IDs" json:"IDs,omitempty"` } @@ -126,6 +237,13 @@ func (m *Cache) String() string { return proto.CompactTextString(m) } func (*Cache) ProtoMessage() {} func (*Cache) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{5} } +func (m *Cache) GetIDs() []uint64 { + if m != nil { + return m.IDs + } + return nil +} + type MaxSlicesResponse struct { MaxSlices map[string]uint64 `protobuf:"bytes,1,rep,name=MaxSlices" json:"MaxSlices,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` } @@ -153,6 +271,27 @@ func (m *CreateSliceMessage) String() string { return proto.CompactTe func (*CreateSliceMessage) ProtoMessage() {} func (*CreateSliceMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{7} } +func (m *CreateSliceMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *CreateSliceMessage) GetSlice() uint64 { + if m != nil { + return m.Slice + } + return 0 +} + +func (m *CreateSliceMessage) GetIsInverse() bool { + if m != nil { + return m.IsInverse + } + return false +} + type DeleteIndexMessage struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` } @@ -162,6 +301,13 @@ func (m *DeleteIndexMessage) String() string { return proto.CompactTe func (*DeleteIndexMessage) ProtoMessage() {} func (*DeleteIndexMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{8} } +func (m *DeleteIndexMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + type CreateIndexMessage struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Meta *IndexMeta `protobuf:"bytes,2,opt,name=Meta" json:"Meta,omitempty"` @@ -172,6 +318,13 @@ func (m *CreateIndexMessage) String() string { return proto.CompactTe func (*CreateIndexMessage) ProtoMessage() {} func (*CreateIndexMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{9} } +func (m *CreateIndexMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + func (m *CreateIndexMessage) GetMeta() *IndexMeta { if m != nil { return m.Meta @@ -190,6 +343,20 @@ func (m *CreateFrameMessage) String() string { return proto.CompactTe func (*CreateFrameMessage) ProtoMessage() {} func (*CreateFrameMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{10} } +func (m *CreateFrameMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *CreateFrameMessage) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + func (m *CreateFrameMessage) GetMeta() *FrameMeta { if m != nil { return m.Meta @@ -207,6 +374,20 @@ func (m *DeleteFrameMessage) String() string { return proto.CompactTe func (*DeleteFrameMessage) ProtoMessage() {} func (*DeleteFrameMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{11} } +func (m *DeleteFrameMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *DeleteFrameMessage) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + type Frame struct { Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"` Meta *FrameMeta `protobuf:"bytes,2,opt,name=Meta" json:"Meta,omitempty"` @@ -217,6 +398,13 @@ func (m *Frame) String() string { return proto.CompactTextString(m) } func (*Frame) ProtoMessage() {} func (*Frame) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{12} } +func (m *Frame) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func (m *Frame) GetMeta() *FrameMeta { if m != nil { return m.Meta @@ -238,6 +426,13 @@ func (m *Index) String() string { return proto.CompactTextString(m) } func (*Index) ProtoMessage() {} func (*Index) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{13} } +func (m *Index) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func (m *Index) GetMeta() *IndexMeta { if m != nil { return m.Meta @@ -245,6 +440,13 @@ func (m *Index) GetMeta() *IndexMeta { return nil } +func (m *Index) GetMaxSlice() uint64 { + if m != nil { + return m.MaxSlice + } + return 0 +} + func (m *Index) GetFrames() []*Frame { if m != nil { return m.Frames @@ -252,6 +454,13 @@ func (m *Index) GetFrames() []*Frame { return nil } +func (m *Index) GetSlices() []uint64 { + if m != nil { + return m.Slices + } + return nil +} + func (m *Index) GetInputDefinitions() []*InputDefinition { if m != nil { return m.InputDefinitions @@ -270,6 +479,13 @@ func (m *InputDefinition) String() string { return proto.CompactTextS func (*InputDefinition) ProtoMessage() {} func (*InputDefinition) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{14} } +func (m *InputDefinition) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func (m *InputDefinition) GetFrames() []*Frame { if m != nil { return m.Frames @@ -295,6 +511,20 @@ func (m *InputDefinitionField) String() string { return proto.Compact func (*InputDefinitionField) ProtoMessage() {} func (*InputDefinitionField) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{15} } +func (m *InputDefinitionField) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *InputDefinitionField) GetPrimaryKey() bool { + if m != nil { + return m.PrimaryKey + } + return false +} + func (m *InputDefinitionField) GetInputDefinitionActions() []*InputDefinitionAction { if m != nil { return m.InputDefinitionActions @@ -314,6 +544,20 @@ func (m *InputDefinitionAction) String() string { return proto.Compac func (*InputDefinitionAction) ProtoMessage() {} func (*InputDefinitionAction) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{16} } +func (m *InputDefinitionAction) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + +func (m *InputDefinitionAction) GetValueDestination() string { + if m != nil { + return m.ValueDestination + } + return "" +} + func (m *InputDefinitionAction) GetValueMap() map[string]uint64 { if m != nil { return m.ValueMap @@ -321,6 +565,13 @@ func (m *InputDefinitionAction) GetValueMap() map[string]uint64 { return nil } +func (m *InputDefinitionAction) GetRowID() uint64 { + if m != nil { + return m.RowID + } + return 0 +} + type CreateInputDefinitionMessage struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Definition *InputDefinition `protobuf:"bytes,3,opt,name=Definition" json:"Definition,omitempty"` @@ -333,6 +584,13 @@ func (*CreateInputDefinitionMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{17} } +func (m *CreateInputDefinitionMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + func (m *CreateInputDefinitionMessage) GetDefinition() *InputDefinition { if m != nil { return m.Definition @@ -352,10 +610,25 @@ func (*DeleteInputDefinitionMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{18} } +func (m *DeleteInputDefinitionMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *DeleteInputDefinitionMessage) GetName() string { + if m != nil { + return m.Name + } + return "" +} + type NodeStatus struct { Host string `protobuf:"bytes,1,opt,name=Host,proto3" json:"Host,omitempty"` State string `protobuf:"bytes,2,opt,name=State,proto3" json:"State,omitempty"` Indexes []*Index `protobuf:"bytes,3,rep,name=Indexes" json:"Indexes,omitempty"` + Scheme string `protobuf:"bytes,4,opt,name=Scheme,proto3" json:"Scheme,omitempty"` } func (m *NodeStatus) Reset() { *m = NodeStatus{} } @@ -363,6 +636,20 @@ func (m *NodeStatus) String() string { return proto.CompactTextString func (*NodeStatus) ProtoMessage() {} func (*NodeStatus) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{19} } +func (m *NodeStatus) GetHost() string { + if m != nil { + return m.Host + } + return "" +} + +func (m *NodeStatus) GetState() string { + if m != nil { + return m.State + } + return "" +} + func (m *NodeStatus) GetIndexes() []*Index { if m != nil { return m.Indexes @@ -370,6 +657,13 @@ func (m *NodeStatus) GetIndexes() []*Index { return nil } +func (m *NodeStatus) GetScheme() string { + if m != nil { + return m.Scheme + } + return "" +} + type ClusterStatus struct { Nodes []*NodeStatus `protobuf:"bytes,1,rep,name=Nodes" json:"Nodes,omitempty"` } @@ -414,6 +708,34 @@ func (m *Field) String() string { return proto.CompactTextString(m) } func (*Field) ProtoMessage() {} func (*Field) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{22} } +func (m *Field) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *Field) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Field) GetMin() int64 { + if m != nil { + return m.Min + } + return 0 +} + +func (m *Field) GetMax() int64 { + if m != nil { + return m.Max + } + return 0 +} + type DeleteViewMessage struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"` @@ -425,6 +747,27 @@ func (m *DeleteViewMessage) String() string { return proto.CompactTex func (*DeleteViewMessage) ProtoMessage() {} func (*DeleteViewMessage) Descriptor() ([]byte, []int) { return fileDescriptorPrivate, []int{23} } +func (m *DeleteViewMessage) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *DeleteViewMessage) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + +func (m *DeleteViewMessage) GetView() string { + if m != nil { + return m.View + } + return "" +} + func init() { proto.RegisterType((*IndexMeta)(nil), "internal.IndexMeta") proto.RegisterType((*FrameMeta)(nil), "internal.FrameMeta") @@ -1274,6 +1617,12 @@ func (m *NodeStatus) MarshalTo(dAtA []byte) (int, error) { i += n } } + if len(m.Scheme) > 0 { + dAtA[i] = 0x22 + i++ + i = encodeVarintPrivate(dAtA, i, uint64(len(m.Scheme))) + i += copy(dAtA[i:], m.Scheme) + } return i, nil } @@ -1413,24 +1762,6 @@ func (m *DeleteViewMessage) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Private(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Private(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintPrivate(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -1801,6 +2132,10 @@ func (m *NodeStatus) Size() (n int) { n += 1 + l + sovPrivate(uint64(l)) } } + l = len(m.Scheme) + if l > 0 { + n += 1 + l + sovPrivate(uint64(l)) + } return n } @@ -2498,7 +2833,24 @@ func (m *BlockDataResponse) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RowIDs = append(m.RowIDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2539,7 +2891,11 @@ func (m *BlockDataResponse) Unmarshal(dAtA []byte) error { } m.RowIDs = append(m.RowIDs, v) } - } else if wireType == 0 { + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RowIDs", wireType) + } + case 2: + if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2555,12 +2911,8 @@ func (m *BlockDataResponse) Unmarshal(dAtA []byte) error { break } } - m.RowIDs = append(m.RowIDs, v) - } else { - return fmt.Errorf("proto: wrong wireType = %d for field RowIDs", wireType) - } - case 2: - if wireType == 2 { + m.ColumnIDs = append(m.ColumnIDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2601,23 +2953,6 @@ func (m *BlockDataResponse) Unmarshal(dAtA []byte) error { } m.ColumnIDs = append(m.ColumnIDs, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.ColumnIDs = append(m.ColumnIDs, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) } @@ -2672,7 +3007,24 @@ func (m *Cache) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.IDs = append(m.IDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2713,23 +3065,6 @@ func (m *Cache) Unmarshal(dAtA []byte) error { } m.IDs = append(m.IDs, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.IDs = append(m.IDs, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field IDs", wireType) } @@ -2809,51 +3144,14 @@ func (m *MaxSlicesResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthPrivate - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey if m.MaxSlices == nil { m.MaxSlices = make(map[string]uint64) } - if iNdEx < postIndex { - var valuekey uint64 + var mapkey string + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPrivate @@ -2863,31 +3161,69 @@ func (m *MaxSlicesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift + wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - var mapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthPrivate + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - mapvalue |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } + } else { + iNdEx = entryPreIndex + skippy, err := skipPrivate(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthPrivate + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } - m.MaxSlices[mapkey] = mapvalue - } else { - var mapvalue uint64 - m.MaxSlices[mapkey] = mapvalue } + m.MaxSlices[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex @@ -3722,7 +4058,24 @@ func (m *Index) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Slices = append(m.Slices, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -3763,23 +4116,6 @@ func (m *Index) Unmarshal(dAtA []byte) error { } m.Slices = append(m.Slices, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Slices = append(m.Slices, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field Slices", wireType) } @@ -4219,51 +4555,14 @@ func (m *InputDefinitionAction) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var keykey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - keykey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthPrivate - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey := string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey if m.ValueMap == nil { m.ValueMap = make(map[string]uint64) } - if iNdEx < postIndex { - var valuekey uint64 + var mapkey string + var mapvalue uint64 + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPrivate @@ -4273,31 +4572,69 @@ func (m *InputDefinitionAction) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - valuekey |= (uint64(b) & 0x7F) << shift + wire |= (uint64(b) & 0x7F) << shift if b < 0x80 { break } } - var mapvalue uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPrivate + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } - if iNdEx >= l { + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthPrivate + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey > l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - mapvalue |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapvalue |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } } + } else { + iNdEx = entryPreIndex + skippy, err := skipPrivate(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthPrivate + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } - m.ValueMap[mapkey] = mapvalue - } else { - var mapvalue uint64 - m.ValueMap[mapkey] = mapvalue } + m.ValueMap[mapkey] = mapvalue iNdEx = postIndex case 4: if wireType != 0 { @@ -4677,6 +5014,35 @@ func (m *NodeStatus) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Scheme", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPrivate + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPrivate + } + postIndex := iNdEx + intStringLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Scheme = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPrivate(dAtA[iNdEx:]) @@ -5251,64 +5617,65 @@ var ( func init() { proto.RegisterFile("private.proto", fileDescriptorPrivate) } var fileDescriptorPrivate = []byte{ - // 940 bytes of a gzipped FileDescriptorProto + // 948 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xc1, 0x6e, 0x23, 0x45, 0x10, 0x65, 0x3c, 0x63, 0xaf, 0x5d, 0x26, 0x1b, 0xa7, 0x09, 0x2b, 0x6f, 0x14, 0x19, 0xab, 0x0f, 0x6c, 0x88, 0x44, 0x0e, 0x41, 0x5a, 0x01, 0xcb, 0x01, 0x36, 0xce, 0x2a, 0x16, 0x78, 0x81, 0xf6, 0x6a, 0xb9, 0x21, 0x75, 0x9c, 0x62, 0x77, 0x94, 0xf1, 0x8c, 0x99, 0x69, 0x27, 0x31, 0x07, 0x8e, 0x7c, 0x03, 0x12, 0x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e, 0x0b, 0x8a, + 0xc2, 0x98, 0xf0, 0xc7, 0xd0, 0xa4, 0x2a, 0x22, 0x5f, 0xb2, 0xf4, 0x75, 0xf0, 0xd6, 0x7f, 0x1d, + 0x86, 0x50, 0x5d, 0xdd, 0x3a, 0x0c, 0x02, 0xfa, 0xfd, 0xd8, 0x04, 0xd1, 0xc7, 0xa7, 0x05, 0xfe, + 0x20, 0x34, 0xd7, 0xe3, 0x0b, 0xbd, 0x24, 0x44, 0x5e, 0xd1, 0x61, 0x34, 0x22, 0xf5, 0xdb, 0xb2, + 0x65, 0xae, 0x43, 0xbf, 0xfc, 0x6f, 0xf2, 0x0a, 0xb8, 0x0f, 0x84, 0x5f, 0x7c, 0x20, 0x9e, 0xb6, + 0xfe, 0xb8, 0xee, 0x78, 0x7f, 0x5e, 0x77, 0xbc, 0xbf, 0xae, 0x3b, 0xde, 0xaf, 0x7f, 0x77, 0xde, + 0x3a, 0xad, 0xd1, 0xaf, 0xf2, 0xa3, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x47, 0xdd, 0xdd, 0x8e, + 0x66, 0x0a, 0x00, 0x00, } diff --git a/internal/private.proto b/internal/private.proto index e37ca48b6..083316ddd 100644 --- a/internal/private.proto +++ b/internal/private.proto @@ -116,6 +116,7 @@ message NodeStatus { string Host = 1; string State = 2; repeated Index Indexes = 3; + string Scheme = 4; } message ClusterStatus { diff --git a/internal/public.pb.go b/internal/public.pb.go index 33987fd10..81fb2267b 100644 --- a/internal/public.pb.go +++ b/internal/public.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-gogo. DO NOT EDIT. // source: public.proto -// DO NOT EDIT! /* Package internal is a generated protocol buffer package. @@ -28,6 +27,8 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import encoding_binary "encoding/binary" + import io "io" // Reference imports to suppress errors if they are not otherwise used. @@ -51,6 +52,13 @@ func (m *Bitmap) String() string { return proto.CompactTextString(m) func (*Bitmap) ProtoMessage() {} func (*Bitmap) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{0} } +func (m *Bitmap) GetBits() []uint64 { + if m != nil { + return m.Bits + } + return nil +} + func (m *Bitmap) GetAttrs() []*Attr { if m != nil { return m.Attrs @@ -68,6 +76,20 @@ func (m *Pair) String() string { return proto.CompactTextString(m) } func (*Pair) ProtoMessage() {} func (*Pair) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{1} } +func (m *Pair) GetKey() uint64 { + if m != nil { + return m.Key + } + return 0 +} + +func (m *Pair) GetCount() uint64 { + if m != nil { + return m.Count + } + return 0 +} + type SumCount struct { Sum int64 `protobuf:"varint,1,opt,name=Sum,proto3" json:"Sum,omitempty"` Count int64 `protobuf:"varint,2,opt,name=Count,proto3" json:"Count,omitempty"` @@ -78,6 +100,20 @@ func (m *SumCount) String() string { return proto.CompactTextString(m func (*SumCount) ProtoMessage() {} func (*SumCount) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{2} } +func (m *SumCount) GetSum() int64 { + if m != nil { + return m.Sum + } + return 0 +} + +func (m *SumCount) GetCount() int64 { + if m != nil { + return m.Count + } + return 0 +} + type Bit struct { RowID uint64 `protobuf:"varint,1,opt,name=RowID,proto3" json:"RowID,omitempty"` ColumnID uint64 `protobuf:"varint,2,opt,name=ColumnID,proto3" json:"ColumnID,omitempty"` @@ -89,6 +125,27 @@ func (m *Bit) String() string { return proto.CompactTextString(m) } func (*Bit) ProtoMessage() {} func (*Bit) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{3} } +func (m *Bit) GetRowID() uint64 { + if m != nil { + return m.RowID + } + return 0 +} + +func (m *Bit) GetColumnID() uint64 { + if m != nil { + return m.ColumnID + } + return 0 +} + +func (m *Bit) GetTimestamp() int64 { + if m != nil { + return m.Timestamp + } + return 0 +} + type ColumnAttrSet struct { ID uint64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` Attrs []*Attr `protobuf:"bytes,2,rep,name=Attrs" json:"Attrs,omitempty"` @@ -99,6 +156,13 @@ func (m *ColumnAttrSet) String() string { return proto.CompactTextStr func (*ColumnAttrSet) ProtoMessage() {} func (*ColumnAttrSet) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{4} } +func (m *ColumnAttrSet) GetID() uint64 { + if m != nil { + return m.ID + } + return 0 +} + func (m *ColumnAttrSet) GetAttrs() []*Attr { if m != nil { return m.Attrs @@ -120,6 +184,48 @@ func (m *Attr) String() string { return proto.CompactTextString(m) } func (*Attr) ProtoMessage() {} func (*Attr) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{5} } +func (m *Attr) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Attr) GetType() uint64 { + if m != nil { + return m.Type + } + return 0 +} + +func (m *Attr) GetStringValue() string { + if m != nil { + return m.StringValue + } + return "" +} + +func (m *Attr) GetIntValue() int64 { + if m != nil { + return m.IntValue + } + return 0 +} + +func (m *Attr) GetBoolValue() bool { + if m != nil { + return m.BoolValue + } + return false +} + +func (m *Attr) GetFloatValue() float64 { + if m != nil { + return m.FloatValue + } + return 0 +} + type AttrMap struct { Attrs []*Attr `protobuf:"bytes,1,rep,name=Attrs" json:"Attrs,omitempty"` } @@ -150,6 +256,48 @@ func (m *QueryRequest) String() string { return proto.CompactTextStri func (*QueryRequest) ProtoMessage() {} func (*QueryRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{7} } +func (m *QueryRequest) GetQuery() string { + if m != nil { + return m.Query + } + return "" +} + +func (m *QueryRequest) GetSlices() []uint64 { + if m != nil { + return m.Slices + } + return nil +} + +func (m *QueryRequest) GetColumnAttrs() bool { + if m != nil { + return m.ColumnAttrs + } + return false +} + +func (m *QueryRequest) GetRemote() bool { + if m != nil { + return m.Remote + } + return false +} + +func (m *QueryRequest) GetExcludeAttrs() bool { + if m != nil { + return m.ExcludeAttrs + } + return false +} + +func (m *QueryRequest) GetExcludeBits() bool { + if m != nil { + return m.ExcludeBits + } + return false +} + type QueryResponse struct { Err string `protobuf:"bytes,1,opt,name=Err,proto3" json:"Err,omitempty"` Results []*QueryResult `protobuf:"bytes,2,rep,name=Results" json:"Results,omitempty"` @@ -161,6 +309,13 @@ func (m *QueryResponse) String() string { return proto.CompactTextStr func (*QueryResponse) ProtoMessage() {} func (*QueryResponse) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{8} } +func (m *QueryResponse) GetErr() string { + if m != nil { + return m.Err + } + return "" +} + func (m *QueryResponse) GetResults() []*QueryResult { if m != nil { return m.Results @@ -195,6 +350,13 @@ func (m *QueryResult) GetBitmap() *Bitmap { return nil } +func (m *QueryResult) GetN() uint64 { + if m != nil { + return m.N + } + return 0 +} + func (m *QueryResult) GetPairs() []*Pair { if m != nil { return m.Pairs @@ -209,6 +371,13 @@ func (m *QueryResult) GetSumCount() *SumCount { return nil } +func (m *QueryResult) GetChanged() bool { + if m != nil { + return m.Changed + } + return false +} + type ImportRequest struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"` @@ -223,6 +392,48 @@ func (m *ImportRequest) String() string { return proto.CompactTextStr func (*ImportRequest) ProtoMessage() {} func (*ImportRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{10} } +func (m *ImportRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *ImportRequest) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + +func (m *ImportRequest) GetSlice() uint64 { + if m != nil { + return m.Slice + } + return 0 +} + +func (m *ImportRequest) GetRowIDs() []uint64 { + if m != nil { + return m.RowIDs + } + return nil +} + +func (m *ImportRequest) GetColumnIDs() []uint64 { + if m != nil { + return m.ColumnIDs + } + return nil +} + +func (m *ImportRequest) GetTimestamps() []int64 { + if m != nil { + return m.Timestamps + } + return nil +} + type ImportValueRequest struct { Index string `protobuf:"bytes,1,opt,name=Index,proto3" json:"Index,omitempty"` Frame string `protobuf:"bytes,2,opt,name=Frame,proto3" json:"Frame,omitempty"` @@ -237,6 +448,48 @@ func (m *ImportValueRequest) String() string { return proto.CompactTe func (*ImportValueRequest) ProtoMessage() {} func (*ImportValueRequest) Descriptor() ([]byte, []int) { return fileDescriptorPublic, []int{11} } +func (m *ImportValueRequest) GetIndex() string { + if m != nil { + return m.Index + } + return "" +} + +func (m *ImportValueRequest) GetFrame() string { + if m != nil { + return m.Frame + } + return "" +} + +func (m *ImportValueRequest) GetSlice() uint64 { + if m != nil { + return m.Slice + } + return 0 +} + +func (m *ImportValueRequest) GetField() string { + if m != nil { + return m.Field + } + return "" +} + +func (m *ImportValueRequest) GetColumnIDs() []uint64 { + if m != nil { + return m.ColumnIDs + } + return nil +} + +func (m *ImportValueRequest) GetValues() []uint64 { + if m != nil { + return m.Values + } + return nil +} + func init() { proto.RegisterType((*Bitmap)(nil), "internal.Bitmap") proto.RegisterType((*Pair)(nil), "internal.Pair") @@ -472,7 +725,8 @@ func (m *Attr) MarshalTo(dAtA []byte) (int, error) { if m.FloatValue != 0 { dAtA[i] = 0x31 i++ - i = encodeFixed64Public(dAtA, i, uint64(math.Float64bits(float64(m.FloatValue)))) + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(m.FloatValue)))) + i += 8 } return i, nil } @@ -863,24 +1117,6 @@ func (m *ImportValueRequest) MarshalTo(dAtA []byte) (int, error) { return i, nil } -func encodeFixed64Public(dAtA []byte, offset int, v uint64) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - dAtA[offset+4] = uint8(v >> 32) - dAtA[offset+5] = uint8(v >> 40) - dAtA[offset+6] = uint8(v >> 48) - dAtA[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Public(dAtA []byte, offset int, v uint32) int { - dAtA[offset] = uint8(v) - dAtA[offset+1] = uint8(v >> 8) - dAtA[offset+2] = uint8(v >> 16) - dAtA[offset+3] = uint8(v >> 24) - return offset + 4 -} func encodeVarintPublic(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -1194,7 +1430,24 @@ func (m *Bitmap) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Bits = append(m.Bits, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -1235,23 +1488,6 @@ func (m *Bitmap) Unmarshal(dAtA []byte) error { } m.Bits = append(m.Bits, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Bits = append(m.Bits, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field Bits", wireType) } @@ -1843,15 +2079,8 @@ func (m *Attr) Unmarshal(dAtA []byte) error { if (iNdEx + 8) > l { return io.ErrUnexpectedEOF } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) iNdEx += 8 - v = uint64(dAtA[iNdEx-8]) - v |= uint64(dAtA[iNdEx-7]) << 8 - v |= uint64(dAtA[iNdEx-6]) << 16 - v |= uint64(dAtA[iNdEx-5]) << 24 - v |= uint64(dAtA[iNdEx-4]) << 32 - v |= uint64(dAtA[iNdEx-3]) << 40 - v |= uint64(dAtA[iNdEx-2]) << 48 - v |= uint64(dAtA[iNdEx-1]) << 56 m.FloatValue = float64(math.Float64frombits(v)) default: iNdEx = preIndex @@ -2014,7 +2243,24 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error { m.Query = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.Slices = append(m.Slices, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2055,23 +2301,6 @@ func (m *QueryRequest) Unmarshal(dAtA []byte) error { } m.Slices = append(m.Slices, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Slices = append(m.Slices, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field Slices", wireType) } @@ -2610,7 +2839,24 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { } } case 4: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.RowIDs = append(m.RowIDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2651,7 +2897,11 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { } m.RowIDs = append(m.RowIDs, v) } - } else if wireType == 0 { + } else { + return fmt.Errorf("proto: wrong wireType = %d for field RowIDs", wireType) + } + case 5: + if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2667,12 +2917,8 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { break } } - m.RowIDs = append(m.RowIDs, v) - } else { - return fmt.Errorf("proto: wrong wireType = %d for field RowIDs", wireType) - } - case 5: - if wireType == 2 { + m.ColumnIDs = append(m.ColumnIDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2713,8 +2959,12 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { } m.ColumnIDs = append(m.ColumnIDs, v) } - } else if wireType == 0 { - var v uint64 + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) + } + case 6: + if wireType == 0 { + var v int64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowPublic @@ -2724,17 +2974,13 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (uint64(b) & 0x7F) << shift + v |= (int64(b) & 0x7F) << shift if b < 0x80 { break } } - m.ColumnIDs = append(m.ColumnIDs, v) - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) - } - case 6: - if wireType == 2 { + m.Timestamps = append(m.Timestamps, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2775,23 +3021,6 @@ func (m *ImportRequest) Unmarshal(dAtA []byte) error { } m.Timestamps = append(m.Timestamps, v) } - } else if wireType == 0 { - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Timestamps = append(m.Timestamps, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field Timestamps", wireType) } @@ -2952,7 +3181,24 @@ func (m *ImportValueRequest) Unmarshal(dAtA []byte) error { m.Field = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 5: - if wireType == 2 { + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPublic + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.ColumnIDs = append(m.ColumnIDs, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -2993,7 +3239,11 @@ func (m *ImportValueRequest) Unmarshal(dAtA []byte) error { } m.ColumnIDs = append(m.ColumnIDs, v) } - } else if wireType == 0 { + } else { + return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) + } + case 6: + if wireType == 0 { var v uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -3009,12 +3259,8 @@ func (m *ImportValueRequest) Unmarshal(dAtA []byte) error { break } } - m.ColumnIDs = append(m.ColumnIDs, v) - } else { - return fmt.Errorf("proto: wrong wireType = %d for field ColumnIDs", wireType) - } - case 6: - if wireType == 2 { + m.Values = append(m.Values, v) + } else if wireType == 2 { var packedLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { @@ -3055,23 +3301,6 @@ func (m *ImportValueRequest) Unmarshal(dAtA []byte) error { } m.Values = append(m.Values, v) } - } else if wireType == 0 { - var v uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPublic - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Values = append(m.Values, v) } else { return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) } diff --git a/server.go b/server.go index 3460bec46..e94475d02 100644 --- a/server.go +++ b/server.go @@ -386,6 +386,7 @@ func (s *Server) LocalStatus() (proto.Message, error) { } ns := internal.NodeStatus{ + Scheme: s.URI.Scheme(), Host: s.URI.HostPort(), State: NodeStateUp, Indexes: EncodeIndexes(s.Holder.Indexes()),