spdk

package
v0.0.0-...-ee17956 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package spdk provides Go bindings for the SPDK JSON 2.0 RPC interface (http://www.spdk.io/doc/jsonrpc.html).

Index

Constants

View Source
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

func IsJSONError(err error, code int) bool

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 BackendSpecificType

type BackendSpecificType map[string]interface{}

nolint: golint

type Client

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

Client encapsulates the connection to a SPDK JSON server.

func New

func New(path string) (*Client, error)

New constructs a new SPDK JSON client.

func (*Client) Close

func (c *Client) Close() error

Close the connection to the server.

func (*Client) Invoke

func (c *Client) Invoke(_ context.Context, method string, args, reply interface{}) error

Invoke a certain method, get the reply and return the error (if any).

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 DeleteBDevArgs

type DeleteBDevArgs struct {
	Name string `json:"name"`
}

nolint: golint

type GetBDevsArgs

type GetBDevsArgs struct {
	Name string `json:"name,omitempty"`
}

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 SCSIControllerLUN

type SCSIControllerLUN struct {
	LUN      int32
	BDevName string
}

nolint: golint

type SCSIControllerSpecific

type SCSIControllerSpecific []SCSIControllerTarget

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

Jump to

Keyboard shortcuts

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