From bbb93abd57cd1f0a7195d504f5257c391e247b78 Mon Sep 17 00:00:00 2001 From: Matt Jaffee Date: Thu, 5 Jul 2018 15:35:32 -0500 Subject: [PATCH] remove lots of unused code --- api.go | 4 +- broadcast.go | 87 --------- cluster.go | 410 ---------------------------------------- encoding/proto/proto.go | 10 +- executor.go | 15 -- field.go | 34 ---- holder.go | 15 -- index.go | 24 --- row.go | 27 --- uri.go | 29 --- 10 files changed, 11 insertions(+), 644 deletions(-) diff --git a/api.go b/api.go index a9bd02f2d..1abe4502c 100644 --- a/api.go +++ b/api.go @@ -770,8 +770,8 @@ func (api *API) SetCoordinator(ctx context.Context, id string) (oldNode, newNode // Send the set-coordinator message to new node. err = api.server.SendTo( newNode, - &internal.SetCoordinatorMessage{ - New: EncodeNode(newNode), + &SetCoordinatorMessage{ + New: newNode, }) if err != nil { return nil, nil, fmt.Errorf("problem sending SetCoordinator message: %s", err) diff --git a/broadcast.go b/broadcast.go index 00835db64..a3ea01a4f 100644 --- a/broadcast.go +++ b/broadcast.go @@ -17,8 +17,6 @@ package pilosa import ( "fmt" - "github.com/gogo/protobuf/proto" - "github.com/pilosa/pilosa/internal" "github.com/pkg/errors" ) @@ -165,88 +163,3 @@ func getMessageType(m Message) byte { panic(fmt.Sprintf("don't have type for message %#v", m)) } } - -// UnmarshalMessage decodes the byte slice into a protobuf message. -func UnmarshalMessage(buf []byte) (proto.Message, error) { - typ, buf := buf[0], buf[1:] - var m proto.Message - switch typ { - case messageTypeCreateShard: - m = &internal.CreateShardMessage{} - case messageTypeCreateIndex: - m = &internal.CreateIndexMessage{} - case messageTypeDeleteIndex: - m = &internal.DeleteIndexMessage{} - case messageTypeCreateField: - m = &internal.CreateFieldMessage{} - case messageTypeDeleteField: - m = &internal.DeleteFieldMessage{} - case messageTypeCreateView: - m = &internal.CreateViewMessage{} - case messageTypeDeleteView: - m = &internal.DeleteViewMessage{} - case messageTypeClusterStatus: - m = &internal.ClusterStatus{} - case messageTypeResizeInstruction: - m = &internal.ResizeInstruction{} - case messageTypeResizeInstructionComplete: - m = &internal.ResizeInstructionComplete{} - case messageTypeSetCoordinator: - m = &internal.SetCoordinatorMessage{} - case messageTypeUpdateCoordinator: - m = &internal.UpdateCoordinatorMessage{} - case messageTypeNodeState: - m = &internal.NodeStateMessage{} - case messageTypeRecalculateCaches: - m = &internal.RecalculateCaches{} - case messageTypeNodeEvent: - m = &internal.NodeEventMessage{} - case messageTypeNodeStatus: - m = &internal.NodeStatus{} - default: - return nil, fmt.Errorf("invalid message type: %d", typ) - } - - if err := proto.Unmarshal(buf, m); err != nil { - return nil, errors.Wrap(err, "unmarshalling") - } - return m, nil -} - -func decode(m proto.Message) Message { - switch mt := m.(type) { - case *internal.CreateShardMessage: - return decodeCreateShardMessage(mt) - case *internal.CreateIndexMessage: - return decodeCreateIndexMessage(mt) - case *internal.DeleteIndexMessage: - return decodeDeleteIndexMessage(mt) - case *internal.CreateFieldMessage: - return decodeCreateFieldMessage(mt) - case *internal.DeleteFieldMessage: - return decodeDeleteFieldMessage(mt) - case *internal.CreateViewMessage: - return decodeCreateViewMessage(mt) - case *internal.DeleteViewMessage: - return decodeDeleteViewMessage(mt) - case *internal.ClusterStatus: - return decodeClusterStatus(mt) - case *internal.ResizeInstruction: - return decodeResizeInstruction(mt) - case *internal.ResizeInstructionComplete: - return decodeResizeInstructionComplete(mt) - case *internal.SetCoordinatorMessage: - return decodeSetCoordinatorMessage(mt) - case *internal.UpdateCoordinatorMessage: - return decodeUpdateCoordinatorMessage(mt) - case *internal.NodeStateMessage: - return decodeNodeStateMessage(mt) - case *internal.RecalculateCaches: - return decodeRecalculateCaches(mt) - case *internal.NodeEventMessage: - return decodeNodeEventMessage(mt) - case *internal.NodeStatus: - return decodeNodeStatus(mt) - } - return nil -} diff --git a/cluster.go b/cluster.go index e2f29fde5..541c83642 100644 --- a/cluster.go +++ b/cluster.go @@ -1757,28 +1757,6 @@ type ResizeInstruction struct { ClusterStatus *ClusterStatus } -func decodeResizeInstruction(ri *internal.ResizeInstruction) *ResizeInstruction { - return &ResizeInstruction{ - JobID: ri.JobID, - Node: DecodeNode(ri.Node), - Coordinator: DecodeNode(ri.Coordinator), - Sources: decodeResizeSources(ri.Sources), - Schema: decodeSchema(ri.Schema), - ClusterStatus: decodeClusterStatus(ri.ClusterStatus), - } -} - -func encodeResizeInstruction(m *ResizeInstruction) *internal.ResizeInstruction { - return &internal.ResizeInstruction{ - JobID: m.JobID, - Node: EncodeNode(m.Node), - Coordinator: EncodeNode(m.Coordinator), - Sources: encodeResizeSources(m.Sources), - Schema: encodeSchema(m.Schema), - ClusterStatus: encodeClusterStatus(m.ClusterStatus), - } -} - type ResizeSource struct { Node *Node `protobuf:"bytes,1,opt,name=Node" json:"Node,omitempty"` Index string `protobuf:"bytes,2,opt,name=Index,proto3" json:"Index,omitempty"` @@ -1787,192 +1765,11 @@ type ResizeSource struct { Shard uint64 `protobuf:"varint,5,opt,name=Shard,proto3" json:"Shard,omitempty"` } -func decodeResizeSources(srcs []*internal.ResizeSource) []*ResizeSource { - new := make([]*ResizeSource, 0, len(srcs)) - for _, src := range srcs { - new = append(new, decodeResizeSource(src)) - } - return new -} - -func encodeResizeSources(srcs []*ResizeSource) []*internal.ResizeSource { - new := make([]*internal.ResizeSource, 0, len(srcs)) - for _, src := range srcs { - new = append(new, encodeResizeSource(src)) - } - return new -} - -func decodeResizeSource(rs *internal.ResizeSource) *ResizeSource { - return &ResizeSource{ - Node: DecodeNode(rs.Node), - Index: rs.Index, - Field: rs.Field, - View: rs.View, - Shard: rs.Shard, - } -} - -func encodeResizeSource(m *ResizeSource) *internal.ResizeSource { - return &internal.ResizeSource{ - Node: EncodeNode(m.Node), - Index: m.Index, - Field: m.Field, - View: m.View, - Shard: m.Shard, - } -} - // Schema is a schema type Schema struct { Indexes []*IndexInfo } -func decodeSchema(s *internal.Schema) *Schema { - return &Schema{ - Indexes: decodeIndexes(s.Indexes), - } -} - -func encodeSchema(m *Schema) *internal.Schema { - return &internal.Schema{ - Indexes: encodeIndexInfos(m.Indexes), - } -} - -func decodeIndexes(idxs []*internal.Index) []*IndexInfo { - new := make([]*IndexInfo, 0, len(idxs)) - for _, idx := range idxs { - new = append(new, decodeIndex(idx)) - } - return new -} - -func encodeIndexInfos(idxs []*IndexInfo) []*internal.Index { - new := make([]*internal.Index, 0, len(idxs)) - for _, idx := range idxs { - new = append(new, encodeIndexInfo(idx)) - } - return new -} - -func decodeIndex(idx *internal.Index) *IndexInfo { - return &IndexInfo{ - Name: idx.Name, - Fields: decodeFields(idx.Fields), - } -} - -func encodeIndexInfo(idx *IndexInfo) *internal.Index { - return &internal.Index{ - Name: idx.Name, - Fields: encodeFieldInfos(idx.Fields), - } -} - -func decodeFields(fs []*internal.Field) []*FieldInfo { - new := make([]*FieldInfo, 0, len(fs)) - for _, f := range fs { - new = append(new, decodeField(f)) - } - return new -} - -func encodeFieldInfos(fs []*FieldInfo) []*internal.Field { - new := make([]*internal.Field, 0, len(fs)) - for _, f := range fs { - new = append(new, encodeFieldInfo(f)) - } - return new -} - -func decodeField(f *internal.Field) *FieldInfo { - fi := &FieldInfo{ - Name: f.Name, - Options: *decodeFieldOptions(f.Meta), - Views: make([]*ViewInfo, 0, len(f.Views)), - } - for _, viewname := range f.Views { - fi.Views = append(fi.Views, &ViewInfo{Name: viewname}) - } - return fi -} - -func encodeFieldInfo(f *FieldInfo) *internal.Field { - ifield := &internal.Field{ - Name: f.Name, - Meta: encodeFieldOptions(&f.Options), - Views: make([]string, 0, len(f.Views)), - } - - for _, viewinfo := range f.Views { - ifield.Views = append(ifield.Views, viewinfo.Name) - } - return ifield -} - -// EncodeNodes converts a slice of Nodes into its internal representation. -func EncodeNodes(a []*Node) []*internal.Node { - other := make([]*internal.Node, len(a)) - for i := range a { - other[i] = EncodeNode(a[i]) - } - return other -} - -// EncodeNode converts a Node into its internal representation. -func EncodeNode(n *Node) *internal.Node { - return &internal.Node{ - ID: n.ID, - URI: n.URI.Encode(), - IsCoordinator: n.IsCoordinator, - } -} - -// DecodeNodes converts a proto message into a slice of Nodes. -func DecodeNodes(a []*internal.Node) []*Node { - if len(a) == 0 { - return nil - } - other := make([]*Node, len(a)) - for i := range a { - other[i] = DecodeNode(a[i]) - } - return other -} - -func decodeClusterStatus(cs *internal.ClusterStatus) *ClusterStatus { - return &ClusterStatus{ - State: cs.State, - ClusterID: cs.ClusterID, - Nodes: DecodeNodes(cs.Nodes), - } -} - -func encodeClusterStatus(m *ClusterStatus) *internal.ClusterStatus { - return &internal.ClusterStatus{ - State: m.State, - ClusterID: m.ClusterID, - Nodes: EncodeNodes(m.Nodes), - } -} - -// DecodeNode converts a proto message into a Node. -func DecodeNode(node *internal.Node) *Node { - return &Node{ - ID: node.ID, - URI: decodeURI(node.URI), - IsCoordinator: node.IsCoordinator, - } -} - -func DecodeNodeEvent(ne *internal.NodeEventMessage) *NodeEvent { - return &NodeEvent{ - Event: NodeEventType(ne.Event), - Node: DecodeNode(ne.Node), - } -} - func encodeTopology(topology *Topology) *internal.Topology { if topology == nil { return nil @@ -2004,267 +1801,60 @@ type CreateShardMessage struct { Shard uint64 } -func encodeCreateShardMessage(m *CreateShardMessage) *internal.CreateShardMessage { - return &internal.CreateShardMessage{ - Index: m.Index, - Shard: m.Shard, - } -} - -func decodeCreateShardMessage(pb *internal.CreateShardMessage) *CreateShardMessage { - return &CreateShardMessage{ - Index: pb.Index, - Shard: pb.Shard, - } -} - type CreateIndexMessage struct { Index string Meta *IndexOptions } -func encodeCreateIndexMessage(m *CreateIndexMessage) *internal.CreateIndexMessage { - return &internal.CreateIndexMessage{ - Index: m.Index, - Meta: encodeIndexMeta(m.Meta), - } -} - -func decodeCreateIndexMessage(pb *internal.CreateIndexMessage) *CreateIndexMessage { - return &CreateIndexMessage{ - Index: pb.Index, - Meta: decodeIndexMeta(pb.Meta), - } -} - -func encodeIndexMeta(m *IndexOptions) *internal.IndexMeta { - return &internal.IndexMeta{ - Keys: m.Keys, - } -} - -func decodeIndexMeta(pb *internal.IndexMeta) *IndexOptions { - return &IndexOptions{ - Keys: pb.Keys, - } -} - type DeleteIndexMessage struct { Index string } -func encodeDeleteIndexMessage(m *DeleteIndexMessage) *internal.DeleteIndexMessage { - return &internal.DeleteIndexMessage{ - Index: m.Index, - } -} - -func decodeDeleteIndexMessage(pb *internal.DeleteIndexMessage) *DeleteIndexMessage { - return &DeleteIndexMessage{ - Index: pb.Index, - } -} - type CreateFieldMessage struct { Index string Field string Meta *FieldOptions } -func encodeCreateFieldMessage(m *CreateFieldMessage) *internal.CreateFieldMessage { - return &internal.CreateFieldMessage{ - Index: m.Index, - Field: m.Field, - Meta: encodeFieldOptions(m.Meta), - } -} - -func decodeCreateFieldMessage(pb *internal.CreateFieldMessage) *CreateFieldMessage { - return &CreateFieldMessage{ - Index: pb.Index, - Field: pb.Field, - Meta: decodeFieldOptions(pb.Meta), - } -} - type DeleteFieldMessage struct { Index string Field string } -func encodeDeleteFieldMessage(m *DeleteFieldMessage) *internal.DeleteFieldMessage { - return &internal.DeleteFieldMessage{ - Index: m.Index, - Field: m.Field, - } -} - -func decodeDeleteFieldMessage(pb *internal.DeleteFieldMessage) *DeleteFieldMessage { - return &DeleteFieldMessage{ - Index: pb.Index, - Field: pb.Field, - } -} - type CreateViewMessage struct { Index string Field string View string } - -func encodeCreateViewMessage(m *CreateViewMessage) *internal.CreateViewMessage { - return &internal.CreateViewMessage{ - Index: m.Index, - Field: m.Field, - View: m.View, - } -} - -func decodeCreateViewMessage(pb *internal.CreateViewMessage) *CreateViewMessage { - return &CreateViewMessage{ - Index: pb.Index, - Field: pb.Field, - View: pb.View, - } -} - type DeleteViewMessage struct { Index string Field string View string } -func encodeDeleteViewMessage(m *DeleteViewMessage) *internal.DeleteViewMessage { - return &internal.DeleteViewMessage{ - Index: m.Index, - Field: m.Field, - View: m.View, - } -} - -func decodeDeleteViewMessage(pb *internal.DeleteViewMessage) *DeleteViewMessage { - return &DeleteViewMessage{ - Index: pb.Index, - Field: pb.Field, - View: pb.View, - } -} - type ResizeInstructionComplete struct { JobID int64 Node *Node Error string } -func encodeResizeInstructionComplete(m *ResizeInstructionComplete) *internal.ResizeInstructionComplete { - return &internal.ResizeInstructionComplete{ - JobID: m.JobID, - Node: EncodeNode(m.Node), - Error: m.Error, - } -} - -func decodeResizeInstructionComplete(pb *internal.ResizeInstructionComplete) *ResizeInstructionComplete { - return &ResizeInstructionComplete{ - JobID: pb.JobID, - Node: DecodeNode(pb.Node), - Error: pb.Error, - } -} - type SetCoordinatorMessage struct { New *Node } -func encodeSetCoordinatorMessage(m *SetCoordinatorMessage) *internal.SetCoordinatorMessage { - return &internal.SetCoordinatorMessage{ - New: EncodeNode(m.New), - } -} - -func decodeSetCoordinatorMessage(pb *internal.SetCoordinatorMessage) *SetCoordinatorMessage { - return &SetCoordinatorMessage{ - New: DecodeNode(pb.New), - } -} - type UpdateCoordinatorMessage struct { New *Node } -func encodeUpdateCoordinatorMessage(m *UpdateCoordinatorMessage) *internal.UpdateCoordinatorMessage { - return &internal.UpdateCoordinatorMessage{ - New: EncodeNode(m.New), - } -} - -func decodeUpdateCoordinatorMessage(pb *internal.UpdateCoordinatorMessage) *UpdateCoordinatorMessage { - return &UpdateCoordinatorMessage{ - New: DecodeNode(pb.New), - } -} - type NodeStateMessage struct { NodeID string `protobuf:"bytes,1,opt,name=NodeID,proto3" json:"NodeID,omitempty"` State string `protobuf:"bytes,2,opt,name=State,proto3" json:"State,omitempty"` } -func encodeNodeStateMessage(m *NodeStateMessage) *internal.NodeStateMessage { - return &internal.NodeStateMessage{ - NodeID: m.NodeID, - State: m.State, - } -} - -func decodeNodeStateMessage(pb *internal.NodeStateMessage) *NodeStateMessage { - return &NodeStateMessage{ - NodeID: pb.NodeID, - State: pb.State, - } -} - -func encodeNodeEventMessage(m *NodeEvent) *internal.NodeEventMessage { - return &internal.NodeEventMessage{ - Event: uint32(m.Event), - Node: EncodeNode(m.Node), - } -} - -func decodeNodeEventMessage(pb *internal.NodeEventMessage) *NodeEvent { - return &NodeEvent{ - Event: NodeEventType(pb.Event), - Node: DecodeNode(pb.Node), - } -} - type NodeStatus struct { Node *Node MaxShards map[string]uint64 Schema *Schema } -func encodeNodeStatus(m *NodeStatus) *internal.NodeStatus { - return &internal.NodeStatus{ - Node: EncodeNode(m.Node), - MaxShards: &internal.MaxShards{Standard: m.MaxShards}, - Schema: encodeSchema(m.Schema), - } -} - -func decodeNodeStatus(pb *internal.NodeStatus) *NodeStatus { - return &NodeStatus{ - Node: DecodeNode(pb.Node), - MaxShards: pb.MaxShards.Standard, - Schema: decodeSchema(pb.Schema), - } -} - type RecalculateCaches struct{} - -func decodeRecalculateCaches(pb *internal.RecalculateCaches) *RecalculateCaches { - return &RecalculateCaches{} -} - -func encodeRecalculateCaches(*RecalculateCaches) *internal.RecalculateCaches { - return &internal.RecalculateCaches{} -} diff --git a/encoding/proto/proto.go b/encoding/proto/proto.go index 341ad46f7..003e9cd94 100644 --- a/encoding/proto/proto.go +++ b/encoding/proto/proto.go @@ -375,11 +375,19 @@ func EncodeNodes(a []*pilosa.Node) []*internal.Node { func encodeNode(n *pilosa.Node) *internal.Node { return &internal.Node{ ID: n.ID, - URI: n.URI.Encode(), + URI: encodeURI(n.URI), IsCoordinator: n.IsCoordinator, } } +func encodeURI(u pilosa.URI) *internal.URI { + return &internal.URI{ + Scheme: u.Scheme, + Host: u.Host, + Port: uint32(u.Port), + } +} + func encodeClusterStatus(m *pilosa.ClusterStatus) *internal.ClusterStatus { return &internal.ClusterStatus{ State: m.State, diff --git a/executor.go b/executor.go index aa2c2fb88..399da685d 100644 --- a/executor.go +++ b/executor.go @@ -20,7 +20,6 @@ import ( "sort" "time" - "github.com/pilosa/pilosa/internal" "github.com/pilosa/pilosa/pql" "github.com/pkg/errors" ) @@ -1738,20 +1737,6 @@ func (vc *ValCount) Add(other ValCount) ValCount { } } -func EncodeValCount(vc ValCount) *internal.ValCount { - return &internal.ValCount{ - Val: vc.Val, - Count: vc.Count, - } -} - -func decodeValCount(pb *internal.ValCount) ValCount { - return ValCount{ - Val: pb.Val, - Count: pb.Count, - } -} - // Smaller returns the smaller of the two ValCounts. func (vc *ValCount) Smaller(other ValCount) ValCount { if vc.Count == 0 || (other.Val < vc.Val && other.Count > 0) { diff --git a/field.go b/field.go index fb7e9af4f..0ef5630e3 100644 --- a/field.go +++ b/field.go @@ -1088,25 +1088,6 @@ func (f *Field) MarshalJSON() ([]byte, error) { return json.Marshal(thing) } -// encodeFields converts a into its internal representation. -func encodeFields(a []*Field) []*internal.Field { - other := make([]*internal.Field, len(a)) - for i := range a { - other[i] = encodeField(a[i]) - } - return other -} - -// encodeField converts f into its internal representation. -func encodeField(f *Field) *internal.Field { - fo := f.options - return &internal.Field{ - Name: f.name, - Meta: fo.Encode(), - Views: f.viewNames(), - } -} - type fieldSlice []*Field func (p fieldSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } @@ -1170,21 +1151,6 @@ func encodeFieldOptions(o *FieldOptions) *internal.FieldOptions { } } -func decodeFieldOptions(options *internal.FieldOptions) *FieldOptions { - if options == nil { - return nil - } - return &FieldOptions{ - Type: options.Type, - CacheType: options.CacheType, - CacheSize: options.CacheSize, - Min: options.Min, - Max: options.Max, - TimeQuantum: TimeQuantum(options.TimeQuantum), - Keys: options.Keys, - } -} - func (o *FieldOptions) MarshalJSON() ([]byte, error) { switch o.Type { case FieldTypeSet: diff --git a/holder.go b/holder.go index 10e147098..cb067db92 100644 --- a/holder.go +++ b/holder.go @@ -27,7 +27,6 @@ import ( "syscall" "time" - "github.com/pilosa/pilosa/internal" "github.com/pkg/errors" uuid "github.com/satori/go.uuid" ) @@ -256,20 +255,6 @@ func (h *Holder) applySchema(schema *Schema) error { return nil } -// encodeMaxShards creates and internal representation of max shards. -func (h *Holder) encodeMaxShards() *internal.MaxShards { - return &internal.MaxShards{ - Standard: h.maxShards(), - } -} - -// encodeSchema creates an internal representation of schema. -func (h *Holder) encodeSchema() *internal.Schema { - return &internal.Schema{ - Indexes: EncodeIndexes(h.Indexes()), - } -} - // IndexPath returns the path where a given index is stored. func (h *Holder) IndexPath(name string) string { return filepath.Join(h.Path, name) } diff --git a/index.go b/index.go index 98f50eced..7451030cd 100644 --- a/index.go +++ b/index.go @@ -403,35 +403,11 @@ func (p indexInfoSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p indexInfoSlice) Len() int { return len(p) } func (p indexInfoSlice) Less(i, j int) bool { return p[i].Name < p[j].Name } -// EncodeIndexes converts a into its internal representation. -func EncodeIndexes(a []*Index) []*internal.Index { - other := make([]*internal.Index, len(a)) - for i := range a { - other[i] = encodeIndex(a[i]) - } - return other -} - -// encodeIndex converts d into its internal representation. -func encodeIndex(d *Index) *internal.Index { - return &internal.Index{ - Name: d.name, - Fields: encodeFields(d.Fields()), - } -} - // IndexOptions represents options to set when initializing an index. type IndexOptions struct { Keys bool `json:"keys"` } -// Encode converts i into its internal representation. -func (i *IndexOptions) Encode() *internal.IndexMeta { - return &internal.IndexMeta{ - Keys: i.Keys, - } -} - // hasTime returns true if a contains a non-nil time. func hasTime(a []*time.Time) bool { for _, t := range a { diff --git a/row.go b/row.go index cbfa6b270..2134026e9 100644 --- a/row.go +++ b/row.go @@ -18,7 +18,6 @@ import ( "encoding/json" "sort" - "github.com/pilosa/pilosa/internal" "github.com/pilosa/pilosa/roaring" ) @@ -271,32 +270,6 @@ func (r *Row) Columns() []uint64 { return a } -// EncodeRow converts r into its internal representation. -func EncodeRow(r *Row) *internal.Row { - if r == nil { - return nil - } - - return &internal.Row{ - Columns: r.Columns(), - Attrs: encodeAttrs(r.Attrs), - } -} - -// DecodeRow converts r from its internal representation. -func DecodeRow(pr *internal.Row) *Row { - if pr == nil { - return nil - } - - r := NewRow() - r.Attrs = decodeAttrs(pr.Attrs) - for _, v := range pr.Columns { - r.SetBit(v) - } - return r -} - // Union performs a union on a slice of rows. func Union(rows []*Row) *Row { other := rows[0] diff --git a/uri.go b/uri.go index 2058f70fa..b58678381 100644 --- a/uri.go +++ b/uri.go @@ -21,7 +21,6 @@ import ( "strconv" "strings" - "github.com/pilosa/pilosa/internal" "github.com/pkg/errors" ) @@ -206,34 +205,6 @@ func parseAddress(address string) (uri *URI, err error) { return uri, nil } -// Encode converts o into its internal representation. -func (u URI) Encode() *internal.URI { - return encodeURI(u) -} - -func encodeURI(u URI) *internal.URI { - return &internal.URI{ - Scheme: u.Scheme, - Host: u.Host, - Port: uint32(u.Port), - } -} - -func DecodeURI(i *internal.URI) URI { - return decodeURI(i) -} - -func decodeURI(i *internal.URI) URI { - if i == nil { - return URI{} - } - return URI{ - Scheme: i.Scheme, - Host: i.Host, - Port: uint16(i.Port), - } -} - // MarshalJSON marshals URI into a JSON-encoded byte slice. func (u *URI) MarshalJSON() ([]byte, error) { var output struct {