Skip to content

PutPolicy添加两个参数 transform、fopTimeout #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/main/java/com/qiniu/api/rs/PutPolicy.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ public class PutPolicy {
public String persistentOps;

public long deadline;

/**
* 单位: 秒
* 文件变换操作执行的超时时间(单位:秒),这个值太小可能会导致误判(最终
* 存储成功了但客户端得到超时错),但太大可能会导致服务端将其判断为低优先
* 级任务。建议取一个相对准确的时间估计值*N(N不要超过5)
* */
public int fopTimeout;

/**
* 对文件先进行一次变换操作(比如将音频统一转为某种码率的mp3)再进行存储。
* transform的值就是一个fop指令, 比如imageView/1/w/310/h/395/q/80,
* 其含义是对上传的文件执行这个fop指令,然后把结果保存到七牛。
*/
public String transform;

public PutPolicy(String scope) {
this.scope = scope;
Expand Down Expand Up @@ -91,6 +106,12 @@ public String marshal() throws JSONException {
if (this.persistentOps != null && this.persistentOps.length() > 0) {
stringer.key("persistentOps").value(this.persistentOps);
}
if(transform != null && transform.trim().length() > 0){
stringer.key("transform").value(this.transform);
}
if(fopTimeout > 0){
stringer.key("fopTimeout").value(this.fopTimeout);
}
stringer.key("deadline").value(this.deadline);
stringer.endObject();

Expand Down