seaweedfs/go/storage/volume_id.go

19 lines
356 B
Go
Raw Normal View History

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