moved http api
This commit is contained in:
parent
977e4db816
commit
39e2605707
@ -30,7 +30,7 @@ type RoutesStoreStats struct {
|
||||
}
|
||||
|
||||
// Log writes stats to the log
|
||||
func (stats RoutesStoreStats) Log() {
|
||||
func (stats *RoutesStoreStats) Log() {
|
||||
log.Println("Routes store:")
|
||||
log.Println(" Routes Imported:",
|
||||
stats.TotalRoutes.Imported,
|
||||
@ -65,7 +65,7 @@ type NeighborsStoreStats struct {
|
||||
}
|
||||
|
||||
// Log prints the stats
|
||||
func (stats NeighborsStoreStats) Log() {
|
||||
func (stats *NeighborsStoreStats) Log() {
|
||||
log.Println("Neighbors store:")
|
||||
|
||||
log.Println(" Neighbors:",
|
||||
|
7
pkg/backend/.gitignore
vendored
7
pkg/backend/.gitignore
vendored
@ -1,7 +0,0 @@
|
||||
|
||||
# Ignore static build in repo
|
||||
rice-box.go
|
||||
|
||||
# Ignore builds
|
||||
alice-lg-*
|
||||
|
@ -1,22 +0,0 @@
|
||||
package backend
|
||||
|
||||
// Globals
|
||||
var (
|
||||
AliceConfig *Config
|
||||
AliceRoutesStore *RoutesStore
|
||||
AliceNeighborsStore *NeighborsStore
|
||||
)
|
||||
|
||||
// InitConfig loads the configuration into the global
|
||||
// AliceConfig
|
||||
func InitConfig(filename string) error {
|
||||
var err error
|
||||
AliceConfig, err = loadConfig(filename)
|
||||
return err
|
||||
}
|
||||
|
||||
// InitStores initializes the routes and neighbors cache
|
||||
func InitStores() {
|
||||
AliceNeighborsStore = NewNeighborsStore(AliceConfig)
|
||||
AliceRoutesStore = NewRoutesStore(AliceConfig)
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
// Improve error handling
|
||||
// Create api.ErrorResponses based on errors returned from server.
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
/*
|
||||
Paginate api routes responses
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"testing"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"net/http"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"log"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"fmt"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
/*
|
||||
The theme provides a method for adding customized CSS
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
@ -1,4 +1,4 @@
|
||||
package backend
|
||||
package http
|
||||
|
||||
import (
|
||||
"io"
|
@ -299,7 +299,7 @@ func (s *NeighborsStore) FilterNeighbors(
|
||||
}
|
||||
|
||||
// Stats exports some statistics for monitoring.
|
||||
func (s *NeighborsStore) Stats() NeighborsStoreStats {
|
||||
func (s *NeighborsStore) Stats() *NeighborsStoreStats {
|
||||
totalNeighbors := 0
|
||||
rsStats := []RouteServerNeighborsStats{}
|
||||
|
||||
@ -317,7 +317,7 @@ func (s *NeighborsStore) Stats() NeighborsStoreStats {
|
||||
}
|
||||
s.RUnlock()
|
||||
|
||||
storeStats := NeighborsStoreStats{
|
||||
storeStats := &NeighborsStoreStats{
|
||||
TotalNeighbors: totalNeighbors,
|
||||
RouteServers: rsStats,
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ func (rs *RoutesStore) update() {
|
||||
}
|
||||
|
||||
// Stats calculates some store insights
|
||||
func (rs *RoutesStore) Stats() RoutesStoreStats {
|
||||
func (rs *RoutesStore) Stats() *api.RoutesStoreStats {
|
||||
totalImported := 0
|
||||
totalFiltered := 0
|
||||
|
||||
@ -185,7 +185,7 @@ func (rs *RoutesStore) Stats() RoutesStoreStats {
|
||||
rs.RUnlock()
|
||||
|
||||
// Make stats
|
||||
storeStats := RoutesStoreStats{
|
||||
storeStats := &RoutesStoreStats{
|
||||
TotalRoutes: RoutesStats{
|
||||
Imported: totalImported,
|
||||
Filtered: totalFiltered,
|
||||
|
Loading…
x
Reference in New Issue
Block a user