diff options
author | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-15 05:24:58 +0000 |
---|---|---|
committer | ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp> | 2015-04-15 05:24:58 +0000 |
commit | 3f6876df0b16043412972e7fd92377226bc9c89d (patch) | |
tree | d8b1e2a41a0dca1720929807cc8161568e7c3565 /table/table.go | |
parent | a1114dc7bb6dcb165c6494799be94b5d10fe5b17 (diff) |
api: add a method to convert internal structs to protobuf structs
- add ToApiStruct() for convertion of internal structs to protobuf structs
to avoid ugly convertion by json.Marshal() && json.Unmarshal()
- move grpc server code under /server instead of /api
- update proto file to include more detailed path information
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'table/table.go')
-rw-r--r-- | table/table.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/table/table.go b/table/table.go index 28799a24..d9c14144 100644 --- a/table/table.go +++ b/table/table.go @@ -30,7 +30,7 @@ import ( type Table interface { createDest(nlri bgp.AddrPrefixInterface) Destination - getDestinations() map[string]Destination + GetDestinations() map[string]Destination setDestinations(destinations map[string]Destination) getDestination(key string) Destination setDestination(key string, dest Destination) @@ -153,7 +153,7 @@ func (td *TableDefault) DeleteDestByPeer(peerInfo *PeerInfo) []Destination { func deleteDestByNlri(table Table, nlri bgp.AddrPrefixInterface) Destination { table.validateNlri(nlri) - destinations := table.getDestinations() + destinations := table.GetDestinations() dest := destinations[table.tableKey(nlri)] if dest != nil { delete(destinations, table.tableKey(nlri)) @@ -162,7 +162,7 @@ func deleteDestByNlri(table Table, nlri bgp.AddrPrefixInterface) Destination { } func deleteDest(table Table, dest Destination) { - destinations := table.getDestinations() + destinations := table.GetDestinations() delete(destinations, table.tableKey(dest.getNlri())) } @@ -230,7 +230,7 @@ func getOrCreateDest(table Table, nlri bgp.AddrPrefixInterface) Destination { return dest } -func (td *TableDefault) getDestinations() map[string]Destination { +func (td *TableDefault) GetDestinations() map[string]Destination { return td.destinations } func (td *TableDefault) setDestinations(destinations map[string]Destination) { |