github.com/hashicorp/go-plugin@v1.6.0/examples/negotiated/README.md (about) 1 # Negotiated version KV Example 2 3 This example builds a simple key/value store CLI where the plugin version can 4 be negotiated between client and server. 5 6 ```sh 7 # This builds the main CLI 8 $ go build -o kv 9 10 # This builds the plugin written in Go 11 $ go build -o kv-plugin ./plugin-go 12 13 # Write a value using proto version 3 and grpc 14 $ KV_PROTO=grpc ./kv put hello world 15 16 # Read it back using proto version 2 and netrpc 17 $ KV_PROTO=netrpc ./kv get hello 18 world 19 20 Written from plugin version 3 21 Read by plugin version 2 22 ``` 23 24 # Negotiated Protocol 25 26 The Client sends the list of available plugin versions to the server. When 27 presented with a list of plugin versions, the server iterates over them in 28 reverse, and uses the highest numbered match to choose the plugins to execute. 29 If a legacy client is used and no versions are sent to the server, the server 30 will default to the oldest version in its configuration.