From e8e1d722c8dd3b90c5e57351503709ebbd37e750 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 19 Apr 2021 16:58:25 -0400 Subject: [PATCH] common commands: add new sub-package for common interface types Add new common interface types for working with Ceph's "JSON commands" to a public sub-package. Signed-off-by: John Mulligan --- common/commands/doc.go | 7 +++++++ common/commands/interfaces.go | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 common/commands/doc.go create mode 100644 common/commands/interfaces.go diff --git a/common/commands/doc.go b/common/commands/doc.go new file mode 100644 index 0000000..f6290ab --- /dev/null +++ b/common/commands/doc.go @@ -0,0 +1,7 @@ +/* +Package commands provides types and utility functions that are used for +interfacing with the JSON based command infrastructure in Ceph. + +The *rados.Conn type implements many of the interfaces found in this package. +*/ +package commands diff --git a/common/commands/interfaces.go b/common/commands/interfaces.go new file mode 100644 index 0000000..c6350b7 --- /dev/null +++ b/common/commands/interfaces.go @@ -0,0 +1,20 @@ +package commands + +// MgrCommander in an interface for the API needed to execute JSON formatted +// commands on the ceph mgr. +type MgrCommander interface { + MgrCommand(buf [][]byte) ([]byte, string, error) +} + +// MonCommander is an interface for the API needed to execute JSON formatted +// commands on the ceph mon(s). +type MonCommander interface { + MonCommand(buf []byte) ([]byte, string, error) +} + +// RadosCommander provides an interface for APIs needed to execute JSON +// formatted commands on the Ceph cluster. +type RadosCommander interface { + MgrCommander + MonCommander +}