Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revendoring (#500, part 2) #515

Merged
merged 1 commit into from
Dec 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion api/rpc/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (s *Server) Get(ctx context.Context, in *GetRequest) (*GetReply, error) {
// TODO timestamp queries

// Perform request
searchResult, err := request.Query(masterQuery).Do()
searchResult, err := request.Query(masterQuery).Do(ctx)
if err != nil {
return nil, err
}
Expand Down
5 changes: 3 additions & 2 deletions cmd/amp-log-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/appcelerator/amp/data/elasticsearch"
"github.com/golang/protobuf/proto"
"github.com/nats-io/go-nats-streaming"
"golang.org/x/net/context"
"log"
"os"
"os/signal"
Expand Down Expand Up @@ -85,7 +86,7 @@ func main() {
}
log.Printf("Connected to elasticsearch at %s\n", amp.ElasticsearchDefaultURL)

es.CreateIndexIfNotExists(esIndex, esType, esMapping)
es.CreateIndexIfNotExists(context.Background(), esIndex, esType, esMapping)
if err != nil {
log.Fatalf("Unable to create index: %s", err)
}
Expand Down Expand Up @@ -130,7 +131,7 @@ func messageHandler(msg *stan.Msg) {
log.Printf("error parsing timestamp: %v", err)
}
logEntry.Timestamp = timestamp.Format("2006-01-02T15:04:05.999")
err = es.Index(esIndex, esType, logEntry)
err = es.Index(context.Background(), esIndex, esType, logEntry) // TODO: Should we use a timeout context ?
if err != nil {
log.Printf("error indexing log entry: %v", err)
}
Expand Down
13 changes: 7 additions & 6 deletions data/elasticsearch/elasticsearch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package elasticsearch

import (
"context"
"gopkg.in/olivere/elastic.v3"
"time"
)
Expand Down Expand Up @@ -33,23 +34,23 @@ func (es *Elasticsearch) GetClient() *elastic.Client {
}

// CreateIndexIfNotExists Creates an index if it doesn't already exists
func (es *Elasticsearch) CreateIndexIfNotExists(esIndex string, esType string, mapping string) error {
func (es *Elasticsearch) CreateIndexIfNotExists(ctx context.Context, esIndex string, esType string, mapping string) error {
// Use the IndexExists service to check if the index exists
exists, err := es.client.IndexExists(esIndex).Do()
exists, err := es.client.IndexExists(esIndex).Do(ctx)
if err != nil {
return err
}
if !exists {
// Create a new index.
createIndex, err := es.client.CreateIndex(esIndex).Do()
createIndex, err := es.client.CreateIndex(esIndex).Do(ctx)
if err != nil {
return err
}
if !createIndex.Acknowledged {
return err
}

response, err := es.client.PutMapping().Index(esIndex).Type(esType).BodyString(mapping).Do()
response, err := es.client.PutMapping().Index(esIndex).Type(esType).BodyString(mapping).Do(ctx)
if err != nil {
return err
}
Expand All @@ -61,13 +62,13 @@ func (es *Elasticsearch) CreateIndexIfNotExists(esIndex string, esType string, m
}

// Index store a document inside elastic search
func (es *Elasticsearch) Index(esIndex string, esType string, body interface{}) error {
func (es *Elasticsearch) Index(ctx context.Context, esIndex string, esType string, body interface{}) error {
// Add a document to the index
_, err := es.client.Index().
Index(esIndex).
Type(esType).
BodyJson(body).
Do()
Do(ctx)
if err != nil {
return err
}
Expand Down
28 changes: 0 additions & 28 deletions data/kafka/kafka.go

This file was deleted.

64 changes: 25 additions & 39 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 32 additions & 16 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,63 @@
package: github.com/appcelerator/amp
import:
- package: github.com/Shopify/sarama
version: ^1.10.1
- package: github.com/coreos/etcd
version: ^3.1.0-rc.0
version: ^3.1.0-rc.1
subpackages:
- clientv3
- mvcc/mvccpb
- package: github.com/docker/docker
version: 1.13.x
subpackages:
- api/types
- api/types/events
- api/types/filters
- api/types/mount
- api/types/network
- api/types/swarm
- client
- pkg/stringid
- package: github.com/fatih/color
version: ^1.0.0
version: ^1.1.0
- package: github.com/fatih/structs
- package: github.com/golang/protobuf
subpackages:
- proto
- package: github.com/google/go-github
subpackages:
- github
- package: github.com/grpc-ecosystem/grpc-gateway
version: ^1.1.0
subpackages:
- runtime
- third_party/googleapis/google/api
- utilities
- package: github.com/howeyc/gopass
- package: github.com/influxdata/influxdb
version: ^1.1.0
subpackages:
- client/v2
- package: github.com/mitchellh/go-homedir
- package: github.com/nats-io/go-nats-streaming
version: ^0.3.0
- package: github.com/nats-io/nats
version: ^1.2.2
- package: github.com/spf13/cobra
- package: github.com/spf13/pflag
- package: github.com/spf13/viper
- package: golang.org/x/net
subpackages:
- context
- websocket
- package: golang.org/x/oauth2
- package: gopkg.in/olivere/elastic.v3
version: ^3.0.55
- package: gopkg.in/yaml.v2
- package: github.com/docker/docker
version: 1.13.x
- package: google.golang.org/grpc
version: v1.0.4
- package: github.com/nats-io/go-nats-streaming
version: ^0.3.0
- package: github.com/fatih/structs
- package: github.com/grpc-ecosystem/grpc-gateway
version: ^1.1.0
version: ^1.0.4
subpackages:
- runtime
- codes
- grpclog
- metadata
- package: gopkg.in/olivere/elastic.v3
version: ^5.0.13
- package: gopkg.in/yaml.v2
testImport:
- package: github.com/stretchr/testify
version: ^1.1.4
Expand Down
31 changes: 0 additions & 31 deletions vendor/github.com/Shopify/sarama/.github/CONTRIBUTING.md

This file was deleted.

Loading