Add extra_dir options for S3/Swift ObjectStore.

This commit is contained in:
Charles
2015-06-15 09:17:59 +00:00
parent b47500618a
commit 521b287b13
2 changed files with 16 additions and 4 deletions
+8 -4
View File
@@ -23,9 +23,11 @@
<!-- Sample S3 Object Store
<object_store type="s3">
<auth access_key="...." secret_key="....." />
<bucket name="unique_bucket_name_all_lowercase" use_reduced_redundancy="False" />
<cache path="database/files/" size="1000" />
<auth access_key="...." secret_key="....." />
<bucket name="unique_bucket_name_all_lowercase" use_reduced_redundancy="False" />
<cache path="database/object_store_cache" size="1000" />
<extra_dir type="job_work" path="database/job_working_directory_s3"/>
<extra_dir type="temp" path="database/tmp_s3"/>
</object_store>
-->
@@ -34,7 +36,9 @@
<auth access_key="...." secret_key="....." />
<bucket name="unique_bucket_name" use_reduced_redundancy="False" max_chunk_size="250"/>
<connection host="" port="" is_secure="" conn_path="" multipart="True"/>
<cache path="database/files/" size="1000" />
<cache path="database/object_store_cache" size="1000" />
<extra_dir type="job_work" path="database/job_working_directory_swift"/>
<extra_dir type="temp" path="database/tmp_swift"/>
</object_store>
-->
+8
View File
@@ -92,6 +92,14 @@ class S3ObjectStore(ObjectStore):
self.conn_path = cn_xml.get('conn_path', '/')
c_xml = config_xml.findall('cache')[0]
self.cache_size = float(c_xml.get('size', -1))
self.staging_path = c_xml.get('path', self.config.object_store_cache_path)
for d_xml in config_xml.findall('extra_dir'):
self.extra_dirs[d_xml.get('type')] = d_xml.get('path')
log.debug("Object cache dir: %s", self.staging_path)
log.debug(" job work dir: %s", self.extra_dirs['job_work'])
# for multipart upload
self.s3server = {'access_key': self.access_key,
'secret_key': self.secret_key,