You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
351 B

6 years ago
  1. package needle
  2. import (
  3. "strconv"
  4. )
  5. type VolumeId uint32
  6. func NewVolumeId(vid string) (VolumeId, error) {
  7. volumeId, err := strconv.ParseUint(vid, 10, 64)
  8. return VolumeId(volumeId), err
  9. }
  10. func (vid VolumeId) String() string {
  11. return strconv.FormatUint(uint64(vid), 10)
  12. }
  13. func (vid VolumeId) Next() VolumeId {
  14. return VolumeId(uint32(vid) + 1)
  15. }