You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
1.2 KiB

  1. // Copyright 2016 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*
  15. cbtemulator launches the in-memory Cloud Bigtable server on the given address.
  16. */
  17. package main
  18. import (
  19. "flag"
  20. "fmt"
  21. "log"
  22. "cloud.google.com/go/bigtable/bttest"
  23. "google.golang.org/grpc"
  24. )
  25. var (
  26. host = flag.String("host", "localhost", "the address to bind to on the local machine")
  27. port = flag.Int("port", 9000, "the port number to bind to on the local machine")
  28. )
  29. func main() {
  30. grpc.EnableTracing = false
  31. flag.Parse()
  32. srv, err := bttest.NewServer(fmt.Sprintf("%s:%d", *host, *port))
  33. if err != nil {
  34. log.Fatalf("failed to start emulator: %v", err)
  35. }
  36. fmt.Printf("Cloud Bigtable emulator running on %s\n", srv.Addr)
  37. select {}
  38. }