diff options
author | Matthew Heon <mheon@redhat.com> | 2020-11-16 14:32:12 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-12-01 12:56:55 -0500 |
commit | 594ac4a14658a90ad7bc5541dab6349a0c629a5c (patch) | |
tree | d43d561d74c6331166bca6f5101b7d0fd8d8bd1d /vendor/github.com/docker/go-plugins-helpers/sdk/pool.go | |
parent | 429d9492f85faf4c3a595b9d7b2a38743a4b8e42 (diff) | |
download | podman-594ac4a14658a90ad7bc5541dab6349a0c629a5c.tar.gz podman-594ac4a14658a90ad7bc5541dab6349a0c629a5c.tar.bz2 podman-594ac4a14658a90ad7bc5541dab6349a0c629a5c.zip |
Add API for communicating with Docker volume plugins
Docker provides extensibility through a plugin system, of which
several types are available. This provides an initial library API
for communicating with one type of plugins, volume plugins.
Volume plugins allow for an external service to create and manage
a volume on Podman's behalf.
This does not integrate the plugin system into Libpod or Podman
yet; that will come in subsequent pull requests.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'vendor/github.com/docker/go-plugins-helpers/sdk/pool.go')
-rw-r--r-- | vendor/github.com/docker/go-plugins-helpers/sdk/pool.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/docker/go-plugins-helpers/sdk/pool.go b/vendor/github.com/docker/go-plugins-helpers/sdk/pool.go new file mode 100644 index 000000000..316775973 --- /dev/null +++ b/vendor/github.com/docker/go-plugins-helpers/sdk/pool.go @@ -0,0 +1,18 @@ +package sdk + +import ( + "io" + "sync" +) + +const buffer32K = 32 * 1024 + +var buffer32KPool = &sync.Pool{New: func() interface{} { return make([]byte, buffer32K) }} + +// copyBuf uses a shared buffer pool with io.CopyBuffer +func copyBuf(w io.Writer, r io.Reader) (int64, error) { + buf := buffer32KPool.Get().([]byte) + written, err := io.CopyBuffer(w, r, buf) + buffer32KPool.Put(buf) + return written, err +} |