diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-02-10 03:09:26 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-02-10 03:09:26 -0800 |
| commit | cb4e8ec16b5c204718f1efdc1731f1bdd5698ff3 (patch) | |
| tree | 47f27040c3d80e6849932bf2acf54b68c930f72b /src/weed/storage/volume_id.go | |
| parent | d3b267bac27018b7f70dfec7c258d0556fff4c14 (diff) | |
| download | seaweedfs-cb4e8ec16b5c204718f1efdc1731f1bdd5698ff3.tar.xz seaweedfs-cb4e8ec16b5c204718f1efdc1731f1bdd5698ff3.zip | |
re-organize code directory structure
Diffstat (limited to 'src/weed/storage/volume_id.go')
| -rw-r--r-- | src/weed/storage/volume_id.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/weed/storage/volume_id.go b/src/weed/storage/volume_id.go new file mode 100644 index 000000000..0333c6cf0 --- /dev/null +++ b/src/weed/storage/volume_id.go @@ -0,0 +1,18 @@ +package storage + +import ( + "strconv" +) + +type VolumeId uint32 + +func NewVolumeId(vid string) (VolumeId, error) { + volumeId, err := strconv.ParseUint(vid, 10, 64) + return VolumeId(volumeId), err +} +func (vid *VolumeId) String() string { + return strconv.FormatUint(uint64(*vid), 10) +} +func (vid *VolumeId) Next() VolumeId { + return VolumeId(uint32(*vid) + 1) +} |
