From da4cd8482067f7e1c6cc599d3191f1affc3e56b2 Mon Sep 17 00:00:00 2001 From: Cody Soyland Date: Thu, 5 Jul 2018 15:31:07 -0500 Subject: [PATCH] Remove some dead code --- http/client.go | 10 ---------- http/handler.go | 4 ---- pql/ast.go | 33 --------------------------------- server/config.go | 7 ------- test/holder.go | 9 --------- 5 files changed, 63 deletions(-) diff --git a/http/client.go b/http/client.go index 27597a5cb..7c88bd8d3 100644 --- a/http/client.go +++ b/http/client.go @@ -27,19 +27,12 @@ import ( "sort" "strconv" - "crypto/tls" - "github.com/gogo/protobuf/proto" "github.com/pilosa/pilosa" "github.com/pilosa/pilosa/internal" "github.com/pkg/errors" ) -// ClientOptions represents the configuration for a InternalHTTPClient -type ClientOptions struct { - TLS *tls.Config -} - // InternalClient represents a client to the Pilosa cluster. type InternalClient struct { defaultURI *pilosa.URI @@ -70,9 +63,6 @@ func NewInternalClientFromURI(defaultURI *pilosa.URI, remoteClient *http.Client) } } -// Host returns the host the client was initialized with. -func (c *InternalClient) Host() *pilosa.URI { return c.defaultURI } - // MaxShardByIndex returns the number of shards on a server by index. func (c *InternalClient) MaxShardByIndex(ctx context.Context) (map[string]uint64, error) { return c.maxShardByIndex(ctx) diff --git a/http/handler.go b/http/handler.go index 8b2015094..da9a84d9f 100644 --- a/http/handler.go +++ b/http/handler.go @@ -1329,10 +1329,6 @@ func (h *Handler) handlePostClusterMessage(w http.ResponseWriter, r *http.Reques } } -func (h *Handler) GetAPI() *pilosa.API { - return h.API -} - type defaultClusterMessageResponse struct{} func (h *Handler) handleGetTranslateData(w http.ResponseWriter, r *http.Request) { diff --git a/pql/ast.go b/pql/ast.go index 0bcc582d4..344292ed4 100644 --- a/pql/ast.go +++ b/pql/ast.go @@ -220,23 +220,6 @@ func (q *Query) WriteCallN() int { return n } -// HasKeys returns true if any call in the query uses keys and requires translation to ids. -func (q *Query) HasKeys() bool { - for _, call := range q.Calls { - if call.Args["col"] != nil { - if _, ok := call.Args["col"].(string); ok { - return true - } - } - if call.Args["row"] != nil { - if _, ok := call.Args["row"].(string); ok { - return true - } - } - } - return false -} - // String returns a string representation of the query. func (q *Query) String() string { a := make([]string, len(q.Calls)) @@ -309,22 +292,6 @@ func (c *Call) UintSliceArg(key string) ([]uint64, bool, error) { } } -// StringArg is for reading the value at key from call.Args as a string. If the -// key is not in Call.Args, the value of the returned bool will be false, and -// the error will be nil. An error is returned if the value is not a string. -func (c *Call) StringArg(key string) (string, bool, error) { - val, ok := c.Args[key] - if !ok { - return "", false, nil - } - switch tval := val.(type) { - case string: - return tval, true, nil - default: - return "", true, fmt.Errorf("could not convert %v of type %T to string in Call.StringArg", tval, tval) - } -} - // Keys returns a list of argument keys in sorted order. func (c *Call) Keys() []string { a := make([]string, 0, len(c.Args)) diff --git a/server/config.go b/server/config.go index 55da45768..73f0b289e 100644 --- a/server/config.go +++ b/server/config.go @@ -21,13 +21,6 @@ import ( "github.com/pilosa/pilosa/toml" ) -// Cluster types. -const ( - ClusterNone = "" - ClusterStatic = "static" - ClusterGossip = "gossip" -) - // TLSConfig contains TLS configuration type TLSConfig struct { // CertificatePath contains the path to the certificate (.crt or .pem file) diff --git a/test/holder.go b/test/holder.go index 9cc96fe14..ff87ae02c 100644 --- a/test/holder.go +++ b/test/holder.go @@ -81,15 +81,6 @@ func (h *Holder) MustCreateIndexIfNotExists(index string, opt pilosa.IndexOption return &Index{Index: idx} } -// MustCreateFieldIfNotExists returns a given field. Panic on error. -func (h *Holder) MustCreateFieldIfNotExists(index, field string) *Field { - f, err := h.MustCreateIndexIfNotExists(index, pilosa.IndexOptions{}).CreateFieldIfNotExists(field, pilosa.OptFieldTypeDefault()) - if err != nil { - panic(err) - } - return f -} - // Row returns a Row for a given field. func (h *Holder) Row(index, field string, rowID uint64) *pilosa.Row { idx := h.MustCreateIndexIfNotExists(index, pilosa.IndexOptions{})