Skip to content

Commit

Permalink
Changing further instances of search-query to search api
Browse files Browse the repository at this point in the history
  • Loading branch information
cadmiumcat committed Feb 12, 2021
1 parent d77c61b commit 3a97db5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (

var httpServer *server.Server

//SearchQueryAPI provides an API around elasticseach
type SearchQueryAPI struct {
//SearchAPI provides an API around elasticseach
type SearchAPI struct {
Router *mux.Router
QueryBuilder QueryBuilder
ElasticSearch ElasticSearcher
Expand All @@ -38,7 +38,7 @@ type ResponseTransformer interface {
TransformSearchResponse(ctx context.Context, responseData []byte) ([]byte, error)
}

// CreateAndInitialise initiates a new Search Query API
// CreateAndInitialise initiates a new Search API
func CreateAndInitialise(bindAddr string, queryBuilder QueryBuilder, elasticSearchClient ElasticSearcher, transformer ResponseTransformer, errorChan chan error) error {

if elasticSearchClient == nil {
Expand All @@ -60,28 +60,28 @@ func CreateAndInitialise(bindAddr string, queryBuilder QueryBuilder, elasticSear
return errors.Wrap(errTimeseries, "Failed to setup timeseries templates")
}

api := NewSearchQueryAPI(router, elasticSearchClient, queryBuilder, transformer)
api := NewSearchAPI(router, elasticSearchClient, queryBuilder, transformer)

httpServer = server.New(bindAddr, api.Router)

// Disable this here to allow service to manage graceful shutdown of the entire app.
httpServer.HandleOSSignals = false

go func() {
log.Event(nil, "search-query api starting", log.INFO)
log.Event(nil, "search api starting", log.INFO)
if err := httpServer.ListenAndServe(); err != nil {
log.Event(nil, "search-query api http server returned error", log.Error(err), log.ERROR)
log.Event(nil, "search api http server returned error", log.Error(err), log.ERROR)
errorChan <- err
}
}()

return nil
}

// NewSearchQueryAPI returns a new Search Query API struct after registering the routes
func NewSearchQueryAPI(router *mux.Router, elasticSearch ElasticSearcher, queryBuilder QueryBuilder, transformer ResponseTransformer) *SearchQueryAPI {
// NewSearchAPI returns a new Search Query API struct after registering the routes
func NewSearchAPI(router *mux.Router, elasticSearch ElasticSearcher, queryBuilder QueryBuilder, transformer ResponseTransformer) *SearchAPI {

api := &SearchQueryAPI{
api := &SearchAPI{
Router: router,
QueryBuilder: queryBuilder,
ElasticSearch: elasticSearch,
Expand Down
2 changes: 1 addition & 1 deletion cmd/dp-search-api/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
// blocks until a fatal error occurs
select {
case err := <-apiErrors:
log.Event(nil, "search-query api error received", log.Error(err), log.FATAL)
log.Event(nil, "search api error received", log.Error(err), log.FATAL)
case <-signals:
log.Event(nil, "os signal received", log.INFO)
gracefulShutdown()
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/kelseyhightower/envconfig"
)

// Config is the search query handler config
// Config is the search API handler config
type Config struct {
BindAddr string `envconfig:"BIND_ADDR"`
ElasticSearchAPIURL string `envconfig:"ELASTIC_SEARCH_URL"`
Expand Down
2 changes: 1 addition & 1 deletion swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
swagger: "2.0"
info:
description: "Search Query API"
description: "Search API"
version: "1.0.1"
title: "dp-search-api"
license:
Expand Down

0 comments on commit 3a97db5

Please sign in to comment.