Documentation ¶
Overview ¶
Package gocsi provides a Container Storage Interface (CSI) library, client, and other helpful utilities.
Index ¶
- Constants
- Variables
- func ChainUnaryClient(i ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
- func ChainUnaryServer(i ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
- func CheckResponseErrControllerGetCapabilities(ctx context.Context, method string, ...) error
- func CheckResponseErrControllerPublishVolume(ctx context.Context, method string, ...) error
- func CheckResponseErrControllerUnpublishVolume(ctx context.Context, method string, ...) error
- func CheckResponseErrCreateVolume(ctx context.Context, method string, response *csi.CreateVolumeResponse) error
- func CheckResponseErrDeleteVolume(ctx context.Context, method string, response *csi.DeleteVolumeResponse) error
- func CheckResponseErrGetCapacity(ctx context.Context, method string, response *csi.GetCapacityResponse) error
- func CheckResponseErrGetNodeID(ctx context.Context, method string, response *csi.GetNodeIDResponse) error
- func CheckResponseErrGetPluginInfo(ctx context.Context, method string, response *csi.GetPluginInfoResponse) error
- func CheckResponseErrGetSupportedVersions(ctx context.Context, method string, response *csi.GetSupportedVersionsResponse) error
- func CheckResponseErrListVolumes(ctx context.Context, method string, response *csi.ListVolumesResponse) error
- func CheckResponseErrNodeGetCapabilities(ctx context.Context, method string, response *csi.NodeGetCapabilitiesResponse) error
- func CheckResponseErrNodePublishVolume(ctx context.Context, method string, response *csi.NodePublishVolumeResponse) error
- func CheckResponseErrNodeUnpublishVolume(ctx context.Context, method string, response *csi.NodeUnpublishVolumeResponse) error
- func CheckResponseErrProbeNode(ctx context.Context, method string, response *csi.ProbeNodeResponse) error
- func CheckResponseErrValidateVolumeCapabilities(ctx context.Context, method string, ...) error
- func ClientCheckReponseError(ctx context.Context, method string, req, rep interface{}, cc *grpc.ClientConn, ...) error
- func ClientResponseValidator(ctx context.Context, method string, req, rep interface{}, cc *grpc.ClientConn, ...) error
- func CompareVersions(a, b Version) int8
- func ControllerGetCapabilities(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) (capabilties []*csi.ControllerServiceCapability, err error)
- func ControllerPublishVolume(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) (*csi.PublishVolumeInfo, error)
- func ControllerUnpublishVolume(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) error
- func CreateVolume(ctx context.Context, c csi.ControllerClient, version *csi.Version, name string, ...) (volume *csi.VolumeInfo, err error)
- func DeleteVolume(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) error
- func ErrControllerGetCapabilities(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerGetCapabilitiesResponse
- func ErrControllerPublishVolume(code csi.Error_ControllerPublishVolumeError_ControllerPublishVolumeErrorCode, ...) *csi.ControllerPublishVolumeResponse
- func ErrControllerPublishVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerPublishVolumeResponse
- func ErrControllerUnpublishVolume(...) *csi.ControllerUnpublishVolumeResponse
- func ErrControllerUnpublishVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerUnpublishVolumeResponse
- func ErrCreateVolume(code csi.Error_CreateVolumeError_CreateVolumeErrorCode, msg string) *csi.CreateVolumeResponse
- func ErrCreateVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.CreateVolumeResponse
- func ErrDeleteVolume(code csi.Error_DeleteVolumeError_DeleteVolumeErrorCode, msg string) *csi.DeleteVolumeResponse
- func ErrDeleteVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.DeleteVolumeResponse
- func ErrGetCapacity(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetCapacityResponse
- func ErrGetNodeID(code csi.Error_GetNodeIDError_GetNodeIDErrorCode, msg string) *csi.GetNodeIDResponse
- func ErrGetNodeIDGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetNodeIDResponse
- func ErrGetPluginInfo(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetPluginInfoResponse
- func ErrGetSupportedVersions(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetSupportedVersionsResponse
- func ErrListVolumes(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ListVolumesResponse
- func ErrNodeGetCapabilities(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodeGetCapabilitiesResponse
- func ErrNodePublishVolume(code csi.Error_NodePublishVolumeError_NodePublishVolumeErrorCode, msg string) *csi.NodePublishVolumeResponse
- func ErrNodePublishVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodePublishVolumeResponse
- func ErrNodeUnpublishVolume(code csi.Error_NodeUnpublishVolumeError_NodeUnpublishVolumeErrorCode, ...) *csi.NodeUnpublishVolumeResponse
- func ErrNodeUnpublishVolumeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodeUnpublishVolumeResponse
- func ErrProbeNode(code csi.Error_ProbeNodeError_ProbeNodeErrorCode, msg string) *csi.ProbeNodeResponse
- func ErrProbeNodeGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ProbeNodeResponse
- func ErrValidateVolumeCapabilities(...) *csi.ValidateVolumeCapabilitiesResponse
- func ErrValidateVolumeCapabilitiesGeneral(code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ValidateVolumeCapabilitiesResponse
- func GetCSIEndpoint() (network, addr string, err error)
- func GetCSIEndpointListener() (net.Listener, error)
- func GetCapacity(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) (uint64, error)
- func GetNodeID(ctx context.Context, c csi.NodeClient, version *csi.Version, ...) (*csi.NodeID, error)
- func GetPluginInfo(ctx context.Context, c csi.IdentityClient, version *csi.Version, ...) (*csi.GetPluginInfoResponse_Result, error)
- func GetRequestID(ctx context.Context) (uint64, bool)
- func GetSupportedVersions(ctx context.Context, c csi.IdentityClient, callOpts ...grpc.CallOption) ([]*csi.Version, error)
- func ListVolumes(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) (volumes []*csi.VolumeInfo, nextToken string, err error)
- func NewBlockCapability(mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability
- func NewIdempotentInterceptor(p IdempotencyProvider, timeout time.Duration) grpc.UnaryServerInterceptor
- func NewMountCapability(mode csi.VolumeCapability_AccessMode_Mode, fsType string, mountFlags []string) *csi.VolumeCapability
- func NewServerRequestLogger(stdout, stderr io.Writer) grpc.UnaryServerInterceptor
- func NewServerRequestVersionValidator(supported []*csi.Version) grpc.UnaryServerInterceptor
- func NewServerResponseLogger(stdout, stderr io.Writer) grpc.UnaryServerInterceptor
- func NodeGetCapabilities(ctx context.Context, c csi.NodeClient, version *csi.Version, ...) (capabilties []*csi.NodeServiceCapability, err error)
- func NodePublishVolume(ctx context.Context, c csi.NodeClient, version *csi.Version, ...) error
- func NodeUnpublishVolume(ctx context.Context, c csi.NodeClient, version *csi.Version, ...) error
- func ParseProtoAddr(protoAddr string) (proto string, addr string, err error)
- func ProbeNode(ctx context.Context, c csi.NodeClient, version *csi.Version, ...) error
- func ServerRequestIDInjector(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func ServerRequestValidator(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func SprintfVersion(v Version) string
- func ValidateVolumeCapabilities(ctx context.Context, c csi.ControllerClient, version *csi.Version, ...) (*csi.ValidateVolumeCapabilitiesResponse_Result, error)
- type Error
- type IdempotencyProvider
- type MutexWithTryLock
- type Version
Constants ¶
const ( // FMCreateVolume is the full method name for the // eponymous RPC message. FMCreateVolume = "/" + Namespace + ".Controller/" + "CreateVolume" // FMDeleteVolume is the full method name for the // eponymous RPC message. FMDeleteVolume = "/" + Namespace + ".Controller/" + "DeleteVolume" // FMControllerPublishVolume is the full method name for the // eponymous RPC message. FMControllerPublishVolume = "/" + Namespace + ".Controller/" + "ControllerPublishVolume" // FMControllerUnpublishVolume is the full method name for the // eponymous RPC message. FMControllerUnpublishVolume = "/" + Namespace + ".Controller/" + "ControllerUnpublishVolume" // FMValidateVolumeCapabilities is the full method name for the // eponymous RPC message. FMValidateVolumeCapabilities = "/" + Namespace + ".Controller/" + "ValidateVolumeCapabilities" // FMListVolumes is the full method name for the // eponymous RPC message. FMListVolumes = "/" + Namespace + ".Controller/" + "ListVolumes" // FMGetCapacity is the full method name for the // eponymous RPC message. FMGetCapacity = "/" + Namespace + ".Controller/" + "GetCapacity" // FMControllerGetCapabilities is the full method name for the // eponymous RPC message. FMControllerGetCapabilities = "/" + Namespace + ".Controller/" + "ControllerGetCapabilities" )
const ( // Namespace is the namesapce used by the protobuf. Namespace = "csi" // CSIEndpoint is the name of the environment variable that // contains the CSI endpoint. CSIEndpoint = "CSI_ENDPOINT" )
const ( // FMGetSupportedVersions is the full method name for the // eponymous RPC message. FMGetSupportedVersions = "/" + Namespace + ".Identity/" + "GetSupportedVersions" // FMGetPluginInfo is the full method name for the // eponymous RPC message. FMGetPluginInfo = "/" + Namespace + ".Identity/" + "GetPluginInfo" )
const ( // FMGetNodeID is the full method name for the // eponymous RPC message. FMGetNodeID = "/" + Namespace + ".Node/" + "GetNodeID" // FMNodePublishVolume is the full method name for the // eponymous RPC message. FMNodePublishVolume = "/" + Namespace + ".Node/" + "NodePublishVolume" // FMNodeUnpublishVolume is the full method name for the // eponymous RPC message. FMNodeUnpublishVolume = "/" + Namespace + ".Node/" + "NodeUnpublishVolume" // FMProbeNode is the full method name for the // eponymous RPC message. FMProbeNode = "/" + Namespace + ".Node/" + "ProbeNode" // FMNodeGetCapabilities is the full method name for the // eponymous RPC message. FMNodeGetCapabilities = "/" + Namespace + ".Node/" + "NodeGetCapabilities" )
const ErrorNoCode int32 = -1
ErrorNoCode is the value that indicates the error code is not set.
Variables ¶
var ErrEmptyPublishVolumeInfo = errors.New("publishVolumeInfo is empty")
ErrEmptyPublishVolumeInfo occurs when a gRPC call returns a PublishVolumeInfo with an empty Values field.
var ErrEmptyServices = errors.New("services list is empty")
ErrEmptyServices occurs when a Server's Services list is empty.
var ErrInvalidProvider = errors.New("invalid service provider")
ErrInvalidProvider is returned from NewService if the specified provider name is unknown.
var ErrInvalidTargetPath = errors.New("invalid targetPath")
ErrInvalidTargetPath occurs when an RPC call is made with an invalid targetPath argument.
var ErrMissingCSIEndpoint = errors.New("missing CSI_ENDPOINT")
ErrMissingCSIEndpoint occurs when the value for the environment variable CSI_ENDPOINT is not set.
var ErrNilNodeID = errors.New("nodeID is nil")
ErrNilNodeID occurs when a gRPC call returns a nil NodeID.
var ErrNilPublishVolumeInfo = errors.New("publishVolumeInfo is nil")
ErrNilPublishVolumeInfo occurs when a gRPC call returns a nil PublishVolumeInfo.
var ErrNilResult = errors.New("result is nil")
ErrNilResult occurs when a gRPC call returns a nil Result.
var ErrNilSupportedVersions = errors.New("supportedVersions is nil")
ErrNilSupportedVersions occurs when a gRPC call returns nil SupportedVersions
var ErrNilVolumeID = errors.New("volumeInfo.Id is nil")
ErrNilVolumeID occurs when a gRPC call returns a VolumeInfo with a nil Id field.
var ErrNilVolumeInfo = errors.New("volumeInfo is nil")
ErrNilVolumeInfo occurs when a gRPC call returns a nil VolumeInfo.
var ErrParseProtoAddrRequired = errors.New(
"non-empty network address is required")
ErrParseProtoAddrRequired occurs when an empty string is provided to ParseProtoAddr.
var ErrVersionRequired = errors.New("version is required")
ErrVersionRequired occurs when an RPC call is made with a nil version argument.
var ErrVolumeCapabilityRequired = errors.New("volumeCapability is required")
ErrVolumeCapabilityRequired occurs when an RPC call is made with a nil volumeCapability argument.
var ErrVolumeIDRequired = errors.New("volumeID is required")
ErrVolumeIDRequired occurs when an RPC call is made with a nil volumeID argument.
var ErrVolumeInfoRequired = errors.New("volumeInfo is required")
ErrVolumeInfoRequired occurs when an RPC call is made with a nil volumeI argument.
Functions ¶
func ChainUnaryClient ¶
func ChainUnaryClient( i ...grpc.UnaryClientInterceptor) grpc.UnaryClientInterceptor
ChainUnaryClient chains one or more unary, client interceptors together into a left-to-right series that can be provided to a new gRPC client.
func ChainUnaryServer ¶
func ChainUnaryServer( i ...grpc.UnaryServerInterceptor) grpc.UnaryServerInterceptor
ChainUnaryServer chains one or more unary, server interceptors together into a left-to-right series that can be provided to a new gRPC server.
func CheckResponseErrControllerGetCapabilities ¶
func CheckResponseErrControllerGetCapabilities( ctx context.Context, method string, response *csi.ControllerGetCapabilitiesResponse) error
CheckResponseErrControllerGetCapabilities returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrControllerPublishVolume ¶
func CheckResponseErrControllerPublishVolume( ctx context.Context, method string, response *csi.ControllerPublishVolumeResponse) error
CheckResponseErrControllerPublishVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrControllerUnpublishVolume ¶
func CheckResponseErrControllerUnpublishVolume( ctx context.Context, method string, response *csi.ControllerUnpublishVolumeResponse) error
CheckResponseErrControllerUnpublishVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrCreateVolume ¶
func CheckResponseErrCreateVolume( ctx context.Context, method string, response *csi.CreateVolumeResponse) error
CheckResponseErrCreateVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrDeleteVolume ¶
func CheckResponseErrDeleteVolume( ctx context.Context, method string, response *csi.DeleteVolumeResponse) error
CheckResponseErrDeleteVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrGetCapacity ¶
func CheckResponseErrGetCapacity( ctx context.Context, method string, response *csi.GetCapacityResponse) error
CheckResponseErrGetCapacity returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrGetNodeID ¶
func CheckResponseErrGetNodeID( ctx context.Context, method string, response *csi.GetNodeIDResponse) error
CheckResponseErrGetNodeID returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrGetPluginInfo ¶
func CheckResponseErrGetPluginInfo( ctx context.Context, method string, response *csi.GetPluginInfoResponse) error
CheckResponseErrGetPluginInfo returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrGetSupportedVersions ¶
func CheckResponseErrGetSupportedVersions( ctx context.Context, method string, response *csi.GetSupportedVersionsResponse) error
CheckResponseErrGetSupportedVersions returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrListVolumes ¶
func CheckResponseErrListVolumes( ctx context.Context, method string, response *csi.ListVolumesResponse) error
CheckResponseErrListVolumes returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrNodeGetCapabilities ¶
func CheckResponseErrNodeGetCapabilities( ctx context.Context, method string, response *csi.NodeGetCapabilitiesResponse) error
CheckResponseErrNodeGetCapabilities returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrNodePublishVolume ¶
func CheckResponseErrNodePublishVolume( ctx context.Context, method string, response *csi.NodePublishVolumeResponse) error
CheckResponseErrNodePublishVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrNodeUnpublishVolume ¶
func CheckResponseErrNodeUnpublishVolume( ctx context.Context, method string, response *csi.NodeUnpublishVolumeResponse) error
CheckResponseErrNodeUnpublishVolume returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrProbeNode ¶
func CheckResponseErrProbeNode( ctx context.Context, method string, response *csi.ProbeNodeResponse) error
CheckResponseErrProbeNode returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func CheckResponseErrValidateVolumeCapabilities ¶
func CheckResponseErrValidateVolumeCapabilities( ctx context.Context, method string, response *csi.ValidateVolumeCapabilitiesResponse) error
CheckResponseErrValidateVolumeCapabilities returns a Go error for the error message inside of a CSI response if present; otherwise nil is returned.
func ClientCheckReponseError ¶
func ClientCheckReponseError( ctx context.Context, method string, req, rep interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
ClientCheckReponseError is a unary, client validator that checks a reply's message to see if it contains an error and transforms it into an *Error object, which adheres to Go's Error interface.
func ClientResponseValidator ¶
func ClientResponseValidator( ctx context.Context, method string, req, rep interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
ClientResponseValidator is a unary, client validator for validating replies from a CSI plug-in.
func CompareVersions ¶
CompareVersions compares two versions and returns:
-1 if a > b 0 if a = b 1 if a < b
func ControllerGetCapabilities ¶
func ControllerGetCapabilities( ctx context.Context, c csi.ControllerClient, version *csi.Version, callOpts ...grpc.CallOption) ( capabilties []*csi.ControllerServiceCapability, err error)
ControllerGetCapabilities issues a ControllerGetCapabilities request to a CSI controller.
func ControllerPublishVolume ¶
func ControllerPublishVolume( ctx context.Context, c csi.ControllerClient, version *csi.Version, volumeID *csi.VolumeID, volumeMetadata *csi.VolumeMetadata, nodeID *csi.NodeID, volumeCapability *csi.VolumeCapability, readonly bool, callOpts ...grpc.CallOption) ( *csi.PublishVolumeInfo, error)
ControllerPublishVolume issues a ControllerPublishVolume request to a CSI controller.
func ControllerUnpublishVolume ¶
func ControllerUnpublishVolume( ctx context.Context, c csi.ControllerClient, version *csi.Version, volumeID *csi.VolumeID, volumeMetadata *csi.VolumeMetadata, nodeID *csi.NodeID, callOpts ...grpc.CallOption) error
ControllerUnpublishVolume issues a ControllerUnpublishVolume request to a CSI controller.
func CreateVolume ¶
func CreateVolume( ctx context.Context, c csi.ControllerClient, version *csi.Version, name string, requiredBytes, limitBytes uint64, capabilities []*csi.VolumeCapability, params map[string]string, callOpts ...grpc.CallOption) (volume *csi.VolumeInfo, err error)
CreateVolume issues a CreateVolume request to a CSI controller.
func DeleteVolume ¶
func DeleteVolume( ctx context.Context, c csi.ControllerClient, version *csi.Version, volumeID *csi.VolumeID, volumeMetadata *csi.VolumeMetadata, callOpts ...grpc.CallOption) error
DeleteVolume issues a DeleteVolume request to a CSI controller.
func ErrControllerGetCapabilities ¶
func ErrControllerGetCapabilities( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerGetCapabilitiesResponse
ErrControllerGetCapabilities returns a ControllerGetCapabilitiesResponse with a GeneralError.
func ErrControllerPublishVolume ¶
func ErrControllerPublishVolume( code csi.Error_ControllerPublishVolumeError_ControllerPublishVolumeErrorCode, msg string) *csi.ControllerPublishVolumeResponse
ErrControllerPublishVolume returns a ControllerPublishVolumeResponse with a ControllerPublishVolumeVolumeError.
func ErrControllerPublishVolumeGeneral ¶
func ErrControllerPublishVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerPublishVolumeResponse
ErrControllerPublishVolumeGeneral returns a ControllerPublishVolumeResponse with a GeneralError.
func ErrControllerUnpublishVolume ¶
func ErrControllerUnpublishVolume( code csi.Error_ControllerUnpublishVolumeError_ControllerUnpublishVolumeErrorCode, msg string) *csi.ControllerUnpublishVolumeResponse
ErrControllerUnpublishVolume returns a ControllerUnpublishVolumeResponse with a ControllerUnpublishVolumeVolumeError.
func ErrControllerUnpublishVolumeGeneral ¶
func ErrControllerUnpublishVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ControllerUnpublishVolumeResponse
ErrControllerUnpublishVolumeGeneral returns a ControllerUnpublishVolumeResponse with a GeneralError.
func ErrCreateVolume ¶
func ErrCreateVolume( code csi.Error_CreateVolumeError_CreateVolumeErrorCode, msg string) *csi.CreateVolumeResponse
ErrCreateVolume returns a CreateVolumeResponse with a CreateVolumeError.
func ErrCreateVolumeGeneral ¶
func ErrCreateVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.CreateVolumeResponse
ErrCreateVolumeGeneral returns a CreateVolumeResponse with a GeneralError.
func ErrDeleteVolume ¶
func ErrDeleteVolume( code csi.Error_DeleteVolumeError_DeleteVolumeErrorCode, msg string) *csi.DeleteVolumeResponse
ErrDeleteVolume returns a DeleteVolumeResponse with a DeleteVolumeError.
func ErrDeleteVolumeGeneral ¶
func ErrDeleteVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.DeleteVolumeResponse
ErrDeleteVolumeGeneral returns a DeleteVolumeResponse with a GeneralError.
func ErrGetCapacity ¶
func ErrGetCapacity( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetCapacityResponse
ErrGetCapacity returns a GetCapacityResponse with a GeneralError.
func ErrGetNodeID ¶
func ErrGetNodeID( code csi.Error_GetNodeIDError_GetNodeIDErrorCode, msg string) *csi.GetNodeIDResponse
ErrGetNodeID returns a GetNodeIDResponse with a GetNodeIDError.
func ErrGetNodeIDGeneral ¶
func ErrGetNodeIDGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetNodeIDResponse
ErrGetNodeIDGeneral returns a GetNodeIDResponse with a GeneralError.
func ErrGetPluginInfo ¶
func ErrGetPluginInfo( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetPluginInfoResponse
ErrGetPluginInfo returns a GetPluginInfoResponse with a GeneralError.
func ErrGetSupportedVersions ¶
func ErrGetSupportedVersions( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.GetSupportedVersionsResponse
ErrGetSupportedVersions returns a GetSupportedVersionsResponse with a GeneralError.
func ErrListVolumes ¶
func ErrListVolumes( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ListVolumesResponse
ErrListVolumes returns a ListVolumesResponse with a GeneralError.
func ErrNodeGetCapabilities ¶
func ErrNodeGetCapabilities( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodeGetCapabilitiesResponse
ErrNodeGetCapabilities returns a NodeGetCapabilitiesResponse with a GeneralError.
func ErrNodePublishVolume ¶
func ErrNodePublishVolume( code csi.Error_NodePublishVolumeError_NodePublishVolumeErrorCode, msg string) *csi.NodePublishVolumeResponse
ErrNodePublishVolume returns a NodePublishVolumeResponse with a NodePublishVolumeError.
func ErrNodePublishVolumeGeneral ¶
func ErrNodePublishVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodePublishVolumeResponse
ErrNodePublishVolumeGeneral returns a NodePublishVolumeResponse with a GeneralError.
func ErrNodeUnpublishVolume ¶
func ErrNodeUnpublishVolume( code csi.Error_NodeUnpublishVolumeError_NodeUnpublishVolumeErrorCode, msg string) *csi.NodeUnpublishVolumeResponse
ErrNodeUnpublishVolume returns a NodeUnpublishVolumeResponse with a NodeUnpublishVolumeError.
func ErrNodeUnpublishVolumeGeneral ¶
func ErrNodeUnpublishVolumeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.NodeUnpublishVolumeResponse
ErrNodeUnpublishVolumeGeneral returns a NodeUnpublishVolumeResponse with a GeneralError.
func ErrProbeNode ¶
func ErrProbeNode( code csi.Error_ProbeNodeError_ProbeNodeErrorCode, msg string) *csi.ProbeNodeResponse
ErrProbeNode returns a ProbeNodeResponse with a ProbeNodeError.
func ErrProbeNodeGeneral ¶
func ErrProbeNodeGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ProbeNodeResponse
ErrProbeNodeGeneral returns a ProbeNodeResponse with a GeneralError.
func ErrValidateVolumeCapabilities ¶
func ErrValidateVolumeCapabilities( code csi.Error_ValidateVolumeCapabilitiesError_ValidateVolumeCapabilitiesErrorCode, msg string) *csi.ValidateVolumeCapabilitiesResponse
ErrValidateVolumeCapabilities returns a ValidateVolumeCapabilitiesResponse with a ValidateVolumeCapabilitiesError.
func ErrValidateVolumeCapabilitiesGeneral ¶
func ErrValidateVolumeCapabilitiesGeneral( code csi.Error_GeneralError_GeneralErrorCode, msg string) *csi.ValidateVolumeCapabilitiesResponse
ErrValidateVolumeCapabilitiesGeneral returns a ValidateVolumeCapabilitiesResponse with a GeneralError.
func GetCSIEndpoint ¶
GetCSIEndpoint returns the network address specified by the environment variable CSI_ENDPOINT.
func GetCSIEndpointListener ¶
GetCSIEndpointListener returns the net.Listener for the endpoint specified by the environment variable CSI_ENDPOINT.
func GetCapacity ¶
func GetCapacity( ctx context.Context, c csi.ControllerClient, version *csi.Version, volumeCapabilities []*csi.VolumeCapability, callOpts ...grpc.CallOption) (uint64, error)
GetCapacity issues a GetCapacity request to a CSI controller
func GetNodeID ¶
func GetNodeID( ctx context.Context, c csi.NodeClient, version *csi.Version, callOpts ...grpc.CallOption) (*csi.NodeID, error)
GetNodeID issues a GetNodeID request to a CSI controller.
func GetPluginInfo ¶
func GetPluginInfo( ctx context.Context, c csi.IdentityClient, version *csi.Version, callOpts ...grpc.CallOption) (*csi.GetPluginInfoResponse_Result, error)
GetPluginInfo issues a GetPluginInfo request to a CSI controller.
func GetRequestID ¶
GetRequestID gets the gRPC request ID from the provided context.
func GetSupportedVersions ¶
func GetSupportedVersions( ctx context.Context, c csi.IdentityClient, callOpts ...grpc.CallOption) ([]*csi.Version, error)
GetSupportedVersions issues a GetSupportedVersions request to a CSI controller.
func ListVolumes ¶
func ListVolumes( ctx context.Context, c csi.ControllerClient, version *csi.Version, maxEntries uint32, startingToken string, callOpts ...grpc.CallOption) ( volumes []*csi.VolumeInfo, nextToken string, err error)
ListVolumes issues a ListVolumes request to a CSI controller.
func NewBlockCapability ¶
func NewBlockCapability( mode csi.VolumeCapability_AccessMode_Mode) *csi.VolumeCapability
NewBlockCapability returns a new *csi.VolumeCapability for a volume that is to be accessed as a raw device.
func NewIdempotentInterceptor ¶
func NewIdempotentInterceptor( p IdempotencyProvider, timeout time.Duration) grpc.UnaryServerInterceptor
NewIdempotentInterceptor returns a new server-side, gRPC interceptor that can be used in conjunction with an IdempotencyProvider to provide serialized, idempotent access to the following CSI RPCs:
- CreateVolume
- DeleteVolume
- ControllerPublishVolume
- ControllerUnpublishVolume
- NodePublishVolume
- NodeUnpublishVolume
func NewMountCapability ¶
func NewMountCapability( mode csi.VolumeCapability_AccessMode_Mode, fsType string, mountFlags []string) *csi.VolumeCapability
NewMountCapability returns a new *csi.VolumeCapability for a volume that is to be mounted.
func NewServerRequestLogger ¶
func NewServerRequestLogger( stdout, stderr io.Writer) grpc.UnaryServerInterceptor
NewServerRequestLogger initializes a new unary, server interceptor that logs request details.
func NewServerRequestVersionValidator ¶
func NewServerRequestVersionValidator( supported []*csi.Version) grpc.UnaryServerInterceptor
NewServerRequestVersionValidator initializes a new unary server interceptor that validates request versions against the list of supported versions.
func NewServerResponseLogger ¶
func NewServerResponseLogger( stdout, stderr io.Writer) grpc.UnaryServerInterceptor
NewServerResponseLogger initializes a new unary, server interceptor that logs reply details.
func NodeGetCapabilities ¶
func NodeGetCapabilities( ctx context.Context, c csi.NodeClient, version *csi.Version, callOpts ...grpc.CallOption) ( capabilties []*csi.NodeServiceCapability, err error)
NodeGetCapabilities issues a NodeGetCapabilities request to a CSI controller.
func NodePublishVolume ¶
func NodePublishVolume( ctx context.Context, c csi.NodeClient, version *csi.Version, volumeID *csi.VolumeID, volumeMetadata *csi.VolumeMetadata, publishVolumeInfo *csi.PublishVolumeInfo, targetPath string, volumeCapability *csi.VolumeCapability, readonly bool, callOpts ...grpc.CallOption) error
NodePublishVolume issues a NodePublishVolume request to a CSI controller.
func NodeUnpublishVolume ¶
func NodeUnpublishVolume( ctx context.Context, c csi.NodeClient, version *csi.Version, volumeID *csi.VolumeID, volumeMetadata *csi.VolumeMetadata, targetPath string, callOpts ...grpc.CallOption) error
NodeUnpublishVolume issues a NodeUnpublishVolume request to a CSI controller.
func ParseProtoAddr ¶
ParseProtoAddr parses a Golang network address.
func ProbeNode ¶
func ProbeNode( ctx context.Context, c csi.NodeClient, version *csi.Version, callOpts ...grpc.CallOption) error
ProbeNode issues a ProbeNode request to a CSI controller.
func ServerRequestIDInjector ¶
func ServerRequestIDInjector( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
ServerRequestIDInjector is a unary server interceptor that injects request contexts with a unique request ID.
func ServerRequestValidator ¶
func ServerRequestValidator( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)
ServerRequestValidator is a UnaryServerInterceptor that validates server request data.
func SprintfVersion ¶
SprintfVersion formats a Version as a string.
func ValidateVolumeCapabilities ¶
func ValidateVolumeCapabilities( ctx context.Context, c csi.ControllerClient, version *csi.Version, volumeInfo *csi.VolumeInfo, volumeCapabilities []*csi.VolumeCapability, callOpts ...grpc.CallOption) (*csi.ValidateVolumeCapabilitiesResponse_Result, error)
ValidateVolumeCapabilities issues a ValidateVolumeCapabilities request to a CSI controller
Types ¶
type Error ¶
type Error struct { // Code is the error code. Code int32 // Description is the error description. Description string // FullMethod is the full name of the CSI method that returned the error. FullMethod string // InnerError is an optional inner error wrapped by this error. InnerError error }
Error is a client-side representation of the error message data returned from a CSI endpoint.
func (*Error) ErrorDescription ¶
ErrorDescription returns the CSI error description.
func (*Error) ErrorFullMethod ¶
ErrorFullMethod returns the full name of the CSI method that returned the error.
func (*Error) ErrorMethod ¶
ErrorMethod returns the name-only of the CSI method that returned the error.
func (*Error) MarshalText ¶
MarshalText encodes the receiver into UTF-8-encoded text and returns the result.
type IdempotencyProvider ¶
type IdempotencyProvider interface { // GetVolumeName should return the name of the volume specified // by the provided volume ID. If the volume does not exist then // an empty string should be returned. GetVolumeName( ctx context.Context, id *csi.VolumeID) (string, error) // GetVolumeInfo should return information about the volume // specified by the provided volume name. If the volume does not // exist then a nil value should be returned. GetVolumeInfo( ctx context.Context, name string) (*csi.VolumeInfo, error) // IsControllerPublished should return publication info about // the volume specified by the provided volume name or ID. IsControllerPublished( ctx context.Context, id *csi.VolumeID) (*csi.PublishVolumeInfo, error) // IsNodePublished should return a flag indicating whether or // not the volume exists and is published on the current host. IsNodePublished( ctx context.Context, id *csi.VolumeID, pubVolInfo *csi.PublishVolumeInfo, targetPath string) (bool, error) }
IdempotencyProvider is the interface that works with a server-side, gRPC interceptor to provide serial access and idempotency for CSI's volume resources.
type MutexWithTryLock ¶
type MutexWithTryLock interface { // Lock locks the mutex. Lock() // Unlock unlocks the mutex. Unlock() // TryLock attempts to obtain a lock but times out if no lock // can be obtained in the specified duration. A flag is returned // indicating whether or not the lock was obtained. TryLock(timeout time.Duration) bool }
MutexWithTryLock is a lock object that implements the semantics of a sync.Mutex in addition to a TryLock function.
func NewMutexWithTryLock ¶
func NewMutexWithTryLock() MutexWithTryLock
NewMutexWithTryLock returns a new mutex that implements TryLock.
type Version ¶
Version is a type that responds with Major, Minor, and Patch information typical of a semantic version.
func ParseVersion ¶
ParseVersion parses any string that matches \d+\.\d+\.\d+ and returns a Version.