Documentation ¶
Index ¶
- Variables
- func FormatReference(ref *provider.Reference) (string, error)
- func FormatResourceID(sid provider.ResourceId) string
- func FormatStorageID(storageID, spaceID string) string
- func ParseID(ssid string) (provider.ResourceId, error)
- func ParseReference(sRef string) (provider.Reference, error)
- func SplitID(ssid string) (storageid, spaceid, nodeid string, err error)
- func SplitStorageID(sid string) (storageID, spaceID string)
- func UpdateLegacyResourceID(id provider.ResourceId) provider.ResourceId
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidSpaceReference signals that the space reference is invalid. ErrInvalidSpaceReference = errors.New("invalid storage space reference") // ErrInvalidSpaceID signals that the space ID is invalid. ErrInvalidSpaceID = errors.New("invalid storage space id") )
Functions ¶
func FormatReference ¶
FormatReference will format a storage space reference into a string representation. If ref or ref.ResourceId are nil an error will be returned. The function doesn't check if all values are set. The resulting format can be:
"storage_id!opaque_id" "storage_id!opaque_id/path" "storage_id/path" "storage_id"
func FormatResourceID ¶
func FormatResourceID(sid provider.ResourceId) string
FormatResourceID converts a ResourceId into the string format. The result format will look like: <storageid>$<spaceid>!<opaqueid>
func FormatStorageID ¶
FormatStorageID converts the provider ID and space ID into the string format. The result format will look like: <storageid>$<spaceid> or <spaceid> in case the provider ID is empty.
func ParseID ¶
func ParseID(ssid string) (provider.ResourceId, error)
ParseID parses a storage space ID and returns a storageprovider ResourceId. The accepted formats are: <providerid>$<spaceid>!<nodeid> -> <providerid>$<spaceid>, <nodeid> <providerid>$<spaceid> -> <providerid>$<spaceid>, <spaceid> <spaceid> -> <spaceid>, <spaceid>
func ParseReference ¶
ParseReference parses a string into a spaces reference. The expected format is `<providerid>$<spaceid>!<nodeid>/<path>`.
func SplitID ¶
SplitID splits a storage space ID into a provider ID and a node ID. The accepted formats results of the storage space ID and respective results are: <storageid>$<spaceid>!<nodeid> -> <storageid>, <spaceid>, <nodeid> <storageid>$<spaceid> -> <storageid>, <spaceid>, "" <spaceid> -> "", <spaceid>, ""
func SplitStorageID ¶
SplitStorageID splits a storage ID into the storage ID and the spaceID. The accepted formats are: <storageid>$<spaceid> -> <storageid>, <spaceid> <spaceid> -> "", <spaceid>
func UpdateLegacyResourceID ¶ added in v2.7.0
func UpdateLegacyResourceID(id provider.ResourceId) provider.ResourceId
UpdateLegacyResourceID checks if the given resource id contains a correct triple and will convert legacy ids without a spaceid by splitting the storageid.
Types ¶
This section is empty.