From 2ab5ec4031b1de63d2727abf3b274988e77a9ac6 Mon Sep 17 00:00:00 2001 From: Harlow Ward Date: Sun, 2 Jun 2019 17:26:24 -0700 Subject: [PATCH] revert examples --- examples/consumer/cp-dynamo/main.go | 18 +++++++++--------- examples/consumer/cp-mysql/main.go | 2 +- examples/consumer/cp-postgres/main.go | 2 +- examples/consumer/cp-redis/main.go | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/consumer/cp-dynamo/main.go b/examples/consumer/cp-dynamo/main.go index afd73ce..af885b3 100644 --- a/examples/consumer/cp-dynamo/main.go +++ b/examples/consumer/cp-dynamo/main.go @@ -19,7 +19,7 @@ import ( "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/kinesis" consumer "github.com/harlow/kinesis-consumer" - storage "github.com/harlow/kinesis-consumer/checkpoint/ddb" + checkpoint "github.com/harlow/kinesis-consumer/checkpoint/ddb" ) // kick off a server for exposing scan metrics @@ -69,8 +69,8 @@ func main() { myKsis := kinesis.New(sess) myDdbClient := dynamodb.New(sess) - // ddb persitance - ddb, err := storage.New(*app, *table, storage.WithDynamoClient(myDdbClient), storage.WithRetryer(&MyRetryer{})) + // ddb checkpoint + ck, err := checkpoint.New(*app, *table, checkpoint.WithDynamoClient(myDdbClient), checkpoint.WithRetryer(&MyRetryer{})) if err != nil { log.Log("checkpoint error: %v", err) } @@ -81,7 +81,7 @@ func main() { // consumer c, err := consumer.New( *stream, - consumer.WithStorage(ddb), + consumer.WithCheckpoint(ck), consumer.WithLogger(log), consumer.WithCounter(counter), consumer.WithClient(myKsis), @@ -111,17 +111,17 @@ func main() { log.Log("scan error: %v", err) } - if err := ddb.Shutdown(); err != nil { - log.Log("storage shutdown error: %v", err) + if err := ck.Shutdown(); err != nil { + log.Log("checkpoint shutdown error: %v", err) } } -// MyRetryer used for storage +// MyRetryer used for checkpointing type MyRetryer struct { - storage.Retryer + checkpoint.Retryer } -// ShouldRetry implements custom logic for when errors should retry +// ShouldRetry implements custom logic for when a checkpont should retry func (r *MyRetryer) ShouldRetry(err error) bool { if awsErr, ok := err.(awserr.Error); ok { switch awsErr.Code() { diff --git a/examples/consumer/cp-mysql/main.go b/examples/consumer/cp-mysql/main.go index 143d846..386ea94 100644 --- a/examples/consumer/cp-mysql/main.go +++ b/examples/consumer/cp-mysql/main.go @@ -33,7 +33,7 @@ func main() { // consumer c, err := consumer.New( *stream, - consumer.WithStorage(ck), + consumer.WithCheckpoint(ck), consumer.WithCounter(counter), ) if err != nil { diff --git a/examples/consumer/cp-postgres/main.go b/examples/consumer/cp-postgres/main.go index adfeafe..daf5720 100644 --- a/examples/consumer/cp-postgres/main.go +++ b/examples/consumer/cp-postgres/main.go @@ -33,7 +33,7 @@ func main() { // consumer c, err := consumer.New( *stream, - consumer.WithStorage(ck), + consumer.WithCheckpoint(ck), consumer.WithCounter(counter), ) if err != nil { diff --git a/examples/consumer/cp-redis/main.go b/examples/consumer/cp-redis/main.go index 9455132..8b3450e 100644 --- a/examples/consumer/cp-redis/main.go +++ b/examples/consumer/cp-redis/main.go @@ -43,7 +43,7 @@ func main() { // consumer c, err := consumer.New( *stream, - consumer.WithStorage(ck), + consumer.WithCheckpoint(ck), consumer.WithLogger(logger), ) if err != nil {