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.
 
 
 

53 lines
1.4 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. const (
  30. maxMsgSize = 256 * 1024 * 1024 // 256 MiB
  31. )
  32. func main() {
  33. grpc.EnableTracing = false
  34. flag.Parse()
  35. opts := []grpc.ServerOption{
  36. grpc.MaxRecvMsgSize(maxMsgSize),
  37. grpc.MaxSendMsgSize(maxMsgSize),
  38. }
  39. srv, err := bttest.NewServer(fmt.Sprintf("%s:%d", *host, *port), opts...)
  40. if err != nil {
  41. log.Fatalf("failed to start emulator: %v", err)
  42. }
  43. fmt.Printf("Cloud Bigtable emulator running on %s\n", srv.Addr)
  44. select {}
  45. }