kopia lustrzana https://github.com/c9/core
Remove logging from fs, might slow down vfs too much
rodzic
3d28206252
commit
cad9d22009
|
@ -10,17 +10,16 @@
|
||||||
*/
|
*/
|
||||||
//@todo might have to add queueing for safe operations
|
//@todo might have to add queueing for safe operations
|
||||||
define(function(require, exports, module) {
|
define(function(require, exports, module) {
|
||||||
main.consumes = ["vfs", "Plugin", "auth", "vfs.log"];
|
main.consumes = ["vfs", "Plugin", "auth"];
|
||||||
main.provides = ["fs"];
|
main.provides = ["fs"];
|
||||||
return main;
|
return main;
|
||||||
|
|
||||||
function main(options, imports, register) {
|
function main(options, imports, register) {
|
||||||
var vfs = imports.vfs;
|
var vfs = imports.vfs;
|
||||||
var logger = imports["vfs.log"];
|
|
||||||
var Plugin = imports.Plugin;
|
var Plugin = imports.Plugin;
|
||||||
|
|
||||||
var stream = require("./fs.streams")(vfs, options.base, options.baseProc, options.cli, logger);
|
var stream = require("./fs.streams")(vfs, options.base, options.baseProc, options.cli);
|
||||||
var xhr = options.cli ? stream : require("./fs.xhr")(vfs.rest, logger);
|
var xhr = options.cli ? stream : require("./fs.xhr")(vfs.rest);
|
||||||
var uCaseFirst = require("c9/string").uCaseFirst;
|
var uCaseFirst = require("c9/string").uCaseFirst;
|
||||||
var normalize = require("path").normalize;
|
var normalize = require("path").normalize;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ define(function(require, exports, module) {
|
||||||
var Stream = require("stream").Stream;
|
var Stream = require("stream").Stream;
|
||||||
var PATH = require("path");
|
var PATH = require("path");
|
||||||
|
|
||||||
return function(vfs, base, baseProc, cli, logger) {
|
return function(vfs, base, baseProc, cli) {
|
||||||
|
|
||||||
var resolvePath = function(path, basePath) {
|
var resolvePath = function(path, basePath) {
|
||||||
if (path.charAt(0) == "~") {
|
if (path.charAt(0) == "~") {
|
||||||
|
@ -33,8 +33,6 @@ return function(vfs, base, baseProc, cli, logger) {
|
||||||
if (encoding)
|
if (encoding)
|
||||||
options.encoding = encoding;
|
options.encoding = encoding;
|
||||||
|
|
||||||
logger.log("[vfs.stream] Reading file " + path);
|
|
||||||
|
|
||||||
vfs.readfile(resolvePath(path), options, function(err, meta) {
|
vfs.readfile(resolvePath(path), options, function(err, meta) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
@ -72,8 +70,6 @@ return function(vfs, base, baseProc, cli, logger) {
|
||||||
var stream = options.stream = new Stream();
|
var stream = options.stream = new Stream();
|
||||||
stream.readable = true;
|
stream.readable = true;
|
||||||
|
|
||||||
logger.log("[vfs.stream] Writing file " + path);
|
|
||||||
|
|
||||||
vfs.mkfile(resolvePath(path), options, function(err, meta) {
|
vfs.mkfile(resolvePath(path), options, function(err, meta) {
|
||||||
if (err)
|
if (err)
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
define(function (require, exports, module) {
|
define(function (require, exports, module) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
return function(_request, logger) {
|
return function(_request) {
|
||||||
|
|
||||||
function request(method, path, body, callback, progress, sync, headers) {
|
function request(method, path, body, callback, progress, sync, headers) {
|
||||||
// This goes to rest() function in vfs_client.js
|
|
||||||
return _request(path, {
|
return _request(path, {
|
||||||
method: method,
|
method: method,
|
||||||
body: body,
|
body: body,
|
||||||
|
@ -32,8 +31,6 @@ return function(_request, logger) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.log("[vfs.xhr] Reading file " + path);
|
|
||||||
|
|
||||||
var headers = metadata ? { "x-request-metadata" : "true" } : null;
|
var headers = metadata ? { "x-request-metadata" : "true" } : null;
|
||||||
return request("GET", path, "", function(err, data, res) {
|
return request("GET", path, "", function(err, data, res) {
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -80,8 +77,6 @@ return function(_request, logger) {
|
||||||
// It would then be interpreted as a directory
|
// It would then be interpreted as a directory
|
||||||
if (path.substr(-1) == "/")
|
if (path.substr(-1) == "/")
|
||||||
path = path.substr(0, path.length - 1);
|
path = path.substr(0, path.length - 1);
|
||||||
|
|
||||||
logger.log("[vfs.xhr] Writing file " + path);
|
|
||||||
|
|
||||||
return request("PUT", path, data, callback, progress, sync);
|
return request("PUT", path, data, callback, progress, sync);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue