diff options
| author | Chris Lu <chris.lu@gmail.com> | 2014-09-20 12:38:59 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2014-09-20 12:38:59 -0700 |
| commit | b9aee2defbc2f5aafbc3ea049fbe2ab5f3320999 (patch) | |
| tree | 719442dc72cc30958e54e4f7e59076796b6775e9 /go/topology/data_node.go | |
| parent | a092794804b2f7cbd656e439305d29bfa96ad2b9 (diff) | |
| download | seaweedfs-b9aee2defbc2f5aafbc3ea049fbe2ab5f3320999.tar.xz seaweedfs-b9aee2defbc2f5aafbc3ea049fbe2ab5f3320999.zip | |
add TTL support
The volume TTL and file TTL are not necessarily the same. as long as
file TTL is smaller than volume TTL, it'll be fine.
volume TTL is used when assigning file id, e.g.
http://.../dir/assign?ttl=3h
file TTL is used when uploading
Diffstat (limited to 'go/topology/data_node.go')
| -rw-r--r-- | go/topology/data_node.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/go/topology/data_node.go b/go/topology/data_node.go index ae80e08bb..c67c5c1c1 100644 --- a/go/topology/data_node.go +++ b/go/topology/data_node.go @@ -38,15 +38,16 @@ func (dn *DataNode) AddOrUpdateVolume(v storage.VolumeInfo) { } } -func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) { +func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (deletedVolumes []storage.VolumeInfo) { actualVolumeMap := make(map[storage.VolumeId]storage.VolumeInfo) for _, v := range actualVolumes { actualVolumeMap[v.Id] = v } - for vid, _ := range dn.volumes { + for vid, v := range dn.volumes { if _, ok := actualVolumeMap[vid]; !ok { glog.V(0).Infoln("Deleting volume id:", vid) delete(dn.volumes, vid) + deletedVolumes = append(deletedVolumes, v) dn.UpAdjustVolumeCountDelta(-1) dn.UpAdjustActiveVolumeCountDelta(-1) } @@ -54,6 +55,7 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) { for _, v := range actualVolumes { dn.AddOrUpdateVolume(v) } + return } func (dn *DataNode) GetDataCenter() *DataCenter { |
