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
356 B

  1. package storage
  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. }