commands

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrStatusNotEmpty may be returned if a call should not have a status
	// string set but one is.
	ErrStatusNotEmpty = errors.New("response status not empty")
	// ErrBodyNotEmpty may be returned if a call should have an empty body but
	// a body value is present.
	ErrBodyNotEmpty = errors.New("response body not empty")
)

Functions

func NewTraceCommander

func NewTraceCommander(c ccom.RadosCommander) ccom.RadosCommander

NewTraceCommander is a RadosCommander that wraps a given RadosCommander and when commands are executes prints debug level "traces" to the standard output.

Types

type NotImplementedError

type NotImplementedError struct {
	Response
}

NotImplementedError error values will be returned in the case that an API call is not available in the version of Ceph that is running in the target cluster.

func (NotImplementedError) Error

func (e NotImplementedError) Error() string

Error implements the error interface.

type Response

type Response struct {
	// contains filtered or unexported fields
}

Response encapsulates the data returned by ceph and supports easy processing pipelines.

func MarshalMgrCommand

func MarshalMgrCommand(m ccom.MgrCommander, v interface{}) Response

MarshalMgrCommand takes an generic interface{} value, converts it to JSON and sends the json to the MGR as a command.

func MarshalMonCommand

func MarshalMonCommand(m ccom.MonCommander, v interface{}) Response

MarshalMonCommand takes an generic interface{} value, converts it to JSON and sends the json to the MGR as a command.

func NewResponse

func NewResponse(b []byte, s string, e error) Response

NewResponse returns a response.

func RawMgrCommand

func RawMgrCommand(m ccom.MgrCommander, buf []byte) Response

RawMgrCommand takes a byte buffer and sends it to the MGR as a command. The buffer is expected to contain preformatted JSON.

func RawMonCommand

func RawMonCommand(m ccom.MonCommander, buf []byte) Response

RawMonCommand takes a byte buffer and sends it to the MON as a command. The buffer is expected to contain preformatted JSON.

func (Response) Body

func (r Response) Body() []byte

Body returns the response body as a raw byte-slice.

func (Response) End

func (r Response) End() error

End returns an error if the response contains an error or nil, indicating that response is no longer needed for processing.

func (Response) Error

func (r Response) Error() string

Error implements the error interface.

func (Response) FilterDeprecated

func (r Response) FilterDeprecated() Response

FilterDeprecated removes deprecation warnings from the response status. Use it when checking the response from calls that may be deprecated in ceph if you want those calls to continue working if the warning is present.

func (Response) FilterPrefix

func (r Response) FilterPrefix(p string) Response

FilterPrefix sets the status value to an empty string if the status value contains the given prefix string.

func (Response) FilterSuffix

func (r Response) FilterSuffix(s string) Response

FilterSuffix sets the status value to an empty string if the status value contains the given suffix string.

func (Response) NoBody

func (r Response) NoBody() Response

NoBody asserts that the input response has no body value.

func (Response) NoData

func (r Response) NoData() Response

NoData asserts that the input response has no status or body values.

func (Response) NoStatus

func (r Response) NoStatus() Response

NoStatus asserts that the input response has no status value.

func (Response) Ok

func (r Response) Ok() bool

Ok returns true if the response contains no error.

func (Response) Status

func (r Response) Status() string

Status returns the status string value.

func (Response) Unmarshal

func (r Response) Unmarshal(v interface{}) Response

Unmarshal data from the response body into v.

func (Response) Unwrap

func (r Response) Unwrap() error

Unwrap returns the error this response contains.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL