Documentation
¶
Overview ¶
Package spdk provides Go bindings for the SPDK JSON 2.0 RPC interface (http://www.spdk.io/doc/jsonrpc.html).
Index ¶
- Constants
- func AddVHostSCSILUN(ctx context.Context, client *Client, args AddVHostSCSILUNArgs) error
- func ConstructVHostSCSIController(ctx context.Context, client *Client, args ConstructVHostSCSIControllerArgs) error
- func DeleteBDev(ctx context.Context, client *Client, args DeleteBDevArgs) error
- func IsJSONError(err error, code int) bool
- func RemoveVHostController(ctx context.Context, client *Client, args RemoveVHostControllerArgs) error
- func RemoveVHostSCSITarget(ctx context.Context, client *Client, args RemoveVHostSCSITargetArgs) error
- func StartNBDDisk(ctx context.Context, client *Client, args StartNBDDiskArgs) error
- func StopNBDDisk(ctx context.Context, client *Client, args StopNBDDiskArgs) error
- type AddVHostSCSILUNArgs
- type BDev
- type BackendSpecificType
- type Client
- type ConstructBDevArgs
- type ConstructBDevResponse
- type ConstructMallocBDevArgs
- type ConstructRBDBDevArgs
- type ConstructVHostSCSIControllerArgs
- type Controller
- type DeleteBDevArgs
- type GetBDevsArgs
- type GetBDevsResponse
- type GetNBDDisksResponse
- type GetVHostControllersResponse
- type RemoveVHostControllerArgs
- type RemoveVHostSCSITargetArgs
- type SCSIControllerLUN
- type SCSIControllerSpecific
- type SCSIControllerTarget
- type StartNBDDiskArgs
- type StopNBDDiskArgs
- type SupportedIOTypes
Constants ¶
const ( ERROR_PARSE_ERROR = -32700 ERROR_INVALID_REQUEST = -32600 ERROR_METHOD_NOT_FOUND = -32601 ERROR_INVALID_PARAMS = -32602 ERROR_INTERNAL_ERROR = -32603 ERROR_INVALID_STATE = -1 )
From SPDK's include/spdk/jsonrpc.h, copied verbatim. nolint: golint
Variables ¶
This section is empty.
Functions ¶
func AddVHostSCSILUN ¶
func AddVHostSCSILUN(ctx context.Context, client *Client, args AddVHostSCSILUNArgs) error
nolint: golint
func ConstructVHostSCSIController ¶
func ConstructVHostSCSIController(ctx context.Context, client *Client, args ConstructVHostSCSIControllerArgs) error
nolint: golint
func DeleteBDev ¶
func DeleteBDev(ctx context.Context, client *Client, args DeleteBDevArgs) error
nolint: golint
func IsJSONError ¶
IsJSONError checks that the error has the expected error code. Use code == 0 to check for any JSONError.
func RemoveVHostController ¶
func RemoveVHostController(ctx context.Context, client *Client, args RemoveVHostControllerArgs) error
nolint: golint
func RemoveVHostSCSITarget ¶
func RemoveVHostSCSITarget(ctx context.Context, client *Client, args RemoveVHostSCSITargetArgs) error
nolint: golint
func StartNBDDisk ¶
func StartNBDDisk(ctx context.Context, client *Client, args StartNBDDiskArgs) error
nolint: golint
func StopNBDDisk ¶
func StopNBDDisk(ctx context.Context, client *Client, args StopNBDDiskArgs) error
nolint: golint
Types ¶
type AddVHostSCSILUNArgs ¶
type AddVHostSCSILUNArgs struct {
Controller string `json:"ctrlr"`
SCSITargetNum uint32 `json:"scsi_target_num"`
BDevName string `json:"bdev_name"`
}
nolint: golint
type BDev ¶
type BDev struct {
Name string `json:"name"`
ProductName string `json:"product_name"`
UUID string `json:"uuid"`
BlockSize int64 `json:"block_size"`
NumBlocks int64 `json:"num_blocks"`
Claimed bool `json:"claimed"`
SupportedIOTypes SupportedIOTypes `json:"supported_io_types"`
}
nolint: golint
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client encapsulates the connection to a SPDK JSON server.
type ConstructBDevArgs ¶
type ConstructBDevArgs struct {
NumBlocks int64 `json:"num_blocks"`
BlockSize int64 `json:"block_size"`
Name string `json:"name,omitempty"`
UUID string `json:"uuid,omitempty"`
}
nolint: golint
type ConstructBDevResponse ¶
type ConstructBDevResponse string
nolint: golint
func ConstructMallocBDev ¶
func ConstructMallocBDev(ctx context.Context, client *Client, args ConstructMallocBDevArgs) (ConstructBDevResponse, error)
nolint: golint
func ConstructRBDBDev ¶
func ConstructRBDBDev(ctx context.Context, client *Client, args ConstructRBDBDevArgs) (ConstructBDevResponse, error)
nolint: golint
type ConstructMallocBDevArgs ¶
type ConstructMallocBDevArgs struct {
ConstructBDevArgs
}
nolint: golint
type ConstructRBDBDevArgs ¶
type ConstructRBDBDevArgs struct {
BlockSize int64 `json:"block_size"`
Name string `json:"name,omitempty"`
UserID string `json:"user_id,omitempty"`
PoolName string `json:"pool_name"`
RBDName string `json:"rbd_name"`
Config map[string]string `json:"config,omitempty"`
}
nolint: golint
type ConstructVHostSCSIControllerArgs ¶
type ConstructVHostSCSIControllerArgs struct {
CPUMask string `json:"cpumask,omitempty"`
Controller string `json:"ctrlr"`
}
nolint: golint
type Controller ¶
type Controller struct {
Controller string `json:"ctrlr"`
CPUMask string `json:"cpumask"`
// BackendSpecific holds the parsed JSON response for known
// backends (like SCSIControllerSpecific), otherwise
// the JSON data converted to basic types (map, list, etc.)
BackendSpecific BackendSpecificType `json:"backend_specific"`
}
nolint: golint
type GetBDevsResponse ¶
type GetBDevsResponse []BDev
nolint: golint
func GetBDevs ¶
func GetBDevs(ctx context.Context, client *Client, args GetBDevsArgs) (GetBDevsResponse, error)
nolint: golint
type GetNBDDisksResponse ¶
type GetNBDDisksResponse []StartNBDDiskArgs
nolint: golint
func GetNBDDisks ¶
func GetNBDDisks(ctx context.Context, client *Client) (GetNBDDisksResponse, error)
nolint: golint
type GetVHostControllersResponse ¶
type GetVHostControllersResponse []Controller
nolint: golint
func GetVHostControllers ¶
func GetVHostControllers(ctx context.Context, client *Client) (GetVHostControllersResponse, error)
nolint: golint
type RemoveVHostControllerArgs ¶
type RemoveVHostControllerArgs struct {
Controller string `json:"ctrlr"`
}
nolint: golint
type RemoveVHostSCSITargetArgs ¶
type RemoveVHostSCSITargetArgs struct {
Controller string `json:"ctrlr"`
SCSITargetNum uint32 `json:"scsi_target_num"`
}
nolint: golint
type SCSIControllerTarget ¶
type SCSIControllerTarget struct {
TargetName string
LUNs []SCSIControllerLUN
ID int32
SCSIDevNum uint32
}
nolint: golint
type StartNBDDiskArgs ¶
type StartNBDDiskArgs struct {
BDevName string `json:"bdev_name"`
NBDDevice string `json:"nbd_device"`
}
nolint: golint
type StopNBDDiskArgs ¶
type StopNBDDiskArgs struct {
NBDDevice string `json:"nbd_device"`
}
nolint: golint
type SupportedIOTypes ¶
type SupportedIOTypes struct {
Read bool `json:"read"`
Write bool `json:"write"`
Unmap bool `json:"unmap"`
WriteZeros bool `json:"write_zeroes"`
Flush bool `json:"flush"`
Reset bool `json:"reset"`
NVMEAdmin bool `json:"nvme_admin"`
NVMEIO bool `json:"nvme_io"`
}
nolint: golint