filer/src/node.js

22 lines
910 B
JavaScript
Raw Normal View History

2014-03-18 16:29:20 +00:00
define(['src/constants', 'src/shared'], function(Constants, Shared) {
return function Node(id, mode, size, atime, ctime, mtime, flags, xattrs, nlinks, version) {
var now = Date.now();
this.id = id || Shared.guid();
this.mode = mode || Constants.MODE_FILE; // node type (file, directory, etc)
this.size = size || 0; // size (bytes for files, entries for directories)
this.atime = atime || now; // access time (will mirror ctime after creation)
this.ctime = ctime || now; // creation/change time
this.mtime = mtime || now; // modified time
this.flags = flags || []; // file flags
this.xattrs = xattrs || {}; // extended attributes
this.nlinks = nlinks || 0; // links count
this.version = version || 0; // node version
this.blksize = undefined; // block size
this.nblocks = 1; // blocks count
this.data = Shared.guid(); // id for data object
};
});