diff --git a/demo/sequencer/common/README.md b/demo/sequencer/common/README.md new file mode 100644 index 0000000000..43ef686050 --- /dev/null +++ b/demo/sequencer/common/README.md @@ -0,0 +1,6 @@ +You can run this demo with different component names. +For example: +```go +go build -o client +./client -s "state_demo" +``` diff --git a/demo/sequencer/common/client.go b/demo/sequencer/common/client.go index 87dd634269..14c93a2258 100644 --- a/demo/sequencer/common/client.go +++ b/demo/sequencer/common/client.go @@ -40,6 +40,7 @@ func main() { Metadata: nil, }) if err != nil { + fmt.Print(err) return } fmt.Printf("Next id:%v \n", id) diff --git a/demo/sequencer/in-memory/client.go b/demo/sequencer/in-memory/client.go deleted file mode 100644 index c4ec224744..0000000000 --- a/demo/sequencer/in-memory/client.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "context" - "fmt" - - client "mosn.io/layotto/sdk/go-sdk/client" - runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1" -) - -const ( - key = "key666" - storeName = "in-memory" -) - -func main() { - - cli, err := client.NewClient() - if err != nil { - panic(err) - } - defer cli.Close() - ctx := context.Background() - fmt.Printf("Try to get next id.Key:%s \n", key) - for i := 0; i < 10; i++ { - id, err := cli.GetNextId(ctx, &runtimev1pb.GetNextIdRequest{ - StoreName: storeName, - Key: key, - Options: nil, - Metadata: nil, - }) - if err != nil { - fmt.Print(err) - return - } - fmt.Printf("Next id:%v \n", id) - } - fmt.Println("Demo success!") -} diff --git a/demo/sequencer/mongo/client.go b/demo/sequencer/mongo/client.go deleted file mode 100644 index a07a26663f..0000000000 --- a/demo/sequencer/mongo/client.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "context" - "fmt" - - client "mosn.io/layotto/sdk/go-sdk/client" - runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1" -) - -const ( - key = "key666" - storeName = "mongo" -) - -func main() { - - cli, err := client.NewClient() - if err != nil { - panic(err) - } - defer cli.Close() - ctx := context.Background() - fmt.Printf("Try to get next id.Key:%s \n", key) - for i := 0; i < 10; i++ { - id, err := cli.GetNextId(ctx, &runtimev1pb.GetNextIdRequest{ - StoreName: storeName, - Key: key, - Options: nil, - Metadata: nil, - }) - if err != nil { - fmt.Print(err) - return - } - fmt.Printf("Next id:%v \n", id) - } - fmt.Println("Demo success!") -} diff --git a/demo/sequencer/redis/client.go b/demo/sequencer/redis/client.go deleted file mode 100644 index 5e06050a71..0000000000 --- a/demo/sequencer/redis/client.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "context" - "fmt" - - client "mosn.io/layotto/sdk/go-sdk/client" - runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1" -) - -const ( - key = "key666" - storeName = "redis" -) - -func main() { - - cli, err := client.NewClient() - if err != nil { - panic(err) - } - defer cli.Close() - ctx := context.Background() - fmt.Printf("Try to get next id.Key:%s \n", key) - for i := 0; i < 10; i++ { - id, err := cli.GetNextId(ctx, &runtimev1pb.GetNextIdRequest{ - StoreName: storeName, - Key: key, - Options: nil, - Metadata: nil, - }) - if err != nil { - fmt.Print(err) - return - } - fmt.Printf("Next id:%v \n", id) - } - fmt.Println("Demo success!") -} diff --git a/demo/sequencer/zookeeper/client.go b/demo/sequencer/zookeeper/client.go deleted file mode 100644 index 5b9dc1674b..0000000000 --- a/demo/sequencer/zookeeper/client.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "context" - "fmt" - - client "mosn.io/layotto/sdk/go-sdk/client" - runtimev1pb "mosn.io/layotto/spec/proto/runtime/v1" -) - -const ( - key = "test" - storeName = "zookeeper" -) - -func main() { - - cli, err := client.NewClient() - if err != nil { - panic(err) - } - defer cli.Close() - ctx := context.Background() - fmt.Printf("Try to get next id.Key:%s \n", key) - for i := 0; i < 10; i++ { - id, err := cli.GetNextId(ctx, &runtimev1pb.GetNextIdRequest{ - StoreName: storeName, - Key: key, - Options: nil, - Metadata: nil, - }) - if err != nil { - fmt.Println(err) - return - } - fmt.Printf("Next id:%v \n", id) - } - fmt.Println("Demo success!") -}