spdk

package
v0.0.0-...-98d7112 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Overview

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Package spdk implements the spdk json-rpc protocol

Index

Constants

View Source
const (
	// TweakModeSimpleLba represents tweak as
	// Tweak[127:0] = {64'b0, LBA[63:0]}
	// It is the default tweak mode if not specified
	TweakModeSimpleLba = "SIMPLE_LBA"
	// TweakModeJoinNegLbaWithLba represents tweak as
	// Tweak[127:0] = {1’b0, ~LBA[62:0], LBA[63:0]}
	TweakModeJoinNegLbaWithLba = "JOIN_NEG_LBA_WITH_LBA"
	// TweakModeIncr512FullLba represents tweak as
	// Tweak[127:0] = {lba[127:0]}
	TweakModeIncr512FullLba = "INCR_512_FULL_LBA"
	// TweakModeIncr512UpperLba represents tweak as
	// Tweak[127:0] = {lba[63:0], 64'b0}
	TweakModeIncr512UpperLba = "INCR_512_UPPER_LBA"
)
View Source
const JSONRPCVersion = "2.0"

JSONRPCVersion holds the current version of json RPC protocol

Variables

View Source
var (
	// ErrFailedSpdkCall indicates that the bridge failed to execute SPDK call
	ErrFailedSpdkCall = status.Error(codes.Unknown, "Failed to execute SPDK call")
	// ErrUnexpectedSpdkCallResult indicates that the bridge got an error from SPDK
	ErrUnexpectedSpdkCallResult = status.Error(codes.FailedPrecondition, "Unexpected SPDK call result.")
)

Functions

This section is empty.

Types

type AccelCryptoKeyCreateParams

type AccelCryptoKeyCreateParams struct {
	Cipher    string `json:"cipher"`
	Key       string `json:"key"`
	Key2      string `json:"key2"`
	TweakMode string `json:"tweak_mode,omitempty"`
	Name      string `json:"name"`
}

AccelCryptoKeyCreateParams holds the parameters required to create a Crypto Key

type AccelCryptoKeyCreateResult

type AccelCryptoKeyCreateResult bool

AccelCryptoKeyCreateResult is the result of creating a Crypto Key

type AccelCryptoKeyDestroyParams

type AccelCryptoKeyDestroyParams struct {
	KeyName string `json:"key_name"`
}

AccelCryptoKeyDestroyParams holds the parameters required to delete a Crypto Key

type AccelCryptoKeyDestroyResult

type AccelCryptoKeyDestroyResult bool

AccelCryptoKeyDestroyResult is the result of deleting a Crypto Key

type AccelCryptoKeyGetParams

type AccelCryptoKeyGetParams struct {
	KeyName string `json:"key_name"`
}

AccelCryptoKeyGetParams holds the parameters required to get a Crypto Key

type AccelCryptoKeyGetResult

type AccelCryptoKeyGetResult struct {
	Name   string `json:"name"`
	Cipher string `json:"cipher"`
	Key    string `json:"key"`
	Key2   string `json:"key2"`
}

AccelCryptoKeyGetResult is the result of getting a Crypto Key

type AccelService

AccelService is interface to all acceleration functions in spdk

type AccelServiceImpl

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

AccelServiceImpl implements AccelService interface

func NewAccelService

func NewAccelService() *AccelServiceImpl

NewAccelService is a constructor for AccelServiceImpl

func (*AccelServiceImpl) CryptoKeyCreate

func (p *AccelServiceImpl) CryptoKeyCreate(ctx context.Context, name string, cipher string, key []byte) (*AccelCryptoKeyCreateResult, error)

CryptoKeyCreate creates crypto key

func (*AccelServiceImpl) CryptoKeyDestroy

CryptoKeyDestroy destroys crypto key

func (*AccelServiceImpl) CryptoKeyList

CryptoKeyList lists crypto keys

func (*AccelServiceImpl) GetStats

GetStats gets crypto key stats

type BdevAioCreateParams

type BdevAioCreateParams struct {
	Name      string `json:"name"`
	Filename  string `json:"filename"`
	BlockSize int    `json:"block_size"`
}

BdevAioCreateParams holds the parameters required to create an AIO Block Device

type BdevAioCreateResult

type BdevAioCreateResult string

BdevAioCreateResult is the result of creating an AIO Block Device

type BdevAioDeleteParams

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

BdevAioDeleteParams holds the parameters required to delete an AIO Block Device

type BdevAioDeleteResult

type BdevAioDeleteResult bool

BdevAioDeleteResult is the result of deleting an AIO Block Device

type BdevCryptoCreateParams

type BdevCryptoCreateParams struct {
	BaseBdevName string `json:"base_bdev_name"`
	Name         string `json:"name"`
	KeyName      string `json:"key_name"`
}

BdevCryptoCreateParams holds the parameters required to create a Crypto Block Device

type BdevCryptoCreateResult

type BdevCryptoCreateResult string

BdevCryptoCreateResult is the result of creating a Crypto Block Device

type BdevCryptoDeleteParams

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

BdevCryptoDeleteParams holds the parameters required to delete a Crypto Block Device

type BdevCryptoDeleteResult

type BdevCryptoDeleteResult bool

BdevCryptoDeleteResult is the result of deleting a Crypto Block Device

type BdevGetBdevsParams

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

BdevGetBdevsParams is the parameters required to get a block device

type BdevGetBdevsResult

type BdevGetBdevsResult struct {
	Name      string `json:"name"`
	BlockSize int64  `json:"block_size"`
	NumBlocks int64  `json:"num_blocks"`
	UUID      string `json:"uuid"`
}

BdevGetBdevsResult is the result of getting a block device

type BdevGetIostatParams

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

BdevGetIostatParams hold the parameters required to get the IO stats of a block device

type BdevGetIostatResult

type BdevGetIostatResult struct {
	TickRate int   `json:"tick_rate"`
	Ticks    int64 `json:"ticks"`
	Bdevs    []struct {
		Name              string `json:"name"`
		BytesRead         int    `json:"bytes_read"`
		NumReadOps        int    `json:"num_read_ops"`
		BytesWritten      int    `json:"bytes_written"`
		NumWriteOps       int    `json:"num_write_ops"`
		BytesUnmapped     int    `json:"bytes_unmapped"`
		NumUnmapOps       int    `json:"num_unmap_ops"`
		ReadLatencyTicks  int    `json:"read_latency_ticks"`
		WriteLatencyTicks int    `json:"write_latency_ticks"`
		UnmapLatencyTicks int    `json:"unmap_latency_ticks"`
	} `json:"bdevs"`
}

BdevGetIostatResult hold the results of getting the IO stats of a block device

type BdevMallocCreateParams

type BdevMallocCreateParams struct {
	NumBlocks    int    `json:"num_blocks"`
	BlockSize    int    `json:"block_size"`
	MdSize       int    `json:"md_size,omitempty"`
	MdInterleave bool   `json:"md_interleave,omitempty"`
	Name         string `json:"name"`
	UUID         string `json:"uuid,omitempty"`
}

BdevMallocCreateParams holds the parameters required to create a Malloc Block Device

type BdevMallocCreateResult

type BdevMallocCreateResult string

BdevMallocCreateResult is the result of creating a Malloc Block Device

type BdevMallocDeleteParams

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

BdevMallocDeleteParams holds the parameters required to delete a Malloc Block Device

type BdevMallocDeleteResult

type BdevMallocDeleteResult bool

BdevMallocDeleteResult is the result of deleting a Malloc Block Device

type BdevNullCreateParams

type BdevNullCreateParams struct {
	BlockSize int    `json:"block_size"`
	NumBlocks int    `json:"num_blocks"`
	Name      string `json:"name"`
}

BdevNullCreateParams holds the parameters required to create a Null Block Device that discards all writes and returns undefined data for reads

type BdevNullCreateResult

type BdevNullCreateResult string

BdevNullCreateResult is the result of creating a Null Block Device

type BdevNullDeleteParams

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

BdevNullDeleteParams holds the parameters required to delete a Null Block Device

type BdevNullDeleteResult

type BdevNullDeleteResult bool

BdevNullDeleteResult is the result of deleting a Null Block Device

type BdevNvmeAttachControllerParams

type BdevNvmeAttachControllerParams struct {
	Name      string `json:"name"`
	Trtype    string `json:"trtype"`
	Traddr    string `json:"traddr"`
	Hostnqn   string `json:"hostnqn,omitempty"`
	Adrfam    string `json:"adrfam,omitempty"`
	Trsvcid   string `json:"trsvcid,omitempty"`
	Subnqn    string `json:"subnqn,omitempty"`
	Hdgst     bool   `json:"hdgst,omitempty"`
	Ddgst     bool   `json:"ddgst,omitempty"`
	Psk       string `json:"psk,omitempty"`
	Multipath string `json:"multipath,omitempty"`
}

BdevNvmeAttachControllerParams is the parameters required to create a block device based on an NVMe device

type BdevNvmeAttachControllerResult

type BdevNvmeAttachControllerResult string

BdevNvmeAttachControllerResult is the result of creating a block device based on an NVMe device

type BdevNvmeDetachControllerParams

type BdevNvmeDetachControllerParams struct {
	Name    string `json:"name"`
	Trtype  string `json:"trtype"`
	Traddr  string `json:"traddr"`
	Adrfam  string `json:"adrfam,omitempty"`
	Trsvcid string `json:"trsvcid,omitempty"`
	Subnqn  string `json:"subnqn,omitempty"`
}

BdevNvmeDetachControllerParams is the parameters required to detach a block device based on an NVMe device

type BdevNvmeDetachControllerResult

type BdevNvmeDetachControllerResult bool

BdevNvmeDetachControllerResult is the result of detaching a block device based on an NVMe device

type BdevNvmeGetControllerParams

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

BdevNvmeGetControllerParams is the parameters required to get a block device based on an NVMe device

type BdevNvmeGetControllerResult

type BdevNvmeGetControllerResult struct {
	Name   string `json:"name"`
	Ctrlrs []struct {
		State string `json:"state"`
		Trid  struct {
			Trtype  string `json:"trtype"`
			Adrfam  string `json:"adrfam"`
			Traddr  string `json:"traddr"`
			Trsvcid string `json:"trsvcid"`
			Subnqn  string `json:"subnqn"`
		} `json:"trid"`
		Cntlid int `json:"cntlid"`
		Host   struct {
			Nqn   string `json:"nqn"`
			Addr  string `json:"addr"`
			Svcid string `json:"svcid"`
		} `json:"host"`
	} `json:"ctrlrs"`
}

BdevNvmeGetControllerResult is the result of getting a block device based on an NVMe device

type BdevQoSParams

type BdevQoSParams struct {
	Name           string `json:"name"`
	RwIosPerSec    int    `json:"rw_ios_per_sec"`
	RwMbytesPerSec int    `json:"rw_mbytes_per_sec"`
	RMbytesPerSec  int    `json:"r_mbytes_per_sec"`
	WMbytesPerSec  int    `json:"w_mbytes_per_sec"`
}

BdevQoSParams holds the parameters required to set QoS on a Block Device

type BdevQoSResult

type BdevQoSResult bool

BdevQoSResult is the result of setting QoS on a Block Device

type Client

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

Client implements JSONRPC interface

func NewClient

func NewClient(socketPath string) *Client

NewClient creates a new instance of JSONRPC which is capable to interact with either unix domain socket, e.g.: /var/tmp/spdk.sock or with tcp connection ip and port tuple, e.g.: 10.1.1.2:1234

func (*Client) Call

func (r *Client) Call(ctx context.Context, method string, args, result interface{}) error

Call implements low level rpc request/response handling

func (*Client) GetID

func (r *Client) GetID() uint64

GetID implements low level rpc request/response handling

func (*Client) GetVersion

func (r *Client) GetVersion(ctx context.Context) string

GetVersion implements low level rpc request/response handling

func (*Client) StartUnixListener

func (r *Client) StartUnixListener() net.Listener

StartUnixListener is utility function used to create new listener in tests

type GetVersionResult

type GetVersionResult struct {
	Version string `json:"version"`
	Fields  struct {
		Major  int    `json:"major"`
		Minor  int    `json:"minor"`
		Patch  int    `json:"patch"`
		Suffix string `json:"suffix"`
	} `json:"fields"`
}

GetVersionResult is the result of getting a version

type JSONRPC

type JSONRPC interface {
	GetID() uint64
	GetVersion(context.Context) string
	StartUnixListener() net.Listener
	Call(ctx context.Context, method string, args, result interface{}) error
}

JSONRPC represents an interface to execute JSON RPC to SPDK

type NvmfCreateSubsystemParams

type NvmfCreateSubsystemParams struct {
	Nqn           string `json:"nqn"`
	SerialNumber  string `json:"serial_number"`
	ModelNumber   string `json:"model_number"`
	AllowAnyHost  bool   `json:"allow_any_host"`
	MaxNamespaces int    `json:"max_namespaces"`
}

NvmfCreateSubsystemParams holds the parameters required to create a NVMf subsystem

type NvmfCreateSubsystemResult

type NvmfCreateSubsystemResult bool

NvmfCreateSubsystemResult is the result of creating a NVMf subsystem

type NvmfDeleteSubsystemParams

type NvmfDeleteSubsystemParams struct {
	Nqn string `json:"nqn"`
}

NvmfDeleteSubsystemParams holds the parameters required to Delete a NVMf subsystem

type NvmfDeleteSubsystemResult

type NvmfDeleteSubsystemResult bool

NvmfDeleteSubsystemResult is the result of creating a NVMf subsystem

type NvmfGetSubsystemStatsResult

type NvmfGetSubsystemStatsResult struct {
	TickRate   int `json:"tick_rate"`
	PollGroups []struct {
		Name               string `json:"name"`
		AdminQpairs        int    `json:"admin_qpairs"`
		IoQpairs           int    `json:"io_qpairs"`
		CurrentAdminQpairs int    `json:"current_admin_qpairs"`
		CurrentIoQpairs    int    `json:"current_io_qpairs"`
		PendingBdevIo      int    `json:"pending_bdev_io"`
		Transports         []struct {
			Trtype string `json:"trtype"`
		} `json:"transports"`
	} `json:"poll_groups"`
}

NvmfGetSubsystemStatsResult is the result of NVMf subsystem statistics

type NvmfGetSubsystemsResult

type NvmfGetSubsystemsResult struct {
	Nqn             string        `json:"nqn"`
	Subtype         string        `json:"subtype"`
	ListenAddresses []interface{} `json:"listen_addresses"`
	AllowAnyHost    bool          `json:"allow_any_host"`
	Hosts           []interface{} `json:"hosts"`
	SerialNumber    string        `json:"serial_number,omitempty"`
	ModelNumber     string        `json:"model_number,omitempty"`
	MaxNamespaces   int           `json:"max_namespaces,omitempty"`
	MinCntlid       int           `json:"min_cntlid,omitempty"`
	MaxCntlid       int           `json:"max_cntlid,omitempty"`
	Namespaces      []struct {
		Nsid int    `json:"nsid"`
		Name string `json:"name"`
	} `json:"namespaces,omitempty"`
}

NvmfGetSubsystemsResult is the result of listing all NVMf subsystems

type NvmfService

NvmfService is interface to all nvme over fabric functions in spdk

type NvmfServiceImpl

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

NvmfServiceImpl implements NvmfService interface

func NewNvmfService

func NewNvmfService() *NvmfServiceImpl

NewNvmfService is a constructor for NvmfServiceImpl

func (*NvmfServiceImpl) AddListener

AddListener adds nvme listener

func (*NvmfServiceImpl) AddNamespace

AddNamespace adds nvme namespace

func (*NvmfServiceImpl) CreateSubsystem

func (p *NvmfServiceImpl) CreateSubsystem(ctx context.Context, nqn string, serial string, model string, ns int) (*NvmfCreateSubsystemResult, error)

CreateSubsystem creates nvme subsystem

func (*NvmfServiceImpl) DeleteSubsystem

DeleteSubsystem deletes nvme subsystem

func (*NvmfServiceImpl) GetStats

GetStats gets nvme subsystem stats

func (*NvmfServiceImpl) GetSubsystems

func (p *NvmfServiceImpl) GetSubsystems(_ context.Context, _ int, _ int) (*NvmfGetSubsystemsResult, error)

GetSubsystems gets nvme subsystem

func (*NvmfServiceImpl) RemoveListener

RemoveListener removes nvme listener

func (*NvmfServiceImpl) RemoveNamespace

RemoveNamespace removes nvme namespace

type NvmfSubsystemAddHostParams

type NvmfSubsystemAddHostParams struct {
	Nqn     string `json:"nqn"`
	Host    string `json:"host"`
	TgtName string `json:"tgt_name,omitempty"`
	Psk     string `json:"psk,omitempty"`
}

NvmfSubsystemAddHostParams holds the parameters required to add a host to NVMf subsystem

type NvmfSubsystemAddHostResult

type NvmfSubsystemAddHostResult bool

NvmfSubsystemAddHostResult is the result of adding host to NVMf subsystem

type NvmfSubsystemAddListenerParams

type NvmfSubsystemAddListenerParams struct {
	Nqn           string `json:"nqn"`
	SecureChannel bool   `json:"secure_channel,omitempty"`
	ListenAddress struct {
		Trtype  string `json:"trtype"`
		Traddr  string `json:"traddr"`
		Trsvcid string `json:"trsvcid,omitempty"`
		Adrfam  string `json:"adrfam,omitempty"`
	} `json:"listen_address"`
}

NvmfSubsystemAddListenerParams holds the parameters required to Delete a NVMf subsystem

type NvmfSubsystemAddListenerResult

type NvmfSubsystemAddListenerResult bool

NvmfSubsystemAddListenerResult is the result of creating a NVMf subsystem

type NvmfSubsystemAddNsParams

type NvmfSubsystemAddNsParams struct {
	Nqn       string `json:"nqn"`
	Namespace struct {
		Nsid     int    `json:"nsid"`
		BdevName string `json:"bdev_name"`
	} `json:"namespace"`
}

NvmfSubsystemAddNsParams holds the parameters required to add a namespace to an existing subsystem

type NvmfSubsystemAddNsResult

type NvmfSubsystemAddNsResult int

NvmfSubsystemAddNsResult is the result NSID of attaching a namespace to an existing subsystem

type NvmfSubsystemRemoveNsParams

type NvmfSubsystemRemoveNsParams struct {
	Nqn  string `json:"nqn"`
	Nsid int    `json:"nsid"`
}

NvmfSubsystemRemoveNsParams holds the parameters required to Delete a NVMf subsystem

type NvmfSubsystemRemoveNsResult

type NvmfSubsystemRemoveNsResult bool

NvmfSubsystemRemoveNsResult is the result of creating a NVMf subsystem

type RPCError

type RPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

RPCError holds the parameters of the error structs

func (RPCError) Error

func (e RPCError) Error() string

Error returns formatted string of RPC error

type RPCRequest

type RPCRequest struct {
	RPCVersion string      `json:"jsonrpc"`
	Method     string      `json:"method"`
	ID         uint64      `json:"id"`
	Params     interface{} `json:"params,omitempty"`
}

RPCRequest holds the parameters required to request struct

type RPCResponse

type RPCResponse struct {
	JSONRPCVersion string          `json:"jsonrpc"`
	ID             uint64          `json:"id"`
	Result         json.RawMessage `json:"result"`
	Error          RPCError        `json:"error"`
}

RPCResponse holds the parameters of the response struct

type VhostCreateBlkControllerParams

type VhostCreateBlkControllerParams struct {
	Ctrlr   string `json:"ctrlr"`
	DevName string `json:"dev_name"`
}

VhostCreateBlkControllerParams holds the parameters required to create a block device from a vhost controller

type VhostCreateBlkControllerResult

type VhostCreateBlkControllerResult bool

VhostCreateBlkControllerResult is the result of creating a block device from a vhost controller

type VhostCreateScsiControllerParams

type VhostCreateScsiControllerParams struct {
	Ctrlr string `json:"ctrlr"`
}

VhostCreateScsiControllerParams holds the parameters required to create a SCSI controller

type VhostCreateScsiControllerResult

type VhostCreateScsiControllerResult bool

VhostCreateScsiControllerResult is the result of creating a SCSI controller

type VhostDeleteControllerParams

type VhostDeleteControllerParams struct {
	Ctrlr string `json:"ctrlr"`
}

VhostDeleteControllerParams holds the parameters required to delete a vhost controller

type VhostDeleteControllerResult

type VhostDeleteControllerResult bool

VhostDeleteControllerResult is the result of deleting a vhost controller

type VhostGetControllersParams

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

VhostGetControllersParams holds the parameters required to get a vhost controller

type VhostGetControllersResult

type VhostGetControllersResult struct {
	Ctrlr           string `json:"ctrlr"`
	Cpumask         string `json:"cpumask"`
	DelayBaseUs     int    `json:"delay_base_us"`
	IopsThreshold   int    `json:"iops_threshold"`
	Socket          string `json:"socket"`
	BackendSpecific struct {
		Block struct {
			Readonly bool   `json:"readonly"`
			Bdev     string `json:"bdev"`
		} `json:"block"`
	} `json:"backend_specific"`
}

VhostGetControllersResult is the result of getting a vhost controller

Jump to

Keyboard shortcuts

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