diff --git a/cache/binary/model.pb.go b/cache/binary/messages.pb.go similarity index 83% rename from cache/binary/model.pb.go rename to cache/binary/messages.pb.go index 6932c00..14849f4 100644 --- a/cache/binary/model.pb.go +++ b/cache/binary/messages.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-go. -// source: binary/model.proto +// source: cache/binary/messages.proto // DO NOT EDIT! package binary @@ -172,6 +172,38 @@ func (m *Relation) GetMemberRoles() []string { return nil } +type DeltaCoords struct { + Ids []int64 `protobuf:"zigzag64,1,rep,packed,name=ids" json:"ids,omitempty"` + Lats []int64 `protobuf:"zigzag64,2,rep,packed,name=lats" json:"lats,omitempty"` + Lons []int64 `protobuf:"zigzag64,3,rep,packed,name=lons" json:"lons,omitempty"` + XXX_unrecognized []byte `json:"-"` +} + +func (m *DeltaCoords) Reset() { *m = DeltaCoords{} } +func (m *DeltaCoords) String() string { return proto.CompactTextString(m) } +func (*DeltaCoords) ProtoMessage() {} + +func (m *DeltaCoords) GetIds() []int64 { + if m != nil { + return m.Ids + } + return nil +} + +func (m *DeltaCoords) GetLats() []int64 { + if m != nil { + return m.Lats + } + return nil +} + +func (m *DeltaCoords) GetLons() []int64 { + if m != nil { + return m.Lons + } + return nil +} + func init() { proto.RegisterEnum("binary.Relation_MemberType", Relation_MemberType_name, Relation_MemberType_value) } diff --git a/cache/binary/model.proto b/cache/binary/messages.proto similarity index 77% rename from cache/binary/model.proto rename to cache/binary/messages.proto index 5ede7f6..3ebc462 100644 --- a/cache/binary/model.proto +++ b/cache/binary/messages.proto @@ -27,3 +27,9 @@ message Relation { repeated MemberType member_types = 4; repeated string member_roles = 5; } + +message DeltaCoords { + repeated sint64 ids = 1 [packed = true]; + repeated sint64 lats = 2 [packed = true]; + repeated sint64 lons = 3 [packed = true]; +} diff --git a/cache/delta.go b/cache/delta.go index 88c16c2..6703aec 100644 --- a/cache/delta.go +++ b/cache/delta.go @@ -15,7 +15,7 @@ func (s Nodes) Len() int { return len(s) } func (s Nodes) Swap(i, j int) { s[i], s[j] = s[j], s[i] } func (s Nodes) Less(i, j int) bool { return s[i].Id < s[j].Id } -func packNodes(nodes []element.Node) *DeltaCoords { +func packNodes(nodes []element.Node) *binary.DeltaCoords { var lastLon, lastLat int64 var lon, lat int64 var lastId int64 @@ -36,10 +36,10 @@ func packNodes(nodes []element.Node) *DeltaCoords { lastLat = lat i++ } - return &DeltaCoords{Ids: ids, Lats: lats, Lons: lons} + return &binary.DeltaCoords{Ids: ids, Lats: lats, Lons: lons} } -func unpackNodes(deltaCoords *DeltaCoords, nodes []element.Node) []element.Node { +func unpackNodes(deltaCoords *binary.DeltaCoords, nodes []element.Node) []element.Node { if len(deltaCoords.Ids) > cap(nodes) { nodes = make([]element.Node, len(deltaCoords.Ids)) } else { @@ -214,7 +214,7 @@ func (p *DeltaCoordsCache) getCoordsPacked(bunchId int64, nodes []element.Node) // clear before returning return nodes[:0], nil } - deltaCoords := &DeltaCoords{} + deltaCoords := &binary.DeltaCoords{} err = proto.Unmarshal(data, deltaCoords) if err != nil { return nil, err diff --git a/cache/internal.pb.go b/cache/internal.pb.go deleted file mode 100644 index 9960465..0000000 --- a/cache/internal.pb.go +++ /dev/null @@ -1,49 +0,0 @@ -// Code generated by protoc-gen-go. -// source: cache/internal.proto -// DO NOT EDIT! - -package cache - -import proto "code.google.com/p/goprotobuf/proto" -import json "encoding/json" -import math "math" - -// Reference proto, json, and math imports to suppress error if they are not otherwise used. -var _ = proto.Marshal -var _ = &json.SyntaxError{} -var _ = math.Inf - -type DeltaCoords struct { - Ids []int64 `protobuf:"zigzag64,1,rep,packed,name=ids" json:"ids,omitempty"` - Lats []int64 `protobuf:"zigzag64,2,rep,packed,name=lats" json:"lats,omitempty"` - Lons []int64 `protobuf:"zigzag64,3,rep,packed,name=lons" json:"lons,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *DeltaCoords) Reset() { *m = DeltaCoords{} } -func (m *DeltaCoords) String() string { return proto.CompactTextString(m) } -func (*DeltaCoords) ProtoMessage() {} - -func (m *DeltaCoords) GetIds() []int64 { - if m != nil { - return m.Ids - } - return nil -} - -func (m *DeltaCoords) GetLats() []int64 { - if m != nil { - return m.Lats - } - return nil -} - -func (m *DeltaCoords) GetLons() []int64 { - if m != nil { - return m.Lons - } - return nil -} - -func init() { -} diff --git a/cache/internal.proto b/cache/internal.proto deleted file mode 100644 index cee74f5..0000000 --- a/cache/internal.proto +++ /dev/null @@ -1,7 +0,0 @@ -package cache; - -message DeltaCoords { - repeated sint64 ids = 1 [packed = true]; - repeated sint64 lats = 2 [packed = true]; - repeated sint64 lons = 3 [packed = true]; -}