refactored naming

This commit is contained in:
Matthias Hannig 2017-06-30 11:12:15 +02:00
parent c68636966d
commit e32f863499
2 changed files with 18 additions and 4 deletions

View File

@ -194,9 +194,13 @@ func apiLookupPrefixGlobal(req *http.Request, params httprouter.Params) (api.Res
return nil, err
}
// Check what we want to query
// Prefix -> fetch prefix
// _ -> fetch neighbours and routes
// Make response
t0 := time.Now()
routes := AliceRoutesStore.Lookup(prefix)
routes := AliceRoutesStore.LookupPrefix(prefix)
// Paginate result
totalRoutes := len(routes)

View File

@ -183,8 +183,18 @@ func addNeighbour(
return route
}
// Single RS lookup by neighbour id
func (self *RoutesStore) LookupNeighbourPrefixesAt(
sourceId int,
neighbourId string,
) []api.LookupRoute {
results := []api.LookupRoute{}
return results
}
// Single RS lookup
func (self *RoutesStore) lookupRs(
func (self *RoutesStore) LookupPrefixAt(
sourceId int,
prefix string,
) chan []api.LookupRoute {
@ -222,13 +232,13 @@ func (self *RoutesStore) lookupRs(
return response
}
func (self *RoutesStore) Lookup(prefix string) []api.LookupRoute {
func (self *RoutesStore) LookupPrefix(prefix string) []api.LookupRoute {
result := []api.LookupRoute{}
responses := []chan []api.LookupRoute{}
// Dispatch
for sourceId, _ := range self.routesMap {
res := self.lookupRs(sourceId, prefix)
res := self.LookupPrefixAt(sourceId, prefix)
responses = append(responses, res)
}