Documentation ¶
Index ¶
- Constants
- Variables
- func GetVersionYAML(driverName string) (string, error)
- type ControlServer
- func (cs *ControlServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
- func (cs *ControlServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
- func (cs *ControlServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
- func (cs *ControlServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
- func (cs *ControlServer) SetCapabilities(caps []csi.ControllerServiceCapability_RPC_Type)
- func (cs *ControlServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
- type Driver
- func (d *Driver) CopyFile(ctx context.Context, srcRemote, srcPath, destRemote, destPath string) error
- func (d *Driver) ExpandVolume(ctx context.Context, id string, capacity int64) error
- func (d *Driver) GetMountOpt() (string, error)
- func (d *Driver) GetVfsOpt() (string, error)
- func (d *Driver) IsVolume(ctx context.Context, id string) (exist bool, err error)
- func (d *Driver) MountVolume(ctx context.Context, id, mountPoint string, parameters map[string]string) error
- func (d *Driver) MoveFile(ctx context.Context, srcRemote, srcPath, destRemote, destPath string) error
- func (d *Driver) PurgeVolume(ctx context.Context, id string) error
- func (d *Driver) RC(ctx context.Context, path string, in rc.Params) (out rc.Params, err error)
- func (d *Driver) ReadVolume(ctx context.Context, id string) (*Volume, error)
- func (d *Driver) Start()
- func (d *Driver) Stop()
- func (d *Driver) Wait()
- func (d *Driver) WriteVolume(ctx context.Context, v *Volume) error
- type DriverOptions
- type IdentityServer
- func (ids *IdentityServer) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
- func (ids *IdentityServer) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
- func (ids *IdentityServer) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)
- type NodeServer
- func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (ns *NodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (ns *NodeServer) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (ns *NodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (ns *NodeServer) SetCapabilities(caps []csi.NodeServiceCapability_RPC_Type)
- type NonBlockingGRPCServer
- type VersionInfo
- type Volume
- type VolumeLocks
Constants ¶
const ( DefaultDriverName = "rclone.csi.k8s.io" DefaultDriverEndpoint = "unix:///tmp/csi.sock" DefaultMountType = "mount2" )
Variables ¶
var ( ErrNotFound = errors.New("metadata file not found") ErrRemoteNotFound = errors.New("didn't find section in config file") ErrMetaWrongID = errors.New("different id found in metadata file") ErrMetaWrongCapacity = errors.New("different capacity found in metadata file") )
var MetadataFilename = ".csi-metadata"
Functions ¶
func GetVersionYAML ¶
GetVersionYAML returns the version information of the driver in YAML format
Types ¶
type ControlServer ¶
type ControlServer struct { *csicommon.ControlServer // contains filtered or unexported fields }
ControlServer is responsible of controlling and managing the volumes, such as: creating, deleting, attaching/detaching, snapshotting, etc..
func NewControlServer ¶
func NewControlServer(d *Driver) *ControlServer
NewControlServer returns a working control server.
func (*ControlServer) ControllerExpandVolume ¶
func (cs *ControlServer) ControllerExpandVolume(ctx context.Context, req *csi.ControllerExpandVolumeRequest) (*csi.ControllerExpandVolumeResponse, error)
ControllerExpandVolume
func (*ControlServer) ControllerGetCapabilities ¶
func (cs *ControlServer) ControllerGetCapabilities(ctx context.Context, req *csi.ControllerGetCapabilitiesRequest) (*csi.ControllerGetCapabilitiesResponse, error)
ControllerGetCapabilities
func (*ControlServer) CreateVolume ¶
func (cs *ControlServer) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest) (*csi.CreateVolumeResponse, error)
CreateVolume
func (*ControlServer) DeleteVolume ¶
func (cs *ControlServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error)
DeleteVolume
func (*ControlServer) SetCapabilities ¶
func (cs *ControlServer) SetCapabilities(caps []csi.ControllerServiceCapability_RPC_Type)
SetCapabilities
func (*ControlServer) ValidateVolumeCapabilities ¶
func (cs *ControlServer) ValidateVolumeCapabilities(ctx context.Context, req *csi.ValidateVolumeCapabilitiesRequest) (*csi.ValidateVolumeCapabilitiesResponse, error)
ValidateVolumeCapabilities
type Driver ¶
type Driver struct { *DriverOptions Version string WorkDir string Server NonBlockingGRPCServer Locks *VolumeLocks }
func NewDriver ¶
func NewDriver(opts *DriverOptions) (d *Driver)
func (*Driver) ExpandVolume ¶
func (*Driver) GetMountOpt ¶
func (*Driver) MountVolume ¶
func (*Driver) ReadVolume ¶
ReadVolume returns nil if no volume is found
type DriverOptions ¶
type DriverOptions struct { DriverName string NodeId string Endpoint string Address string Username string Password string Remote string MountType string MountOpt map[string]string VfsOpt map[string]string }
func (*DriverOptions) Validate ¶
func (o *DriverOptions) Validate() (err error)
type IdentityServer ¶
type IdentityServer struct {
// contains filtered or unexported fields
}
IdentityServer consists of basic methods, mainly for identifying the service, making sure it's healthy, and returning basic information about the plugin itself.
func NewIdentityServer ¶
func NewIdentityServer(d *Driver) *IdentityServer
NewIdentityServer satisfies the csi.IdentityServer interface.
func (*IdentityServer) GetPluginCapabilities ¶
func (ids *IdentityServer) GetPluginCapabilities(_ context.Context, _ *csi.GetPluginCapabilitiesRequest) (*csi.GetPluginCapabilitiesResponse, error)
GetPluginCapabilities returns the capabilities of the plugin. Currently it reports whether the plugin has the ability of serving the Controller interface. The CO calls the Controller interface methods depending on whether this method returns the capability or not.
func (*IdentityServer) GetPluginInfo ¶
func (ids *IdentityServer) GetPluginInfo(_ context.Context, _ *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)
GetPluginInfo returns the name and version of the plugin.
func (*IdentityServer) Probe ¶
func (ids *IdentityServer) Probe(_ context.Context, _ *csi.ProbeRequest) (*csi.ProbeResponse, error)
Probe checks 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 responsDrivere
type NodeServer ¶
type NodeServer struct { *csicommon.NodeServer // contains filtered or unexported fields }
NodeServer is responsible for managing the mounts and status of each node.
func NewNodeServer ¶
func NewNodeServer(d *Driver) *NodeServer
NewNodeServer returns a working node server.
func (*NodeServer) NodeExpandVolume ¶
func (ns *NodeServer) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
NodeExpandVolume node expand volume
func (*NodeServer) NodeGetCapabilities ¶
func (ns *NodeServer) NodeGetCapabilities(_ context.Context, _ *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
NodeGetCapabilities return the capabilities of the Node plugin
func (*NodeServer) NodeGetInfo ¶
func (ns *NodeServer) NodeGetInfo(_ context.Context, _ *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
NodeGetInfo return info of the node on which this plugin is running
func (*NodeServer) NodeGetVolumeStats ¶
func (ns *NodeServer) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats get volume stats
func (*NodeServer) NodePublishVolume ¶
func (ns *NodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
NodePublishVolume mount the volume from staging to target path
func (*NodeServer) NodeUnpublishVolume ¶
func (ns *NodeServer) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
NodeUnpublishVolume unmount the volume from the target path
func (*NodeServer) SetCapabilities ¶
func (ns *NodeServer) SetCapabilities(caps []csi.NodeServiceCapability_RPC_Type)
type NonBlockingGRPCServer ¶
type NonBlockingGRPCServer interface { // Start services at the endpoint Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer) // Waits for the service to stop Wait() // Stops the service gracefully Stop() // Stops the service forcefully ForceStop() }
Defines Non blocking GRPC server interfaces
func NewNonBlockingGRPCServer ¶
func NewNonBlockingGRPCServer() NonBlockingGRPCServer
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 Volume ¶
type Volume struct { Remote string `json:"remote"` Name string `json:"name"` Capacity int64 `json:"capacity"` ID string `json:"id"` }
func NewVolumeFromJSON ¶
func (*Volume) IsConflict ¶
type VolumeLocks ¶
type VolumeLocks struct {
// contains filtered or unexported fields
}
VolumeLocks implements a map with atomic operations. It stores a set of all volume IDs with an ongoing operation.
func NewVolumeLocks ¶
func NewVolumeLocks() *VolumeLocks
func (*VolumeLocks) Release ¶
func (l *VolumeLocks) Release(volumeID string)
Release the lock on the specified volumeID
func (*VolumeLocks) TryAcquire ¶
func (l *VolumeLocks) TryAcquire(volumeID string) bool
TryAcquire tries to acquire the lock for operating on volumeID and returns true if successful. If another operation is already using volumeID, returns false.