I have created a Rackspace account earlier today for CDN to serve my Opencart images from Rackspace.
I have created a container where i will upload over 500,000 images, but prefer to upload them as a compressed file, feels more flexible.
If i upload all the images in a compressed file how do i extract the file when it is in the container? and what compression type files would work?
答案 0 :(得分:0)
答案可能取决于您尝试上传文件/文件的方式。由于未指定,我将使用* nix环境中的CLI回答您的问题。
使用curl,您可以上传压缩文件并使用extract-archive功能提取它。
mRegistrationBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(context);
boolean sentToken = sharedPreferences
.getBoolean(PNConfiguration.SENT_TOKEN_TO_SERVER, false);
if (sentToken) {
Log.d("Info sent","");
} else {
Log.d("error sending token","");
}
}
};
Log.d("value of play services",checkPlayServices()+"");
if (checkPlayServices()) {
// Start IntentService to register this application with GCM.
Log.d("ABC","Starting service");
Intent intent = new Intent(this, RegistrationIntentService.class);
intent.setPackage("com.livongo.lvmobility.GCMPushNotifications.RegistrationIntentService");
startService(intent);
}
您可以在此处找到此功能的文档:http://docs.rackspace.com/files/api/v1/cf-devguide/content/Extract_Archive-d1e2338.html
使用上述方法上传和提取许多对象可能需要很长时间才能完成。此外,如果在此期间出现网络中断,则必须从头开始重新开始。
我建议使用像Swiftly这样的工具,它可以让你同时上传你的文件。这样,如果在上传过程中出现问题,您就不必重新上传已成功上传的对象。
如何执行此操作的示例如下:
$ tar cf archive.tar directory_to_be_archived
$ curl -i -XPUT -H'x-auth-token: AUTH_TOKEN' https://storage101.iad3.clouddrive.com/v1/MossoCloudFS_aaa-aaa-aaa-aaa?extract-archive=tar -T ./archive.tar
如果上传时网络中断,或者您必须停止/重新启动上传文件,则可以添加" - 不同的" ' put'之后的选项在上面的命令中。这将首先告诉Swiftly HEAD对象,只有当本地文件的时间或大小与其对应的对象不匹配时才会上传,跳过已经上传的对象。
可以在github上快速找到:https://github.com/gholt/swiftly
还有其他客户可能做同样的事情,但我知道Swiftly有效,所以我推荐它。