seaweedfs/weed/storage/needle/volume_id.go

19 lines
351 B
Go
Raw Normal View History

2019-04-19 04:43:36 +00:00
package needle
2012-08-24 06:24:32 +00:00
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
}
2019-04-20 10:39:06 +00:00
func (vid VolumeId) String() string {
return strconv.FormatUint(uint64(vid), 10)
2012-08-24 06:24:32 +00:00
}
2019-04-20 10:39:06 +00:00
func (vid VolumeId) Next() VolumeId {
return VolumeId(uint32(vid) + 1)
2012-08-29 08:37:40 +00:00
}