Documentation
¶
Index ¶
- Variables
- func ContextGetDeleteResult(ctx context.Context) *storage.DeleteResult
- func ContextGetDeleteStorageSpaceResult(ctx context.Context) *storage.DeleteStorageSpaceResult
- func ContextGetMoveResult(ctx context.Context) *storage.MoveResult
- func ContextGetSpaceOwner(ctx context.Context) *userpb.UserId
- func ContextRegisterDeleteResultSlot(ctx context.Context) context.Context
- func ContextRegisterDeleteStorageSpaceResultSlot(ctx context.Context) context.Context
- func ContextRegisterMoveResultSlot(ctx context.Context) context.Context
- func ContextRegisterSpaceOwnerSlot(ctx context.Context) context.Context
- func ContextSetDeleteResult(ctx context.Context, r *storage.DeleteResult)
- func ContextSetDeleteStorageSpaceResult(ctx context.Context, r *storage.DeleteStorageSpaceResult)
- func ContextSetMoveResult(ctx context.Context, r *storage.MoveResult)
- func ContextSetSpaceOwner(ctx context.Context, id *userpb.UserId)
- 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 ContextGetDeleteResult ¶ added in v2.52.3
func ContextGetDeleteResult(ctx context.Context) *storage.DeleteResult
ContextGetDeleteResult returns the delete result written by the storage driver, or nil if none was set.
func ContextGetDeleteStorageSpaceResult ¶ added in v2.52.3
func ContextGetDeleteStorageSpaceResult(ctx context.Context) *storage.DeleteStorageSpaceResult
ContextGetDeleteStorageSpaceResult returns the delete-space result written by the storage driver, or nil if none was set.
func ContextGetMoveResult ¶ added in v2.52.3
func ContextGetMoveResult(ctx context.Context) *storage.MoveResult
ContextGetMoveResult returns the move result written by the storage driver, or nil if none was set.
func ContextGetSpaceOwner ¶ added in v2.52.3
ContextGetSpaceOwner returns the space owner written by the storage driver, or nil if none was set.
func ContextRegisterDeleteResultSlot ¶ added in v2.52.3
ContextRegisterDeleteResultSlot installs an empty slot in ctx so that the storage driver can write delete metadata via ContextSetDeleteResult and the events middleware can read it via ContextGetDeleteResult after the handler returns. Subsequent registrations are no-ops; the first registration wins.
func ContextRegisterDeleteStorageSpaceResultSlot ¶ added in v2.52.3
ContextRegisterDeleteStorageSpaceResultSlot installs an empty slot in ctx so that the storage driver can write delete-space metadata via ContextSetDeleteStorageSpaceResult and the events middleware can read it via ContextGetDeleteStorageSpaceResult after the handler returns. Subsequent registrations are no-ops; the first registration wins.
func ContextRegisterMoveResultSlot ¶ added in v2.52.0
ContextRegisterMoveResultSlot installs an empty slot in ctx so that the storage driver can write move metadata via ContextSetMoveResult and the events middleware can read it via ContextGetMoveResult after the handler returns. Subsequent registrations are no-ops; the first registration wins.
func ContextRegisterSpaceOwnerSlot ¶ added in v2.52.3
ContextRegisterSpaceOwnerSlot installs an empty slot in ctx so that the storage driver can write the space owner via ContextSetSpaceOwner and the events middleware can read it via ContextGetSpaceOwner after the handler returns. Subsequent registrations are no-ops; the first registration wins.
func ContextSetDeleteResult ¶ added in v2.52.3
func ContextSetDeleteResult(ctx context.Context, r *storage.DeleteResult)
ContextSetDeleteResult writes r into the slot. Subsequent writes overwrite the previous value. Does nothing if no slot was registered.
func ContextSetDeleteStorageSpaceResult ¶ added in v2.52.3
func ContextSetDeleteStorageSpaceResult(ctx context.Context, r *storage.DeleteStorageSpaceResult)
ContextSetDeleteStorageSpaceResult writes r into the slot. Subsequent writes overwrite the previous value. Does nothing if no slot was registered.
func ContextSetMoveResult ¶ added in v2.52.0
func ContextSetMoveResult(ctx context.Context, r *storage.MoveResult)
ContextSetMoveResult writes r into the slot. Subsequent writes overwrite the previous value. Does nothing if no slot was registered.
func ContextSetSpaceOwner ¶ added in v2.52.3
ContextSetSpaceOwner writes id into the slot. Subsequent writes overwrite the previous value. Does nothing if no slot was registered.
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 ¶
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.