Fix mount flags per review and also write docs

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-05 20:03:27 -05:00
parent f580f40016
commit 5438d8c97b
3 changed files with 13 additions and 9 deletions

View File

@ -80,7 +80,10 @@ Accepts two arguments: an `options` object, and an optional `callback`. The `opt
object can specify a number of optional arguments, including: object can specify a number of optional arguments, including:
* `name`: the name of the file system, defaults to `'"local'` * `name`: the name of the file system, defaults to `'"local'`
* `flags`: one or more flags to use when creating/opening the file system. Use `'FORMAT'` to force Filer to format (i.e., erase) the file system * `flags`: an Array of one or more flags to use when creating/opening the file system:
*`'FORMAT'` to force Filer to format (i.e., erase) the file system
*`'NOCTIME'` to force Filer to not update `ctime` on nodes when metadata changes (i.e., for better performance)
*`'NOMTIME'` to force Filer to not update `mtime` on nodes when data changes (i.e., for better performance)
* `provider`: an explicit storage provider to use for the file system's database context provider. See the section on [Storage Providers](#providers). * `provider`: an explicit storage provider to use for the file system's database context provider. See the section on [Storage Providers](#providers).
The `callback` function indicates when the file system is ready for use. Depending on the storage provider used, this might The `callback` function indicates when the file system is ready for use. Depending on the storage provider used, this might
@ -98,7 +101,7 @@ function fsReady(err, fs) {
fs = new Filer.FileSystem({ fs = new Filer.FileSystem({
name: "my-filesystem", name: "my-filesystem",
flags: 'FORMAT', flags: [ 'FORMAT' ],
provider: new Filer.FileSystem.providers.Memory() provider: new Filer.FileSystem.providers.Memory()
}, fsReady); }, fsReady);
``` ```

View File

@ -33,8 +33,12 @@ define(function(require) {
ROOT_DIRECTORY_NAME: '/', // basename(normalize(path)) ROOT_DIRECTORY_NAME: '/', // basename(normalize(path))
// FS Mount Flags
FS_FORMAT: 'FORMAT', FS_FORMAT: 'FORMAT',
FS_NOCTIME: 'NOCTIME',
FS_NOMTIME: 'NOMTIME',
// FS File Open Flags
O_READ: O_READ, O_READ: O_READ,
O_WRITE: O_WRITE, O_WRITE: O_WRITE,
O_CREATE: O_CREATE, O_CREATE: O_CREATE,
@ -58,9 +62,6 @@ define(function(require) {
XATTR_CREATE: XATTR_CREATE, XATTR_CREATE: XATTR_CREATE,
XATTR_REPLACE: XATTR_REPLACE, XATTR_REPLACE: XATTR_REPLACE,
NOCTIME: 'NOCTIME',
NOMTIME: 'NOMTIME',
FS_READY: 'READY', FS_READY: 'READY',
FS_PENDING: 'PENDING', FS_PENDING: 'PENDING',
FS_ERROR: 'ERROR', FS_ERROR: 'ERROR',

View File

@ -52,8 +52,8 @@ define(function(require) {
var O_FLAGS = require('src/constants').O_FLAGS; var O_FLAGS = require('src/constants').O_FLAGS;
var XATTR_CREATE = require('src/constants').XATTR_CREATE; var XATTR_CREATE = require('src/constants').XATTR_CREATE;
var XATTR_REPLACE = require('src/constants').XATTR_REPLACE; var XATTR_REPLACE = require('src/constants').XATTR_REPLACE;
var NOMTIME = require('src/constants').NOMTIME; var FS_NOMTIME = require('src/constants').FS_NOMTIME;
var NOCTIME = require('src/constants').NOCTIME; var FS_NOCTIME = require('src/constants').FS_NOCTIME;
var providers = require('src/providers/providers'); var providers = require('src/providers/providers');
var adapters = require('src/adapters/adapters'); var adapters = require('src/adapters/adapters');
@ -138,10 +138,10 @@ define(function(require) {
function update_node_times(context, path, node, times, callback) { function update_node_times(context, path, node, times, callback) {
// Honour mount flags for how we update times // Honour mount flags for how we update times
var flags = context.flags; var flags = context.flags;
if(_(flags).contains(NOCTIME)) { if(_(flags).contains(FS_NOCTIME)) {
delete times.ctime; delete times.ctime;
} }
if(_(flags).contains(NOMTIME)) { if(_(flags).contains(FS_NOMTIME)) {
delete times.mtime; delete times.mtime;
} }