filer/src/super-node.js

27 lines
627 B
JavaScript
Raw Normal View History

var Constants = require('./constants.js');
2014-03-18 16:29:20 +00:00
function SuperNode(options) {
var now = Date.now();
2014-03-18 16:29:20 +00:00
this.id = Constants.SUPER_NODE_ID;
2018-05-24 18:32:27 +00:00
this.type = Constants.NODE_TYPE_META;
this.atime = options.atime || now;
this.ctime = options.ctime || now;
this.mtime = options.mtime || now;
// root node id (randomly generated)
this.rnode = options.rnode;
}
SuperNode.create = function(options, callback) {
options.guid(function(err, rnode) {
if(err) {
callback(err);
return;
}
options.rnode = options.rnode || rnode;
callback(null, new SuperNode(options));
});
};
module.exports = SuperNode;