Compare commits

...

2 Commits

Author SHA1 Message Date
Alexandre Merle c0c56e47bd DROPME: deps [ci skip] 2017-03-15 04:48:02 +01:00
Alexandre Merle 5060102e0f wip [ci skip] 2017-03-15 04:48:02 +01:00
3 changed files with 6 additions and 37 deletions

View File

@ -213,7 +213,7 @@ export default function listMultipartUploads(authInfo,
maxKeys: maxUploads, maxKeys: maxUploads,
prefix: `overview${splitter}${prefix}`, prefix: `overview${splitter}${prefix}`,
queryPrefixLength: prefix.length, queryPrefixLength: prefix.length,
listingType: 'multipartuploads', listingType: 'MPU',
splitter, splitter,
}; };
services.getMultipartUploadListing(mpuBucketName, listingParams, services.getMultipartUploadListing(mpuBucketName, listingParams,

View File

@ -451,48 +451,17 @@ class BucketFileInterface {
* @return {undefined} * @return {undefined}
*/ */
internalListObject(bucketName, params, log, cb) { internalListObject(bucketName, params, log, cb) {
const requestParams = {}; const Ext = arsenal.algorithms.list[params.listingType || 'Delimiter'];
let Ext; const extension = new Ext(params, log);
const extParams = {};
// multipart upload listing
if (params.listingType === 'multipartuploads') {
Ext = arsenal.algorithms.list.MPU;
this.addExtensionParam('queryPrefixLength', params, extParams);
this.addExtensionParam('splitter', params, extParams);
if (params.keyMarker) {
requestParams.gt = `overview${params.splitter}` +
`${params.keyMarker}${params.splitter}`;
if (params.uploadIdMarker) {
requestParams.gt += `${params.uploadIdMarker}`;
}
// advance so that lower bound does not include the supplied
// markers
requestParams.gt = this._setCharAt(requestParams.gt);
}
} else {
Ext = arsenal.algorithms.list.Delimiter;
if (params.marker) {
requestParams.gt = params.marker;
this.addExtensionParam('gt', requestParams, extParams);
}
}
this.addExtensionParam('delimiter', params, extParams);
this.addExtensionParam('maxKeys', params, extParams);
if (params.prefix) {
requestParams.start = params.prefix;
requestParams.lt = this._setCharAt(params.prefix);
this.addExtensionParam('start', requestParams, extParams);
}
const extension = new Ext(extParams, log);
this.loadDBIfExists(bucketName, log, (err, db) => { this.loadDBIfExists(bucketName, log, (err, db) => {
if (err) { if (err) {
return cb(err); return cb(err);
} }
let cbDone = false; let cbDone = false;
const stream = db.createReadStream(requestParams); const stream = db.createReadStream(extension.getListingParams());
stream stream
.on('data', e => { .on('data', e => {
if (extension.filter(e) === false) { if (extension.filter(e) === 0) {
stream.emit('end'); stream.emit('end');
stream.destroy(); stream.destroy();
} }

View File

@ -19,7 +19,7 @@
}, },
"homepage": "https://github.com/scality/S3#readme", "homepage": "https://github.com/scality/S3#readme",
"dependencies": { "dependencies": {
"arsenal": "scality/Arsenal", "arsenal": "scality/Arsenal#rf/listing-params",
"async": "~1.4.2", "async": "~1.4.2",
"babel-core": "^6.5.2", "babel-core": "^6.5.2",
"babel-plugin-transform-es2015-destructuring": "^6.5.2", "babel-plugin-transform-es2015-destructuring": "^6.5.2",