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/operation/assign_file_id.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/operation/assign_file_id.go')
| -rw-r--r-- | go/operation/assign_file_id.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/go/operation/assign_file_id.go b/go/operation/assign_file_id.go index 018e1d763..34d371f37 100644 --- a/go/operation/assign_file_id.go +++ b/go/operation/assign_file_id.go @@ -17,7 +17,7 @@ type AssignResult struct { Error string `json:"error,omitempty"` } -func Assign(server string, count int, replication string, collection string) (*AssignResult, error) { +func Assign(server string, count int, replication string, collection string, ttl string) (*AssignResult, error) { values := make(url.Values) values.Add("count", strconv.Itoa(count)) if replication != "" { @@ -26,6 +26,9 @@ func Assign(server string, count int, replication string, collection string) (*A if collection != "" { values.Add("collection", collection) } + if ttl != "" { + values.Add("ttl", ttl) + } jsonBlob, err := util.Post("http://"+server+"/dir/assign", values) glog.V(2).Info("assign result :", string(jsonBlob)) if err != nil { |
