2012-08-24 06:24:32 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import (
|
2013-01-17 08:56:56 +00:00
|
|
|
"strconv"
|
2012-08-24 06:24:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type VolumeId uint32
|
2013-01-17 08:56:56 +00:00
|
|
|
|
|
|
|
func NewVolumeId(vid string) (VolumeId, error) {
|
|
|
|
volumeId, err := strconv.ParseUint(vid, 10, 64)
|
|
|
|
return VolumeId(volumeId), err
|
2012-08-24 06:24:32 +00:00
|
|
|
}
|
2013-01-17 08:56:56 +00:00
|
|
|
func (vid *VolumeId) String() string {
|
|
|
|
return strconv.FormatUint(uint64(*vid), 10)
|
2012-08-24 06:24:32 +00:00
|
|
|
}
|
2013-01-17 08:56:56 +00:00
|
|
|
func (vid *VolumeId) Next() VolumeId {
|
|
|
|
return VolumeId(uint32(*vid) + 1)
|
2012-08-29 08:37:40 +00:00
|
|
|
}
|