Skip to content

cyverse-de/p

Repository files navigation

p

This repo contains the protocol buffer v3 definitions and generated modules for data types that cross service boundaries in the Discovery Environment.

Requirements

TL;DR

You will need the following:

  • protoc
  • protoc-gen-go
  • protoc-gen-doc
  • protoc-gen-prost
  • A symlink to the protobuf include/ directory in /usr/local/include

Installation

On MacOS, you can install protoc and protoc-gen-go with homebrew.

brew install protobuf protoc-gen-go

Link the google/ directory from protobuf into /usr/local/include, replacing the 3.19.4 in the directory path with whichever version got installed above:

sudo ln -sf $HOMEBREW_CELLAR/protobuf/3.19.4/include/google /usr/local/include/google

You can install protoc-gen-doc with the go install command:

go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest

Install Rust and Cargo on MacOS with zsh

Instructions originally found at https://stackoverflow.com/a/68617314.

Run the following in a terminal.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

When prompted, customize the installation. When asked about modifying the PATH, select No. All of the other questions can be set to their default setting.

Next, open your .zshrc file (typically located at ~/.zshrc) and add:

export PATH PATH="$HOME/.cargo/bin:$PATH"

Finally, source your .zshrc file:\

. ~/.zshrc

Run rustc --version to make sure the rust compiler is installed.

Run cargo --version to make sure that cargo is installed.

Install protoc-gen-prost

Install protoc-gen-prost with Cargo:

cargo install protoc-gen-prost

That will install the protoc-gen-prost binary in ~/.cargo/bin. You'll want to put that directory in your $PATH if it isn't already there.

Next, install protoc-gen-prost-serde with Cargo:

cargo install protoc-gen-prost-serde

Repo Layout

protos/ contains the protocol buffers definitions.

go/ contains the generated Go modules. Do not edit these files directly.

java/ contains the generated Java packages. Do not edit these files directly.

debuff/ contains the Rust cargo project containing the generated rust module. The file containing the generated code is debuff/src/gen.rs. Do not edit that file directly. The other files in debuff may contain utility code to make the generated code

Building Go packages

The Makefile has a target to build the Go modules, so make or make go will both work.

make clean will delete the generated files, so it is not run by default.

NATS Subject Mapping

Subject Accepts Response Responding Service
cyverse.qms.user.usages.add qms.AddUsages qms.UsageResponse subscriptions
cyverse.qms.user.usages.get qms.GetUsages qms.UsageList subscriptions
cyverse.qms.user.overages.get qms.AllOveragesRequest qms.OverageList subscriptions
cyverse.qms.user.overages.check qms.IsOverageRequest qms.IsOverage subscriptions
cyverse.discoenv.analyses.> analysis.AnalysisRecordLookupRequest analysis.AnalysisRecordList discoenv-analyses
cyverse.discoenv.users.> users.UserLookupRequest user.User discoenv-users
cyverse.qms.user.updates.get qms.UpdateListRequest qms.UpdateListResponse subscriptions
cyverse.qms.user.updates.add qms.AddUpdateRequest qms.AddUpdateResponse subscriptions
cyverse.qms.user.summary.get qms.RequestByUsername qms.UserPlanResponse subscriptions

`

Hints/Tips/Notes

Reload VScode Window after generating Go code.

Sometimes the VSCode Go support thinks that some of the modules needed by the go package are missing. I've found that reloading the window from the command palette fixes that problem.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published