zram

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDriverName = "zram.csi.k8s.io"
	TopologyKeyNode   = "topology.hostpath.csi/node"
)

Variables

This section is empty.

Functions

func GetDeviceNameFromMountPath

func GetDeviceNameFromMountPath(mounter mount.Interface, mountPath string) (string, int, error)

GetDeviceNameFromMount given a mnt point, find the device from /proc/mounts returns the device name, reference count, and error code.

func GetVersionYAML

func GetVersionYAML(driverName string) (string, error)

GetVersionYAML returns the version information of the driver in YAML format

func IsCorruptedDir

func IsCorruptedDir(dir string) bool

func Mkdir

func Mkdir(m *mount.SafeFormatAndMount, name string, perm os.FileMode) error

func Mount

func Mount(m *mount.SafeFormatAndMount, source, target, fsType string, options []string) error

func NewFakeMounter

func NewFakeMounter() (*mount.SafeFormatAndMount, error)

func Unmount

func Unmount(m *mount.SafeFormatAndMount, target string, extensiveMountPointCheck bool) error

Types

type Driver

type Driver struct {
	csicommon.CSIDriver
	// contains filtered or unexported fields
}

Driver implements all interfaces of CSI drivers

func NewDriver

func NewDriver(options *DriverOptions) *Driver

NewDriver Creates a NewCSIDriver object. Assumes vendor version is equal to driver version & does not support optional driver plugin info manifest field. Refer to CSI spec for more details.

func (*Driver) ControllerExpandVolume

ControllerExpandVolume expand volume

func (*Driver) ControllerGetCapabilities

ControllerGetCapabilities returns the capabilities of the Controller plugin

func (*Driver) ControllerGetVolume

ControllerGetVolume get volume

func (*Driver) CreateSnapshot

func (*Driver) CreateVolume

func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)

func (*Driver) DeleteSnapshot

func (*Driver) DeleteVolume

func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)

DeleteVolume only supports static provisioning, no delete volume action

func (*Driver) GetCapacity

func (d *Driver) GetCapacity(ctx context.Context, req *csi.GetCapacityRequest) (*csi.GetCapacityResponse, error)

GetCapacity returns the capacity of the total available storage pool

func (*Driver) GetPluginCapabilities

GetPluginCapabilities returns the capabilities of the plugin

func (*Driver) GetPluginInfo

func (f *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

GetPluginInfo return the version and name of the plugin

func (*Driver) ListSnapshots

func (d *Driver) ListSnapshots(ctx context.Context, req *csi.ListSnapshotsRequest) (*csi.ListSnapshotsResponse, error)

func (*Driver) ListVolumes

func (d *Driver) ListVolumes(ctx context.Context, req *csi.ListVolumesRequest) (*csi.ListVolumesResponse, error)

ListVolumes return all available volumes

func (*Driver) NodeExpandVolume

NodeExpandVolume node expand volume N/A for zram

func (*Driver) NodeGetCapabilities

NodeGetCapabilities return the capabilities of the Node plugin

func (*Driver) NodeGetInfo

func (d *Driver) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)

NodeGetInfo return info of the node on which this plugin is running

func (*Driver) NodeGetVolumeStats

NodeGetVolumeStats get volume stats

func (*Driver) NodePublishVolume

NodePublishVolume mount the volume from staging to target path

func (*Driver) NodeStageVolume

NodeStageVolume mount the volume to a staging path

func (*Driver) NodeUnpublishVolume

NodeUnpublishVolume unmount the volume from the target path

func (*Driver) NodeUnstageVolume

NodeUnstageVolume unmount the volume from the staging path

func (*Driver) Probe

func (f *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

Probe check whether the plugin is running or not. This method does not need to return anything. Currently the spec does not dictate what you should return either. Hence, return an empty response

func (*Driver) Run

func (d *Driver) Run(endpoint string, testMode bool)

Run driver initialization

type DriverOptions

type DriverOptions struct {
	NodeID               string
	DriverName           string
	EnableGetVolumeStats bool
	EnableTopology       bool
	WorkingMountDir      string
}

DriverOptions defines driver parameters specified in driver deployment

type VersionInfo

type VersionInfo struct {
	DriverName    string `json:"Driver Name"`
	DriverVersion string `json:"Driver Version"`
	GitCommit     string `json:"Git Commit"`
	BuildDate     string `json:"Build Date"`
	GoVersion     string `json:"Go Version"`
	Compiler      string `json:"Compiler"`
	Platform      string `json:"Platform"`
}

VersionInfo holds the version information of the driver

func GetVersion

func GetVersion(driverName string) VersionInfo

GetVersion returns the version information of the driver

type ZRAMDevice

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

func NewZRAMDevice

func NewZRAMDevice() (*ZRAMDevice, error)

func NewZRAMDeviceFromId

func NewZRAMDeviceFromId(id int) (*ZRAMDevice, error)

func NewZRAMDeviceFromMountPath

func NewZRAMDeviceFromMountPath(mountPath string) (*ZRAMDevice, error)

func (*ZRAMDevice) FormatAndMount

func (d *ZRAMDevice) FormatAndMount(mountPath, fsType string, options []string) error

func (*ZRAMDevice) GetDevPath

func (d *ZRAMDevice) GetDevPath() string

func (*ZRAMDevice) GetId

func (d *ZRAMDevice) GetId() int

func (*ZRAMDevice) GetMounter

func (d *ZRAMDevice) GetMounter() *mount.SafeFormatAndMount

func (*ZRAMDevice) GetSysPath

func (d *ZRAMDevice) GetSysPath() string

func (*ZRAMDevice) RefCount

func (d *ZRAMDevice) RefCount() (int, error)

func (*ZRAMDevice) Remove

func (d *ZRAMDevice) Remove() error

func (*ZRAMDevice) Reset

func (d *ZRAMDevice) Reset() error

func (*ZRAMDevice) SetCompAlgorithm

func (d *ZRAMDevice) SetCompAlgorithm(compAlgorithm string) error

func (*ZRAMDevice) SetDiskSize

func (d *ZRAMDevice) SetDiskSize(diskSize int64) error

func (*ZRAMDevice) SetMaxCompStreams

func (d *ZRAMDevice) SetMaxCompStreams(maxCompStreams int) error

func (*ZRAMDevice) SetMemLimit

func (d *ZRAMDevice) SetMemLimit(memLimit int64) error

func (*ZRAMDevice) UnmountAndCleanup

func (d *ZRAMDevice) UnmountAndCleanup() error

Jump to

Keyboard shortcuts

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