Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface {
// Create a new volume with the given name and options.
Create(name string, options map[string]string) error
// List all volumes.
// Returns a map of volume names to their metadata.
List() (map[string]*VolumeMetadata, error)
// Get retrieves the metadata for a volume by name.
Get(name string) (*VolumeMetadata, error)
// Remove deletes a volume by name.
Remove(name string) error
// Path returns the mount point for a volume by name.
Path(name string) (string, error)
// Mount mounts a volume by name and ID.
Mount(name string, id string) (string, error)
// Unmount unmounts a volume by name and ID.
Unmount(name string, id string) error
// Destroy cleans up any resources used by the driver.
Destroy() error
}
Driver interface
type VolumeMetadata ¶
type VolumeMetadata struct {
// CreatedAt is the timestamp when the volume was created
CreatedAt time.Time `json:"createAt" validate:"required"`
// Spec contains the volume specification, including options and settings
Spec *VolumeSpec `json:"spec" validate:"required"`
// Status contains the current status of the volume, which can be used to store runtime information or state
Status *VolumeStatus `json:"status" validate:"required"`
}
func (*VolumeMetadata) Marshal ¶
func (vm *VolumeMetadata) Marshal() (data []byte, err error)
Marshal validates the VolumeMetadata struct and marshals it into JSON format.
func (*VolumeMetadata) ToVolume ¶
func (vm *VolumeMetadata) ToVolume(name string, mountpointBase string) *volume.Volume
ToVolume converts the VolumeMetadata struct to a volume.Volume struct, using the provided name and mountpointBase.
func (*VolumeMetadata) Unmarshal ¶
func (vm *VolumeMetadata) Unmarshal(data []byte) (err error)
Unmarshal the JSON data into the VolumeMetadata struct and validates it.
type VolumeSpec ¶
type VolumeSpec struct {
PurgeAfterDelete bool `json:"purgeAfterDelete,omitempty"`
}
type VolumeStatus ¶
type VolumeStatus struct {
// Mountpoint is the relative path to the volume's mount point
Mountpoint string `json:"mountpoint" validate:"required"`
}