seaweedfs/weed/storage/needle/volume_id.go

19 lines
351 B
Go
Raw Normal View History

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