File: README.md

package info (click to toggle)
golang-github-hashicorp-go-plugin 1.0.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 644 kB
  • sloc: python: 38; makefile: 7
file content (30 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Negotiated version KV Example

This example builds a simple key/value store CLI where the plugin version can
be negotiated between client and server.

```sh
# This builds the main CLI
$ go build -o kv

# This builds the plugin written in Go
$ go build -o kv-plugin ./plugin-go

# Write a value using proto version 3 and grpc
$ KV_PROTO=grpc ./kv put hello world

# Read it back using proto version 2 and netrpc
$ KV_PROTO=netrpc ./kv get hello
world

Written from plugin version 3
Read by plugin version 2
```

# Negotiated Protocol

The Client sends the list of available plugin versions to the server. When
presented with a list of plugin versions, the server iterates over them in
reverse, and uses the highest numbered match to choose the plugins to execute.
If a legacy client is used and no versions are sent to the server, the server
will default to the oldest version in its configuration.