Skip to content

Commit

Permalink
Refactoring changes made to api.go.
Browse files Browse the repository at this point in the history
The functions I added to the interface last time belong to an existing interface: admin/Administrable. Reusing interface so it's cleaner.
  • Loading branch information
sajidsnasir committed Feb 26, 2018
1 parent cd96d96 commit b9f45d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
11 changes: 2 additions & 9 deletions api.go
Expand Up @@ -6,10 +6,10 @@ package quotaservice
import (
"net/http"

"github.com/square/quotaservice/admin"
"github.com/square/quotaservice/config"
"github.com/square/quotaservice/events"
"github.com/square/quotaservice/logging"
pb "github.com/square/quotaservice/protos/config"
"github.com/square/quotaservice/stats"
)

Expand All @@ -21,14 +21,7 @@ type Server interface {
ServeAdminConsole(*http.ServeMux, string, bool)
SetListener(listener events.Listener, eventQueueBufSize int)
SetStatsListener(listener stats.Listener)
Configs() *pb.ServiceConfig
UpdateConfig(c *pb.ServiceConfig, user string) error
AddBucket(namespace string, b *pb.BucketConfig, user string) error
UpdateBucket(namespace string, b *pb.BucketConfig, user string) error
DeleteBucket(namespace, name, user string) error
AddNamespace(n *pb.NamespaceConfig, user string) error
UpdateNamespace(n *pb.NamespaceConfig, user string) error
DeleteNamespace(n, user string) error
GetServerAdministrable() admin.Administrable
}

// NewWithDefaultConfig creates a new quotaservice server with an empty in-memory config and default reaper.
Expand Down
4 changes: 4 additions & 0 deletions server.go
Expand Up @@ -416,3 +416,7 @@ func (s *server) HistoricalConfigs() ([]*pb.ServiceConfig, error) {

return unmarshalledConfigs, nil
}

func (s *server) GetServerAdministrable() admin.Administrable {
return s
}

0 comments on commit b9f45d5

Please sign in to comment.