Command line tools

turbo create package_path ServiceName -r (grpc|thrift) -p

‘turbo create’ creates a project with runnable HTTP server and gRPC/Thrift server.

‘ServiceName’ MUST be a CamelCase string.

‘-r’: the backend service type.

‘-p’: directory in which new project will be created.

Project structure:

$ turbo create package/path/to/yourservice YourService -r grpc -p ~/
$ cd ~/package/path/to/yourservice
$ tree
.
|-- gen
|   |-- grpcfields.yaml
|   |-- grpcswitcher.go
|   `-- proto
|       `-- yourservice.pb.go
|-- grpcapi
|   |-- component
|   |   `-- components.go
|   `-- yourserviceapi.go
|-- grpcservice
|   |-- impl
|   |   `-- yourserviceimpl.go
|   `-- yourservice.go
|-- main.go
|-- service.yaml
`-- yourservice.proto

turbo generate package_path -r (grpc/thrift) -I (absolute_path_to_proto/thrift_files) -I …

‘turbo generate’ generates switcher.go and [service_name].pb.go to ‘gen’ directory.

This command is useful when either service.yaml or [service_name].proto|.thrift is changed. For example, add a new API, change an existing API, change url-grpc mapping, etc.

Example:

$ turbo generate package/path/to/yourservice -r grpc
 -I ~/package/path/to/yourservice -I ~/package/path/to/yourservice/shared

“-I” can appear more than one time, if you have a shared file like “shared.proto” imported from other path.