combine internal.proto and model.proto

master
Oliver Tonnhofer 2013-05-17 15:16:24 +02:00
parent 0833105371
commit 853a45296f
5 changed files with 43 additions and 61 deletions

View File

@ -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)
}

View File

@ -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];
}

8
cache/delta.go vendored
View File

@ -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

49
cache/internal.pb.go vendored
View File

@ -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() {
}

View File

@ -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];
}