MCPcopy Create free account
hub / github.com/TritonDataCenter/node-manta / run

Function run

lib/client.js:1035–1080  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1033 }
1034
1035 function run() {
1036 var barrier = vasync.barrier();
1037 var q = new Queue({
1038 limit: opts.parallel || 50,
1039 worker: function (_opts, _cb) {
1040 self.ls(_opts.path, options, function (err, ls_res) {
1041 if (err) {
1042 err.path = _opts.path;
1043 _cb(err);
1044 return;
1045 }
1046
1047 ls_res.on('entry', function onEntry(obj) {
1048 obj.depth = _opts.depth;
1049 if (obj.type === 'directory' &&
1050 (obj.depth + 1) < maxdepth) {
1051 var name = obj.parent + '/' + obj.name;
1052 barrier.start(name);
1053 q.push({
1054 depth: obj.depth + 1,
1055 path: name
1056 });
1057 }
1058 filter(obj);
1059 });
1060
1061 ls_res.once('end', function () {
1062 barrier.done(_opts.path);
1063 _cb();
1064 });
1065
1066 ls_res.on('error', _cb);
1067 });
1068 }
1069 });
1070
1071 q.once('error', res.emit.bind(res, 'error'));
1072 q.once('end', res.emit.bind(res, 'end'));
1073 barrier.once('drain', q.close.bind(q));
1074
1075 barrier.start(_path);
1076 q.push({
1077 depth: 0,
1078 path: _path
1079 });
1080 }
1081
1082 // First ensure we're looking at a directory
1083 this.info(p, options, function (info_err, meta) {

Callers 1

client.jsFile · 0.85

Calls 2

filterFunction · 0.85
cbFunction · 0.85

Tested by

no test coverage detected