-
Notifications
You must be signed in to change notification settings - Fork 69
Release 0.7.0 #53
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
base: master
Are you sure you want to change the base?
Release 0.7.0 #53
Conversation
Add interface : get_object_meta .
1 similar comment
# * :if_match_etag (String) 指定如果object的etag等于这个值,则获取 | ||
# * :if_unmatch_etag (String) 指定如果object的etag不等于这个值,则获取 | ||
# @return [Aliyun::OSS::Object] 返回Object对象信息 | ||
# * :size [Numeric] Object的size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这部分如果想更细的描述object信息,最好把object全部信息都描述上,只写一部分有点奇怪
lib/aliyun/version.rb
Outdated
module Aliyun | ||
|
||
VERSION = "0.6.0" | ||
VERSION = "0.7.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
版本先不要改,发布的时再改把,要不容易搞错
lib/aliyun/oss/bucket.rb
Outdated
# * :etag [String] Object的ETag | ||
# * :last_modified [Time] Object的最后修改时间 | ||
# * :headers [Hash] 以x-oss-meta-开头的Object属性值 | ||
def get_object_meta(key, opts = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
接口名字换一下把,server端有个API叫get_object_meta,而sdk这个接口使用的是head object,所以尽量不要重名引起误解。
签一下cla,代码review的问题直接提到文件变更中了。 |
别忘了签一下cla |
…bject & update/get metas function.
…st_get_object_detailed_meta.
3 similar comments
'x-oss-meta-year' => '2016', | ||
'x-oss-meta-people' => 'mary', | ||
'Cache-Control' => '123456', | ||
'Content_Type' => 'text/html', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'Content_Type' => 'text/html'
->'Content-Type' => 'text/html'
Add interface : get_object_detailed_meta. Update copy_object function . Fix update_object_metas function. |
|
||
|
||
spec.add_dependency 'nokogiri', '~> 1.6', "< 1.7.0" | ||
spec.add_dependency 'nokogiri', '~> 1.6' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改这个版本限制的原因是啥?
需要nokogiri版本大于1.7.0吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nokogiri版本已经达到1.8了,很多用户提意见要取消sdk对nokogiri的限制,针对1.7.2和1.8.1版本测试没有发现问题。 具体Issue请参考: #52
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
加上 "< 1.7.0" 的愿意是为了支持 ruby 1.9.x。 但是 ruby 1.9 的支持在 #46 已经被移除调了。README 也已经提醒 Ruby 1.9 的用户用 0.5.0。 所以移除限制应该没有问题。
# @return [Hash] 更新后文件的信息 | ||
# * :etag [String] 更新后文件的ETag | ||
# * :last_modified [Time] 更新后文件的最后修改时间 | ||
def update_object_metas(key, metas, conditions = {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是对外接口,非功能性需求不要改参数,否则会导致版本无法向下兼容
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改update_object_metas 是因为 我调试发现这个函数 有BUG, 无法真正修改HTTP Header标准属性,只能修改; 但是对输入参数并没有影响。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def update_object_metas(key, metas, conditions = {}) 函数表面上写了2个参数, 用户调用的时候, 可以这样调用: @bucket.update_object_metas(key, metas: metas_dict, headers: headers_dict) 或者 @bucket.update_object_metas(key, metas: metas_dict, headers: headers_dict, condition: condition_dict) , 这样一来, 函数功能其实都是兼容的, 但是函数注释 和 函数 参数 说的不一致。。。 如果函数加上一个 header是的参数,那么 函数的兼容性 怎么处理最好?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果需要新增参数,尽量在后面新增,不要改之前的参数,否则会导致用户升级后无法兼容。
可以看一下,下面修改的测试部分,就知道是否对输入参数有影响了:
修改前:key, {'people' => 'mary', 'year' => '2016'}
修改后:key, :metas => {'people' => 'mary', 'year' => '2016'} , :headers => headers_dict
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的。 原来的update_object_metas函数无法修改http headers 标准属性, update_object_metas(key, metas, conditions = {}, headers={}) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
恢复了update_object_metas函数, 保持update_object_metas不变; 修改了copy_object函数, 利用copy_object函数来修改headers属性。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我准备把这个函数 改成下面这样, 这样就能做到 既兼容旧版本,又具有新功能,
并且格式也算美观。这样是否符合review的具体要求? 如果符合, 我准备加UT代码并且提交。
def update_object_metas(key, metas, conditions = {})
args = { :meta_directive => MetaDirective::REPLACE, :condition => conditions }
if metas[:metas].is_a?(Hash) || metas[:headers].is_a?(Hash)
args[:metas] = metas[:metas] if metas[:metas]
args[:headers] = metas[:headers] if metas[:headers]
else
args[:metas] = metas
end
@protocol.copy_object(name, key, key, args)
end
1 similar comment
lib/aliyun/oss/bucket.rb
Outdated
# 更新Object的metas | ||
# @param key [String] Object的名字 | ||
# @param metas [Hash] Object的meta | ||
# @param headers [Hash] Object的HTTP标准属性 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里追加了一个参数说明,为啥接口处没有添加?
…e. add test code for copy_object.
Uh oh!
There was an error while loading. Please reload this page.