From 7e3a14249eca8e53189ce1bb6be39c5bccef2e2b Mon Sep 17 00:00:00 2001 From: Adrien Castex Date: Mon, 3 Jul 2017 12:32:18 +0200 Subject: [PATCH] Added the 'isLocked' method in the 'Resource' class and in the 'ContextualFileSystem' class --- lib/manager/v2/fileSystem/ContextualFileSystem.d.ts | 2 ++ lib/manager/v2/fileSystem/ContextualFileSystem.js | 3 +++ lib/manager/v2/fileSystem/Resource.d.ts | 2 ++ lib/manager/v2/fileSystem/Resource.js | 3 +++ src/manager/v2/fileSystem/ContextualFileSystem.ts | 7 +++++++ src/manager/v2/fileSystem/Resource.ts | 7 +++++++ 6 files changed, 24 insertions(+) diff --git a/lib/manager/v2/fileSystem/ContextualFileSystem.d.ts b/lib/manager/v2/fileSystem/ContextualFileSystem.d.ts index 6acb3a76..0e4cb9ef 100644 --- a/lib/manager/v2/fileSystem/ContextualFileSystem.d.ts +++ b/lib/manager/v2/fileSystem/ContextualFileSystem.d.ts @@ -62,6 +62,8 @@ export declare class ContextualFileSystem implements ISerializableFileSystem { listDeepLocks(startPath: Path | string, depth: number, callback: ReturnCallback<{ [path: string]: Lock[]; }>): any; + isLocked(path: Path | string, callback: ReturnCallback): any; + isLocked(path: Path | string, depth: number, callback: ReturnCallback): any; serializer(): FileSystemSerializer; serialize(callback: (serializedData: any) => void): void; } diff --git a/lib/manager/v2/fileSystem/ContextualFileSystem.js b/lib/manager/v2/fileSystem/ContextualFileSystem.js index 3b739626..b6e71fb9 100644 --- a/lib/manager/v2/fileSystem/ContextualFileSystem.js +++ b/lib/manager/v2/fileSystem/ContextualFileSystem.js @@ -72,6 +72,9 @@ var ContextualFileSystem = (function () { ContextualFileSystem.prototype.listDeepLocks = function (startPath, _depth, _callback) { this.fs.listDeepLocks(this.context, startPath, _depth, _callback); }; + ContextualFileSystem.prototype.isLocked = function (path, _depth, _callback) { + this.fs.isLocked(this.context, path, _depth, _callback); + }; ContextualFileSystem.prototype.serializer = function () { return this.fs.serializer(); }; diff --git a/lib/manager/v2/fileSystem/Resource.d.ts b/lib/manager/v2/fileSystem/Resource.d.ts index 9a10669f..ad771026 100644 --- a/lib/manager/v2/fileSystem/Resource.d.ts +++ b/lib/manager/v2/fileSystem/Resource.d.ts @@ -60,4 +60,6 @@ export declare class Resource { listDeepLocks(depth: number, callback: ReturnCallback<{ [path: string]: Lock[]; }>): any; + isLocked(callback: ReturnCallback): any; + isLocked(depth: number, callback: ReturnCallback): any; } diff --git a/lib/manager/v2/fileSystem/Resource.js b/lib/manager/v2/fileSystem/Resource.js index 3319393a..fd2d3413 100644 --- a/lib/manager/v2/fileSystem/Resource.js +++ b/lib/manager/v2/fileSystem/Resource.js @@ -70,6 +70,9 @@ var Resource = (function () { Resource.prototype.listDeepLocks = function (_depth, _callback) { this.fs.listDeepLocks(this.context, this.path, _depth, _callback); }; + Resource.prototype.isLocked = function (_depth, _callback) { + this.fs.isLocked(this.context, this.path, _depth, _callback); + }; return Resource; }()); exports.Resource = Resource; diff --git a/src/manager/v2/fileSystem/ContextualFileSystem.ts b/src/manager/v2/fileSystem/ContextualFileSystem.ts index baab6967..e9723018 100644 --- a/src/manager/v2/fileSystem/ContextualFileSystem.ts +++ b/src/manager/v2/fileSystem/ContextualFileSystem.ts @@ -155,6 +155,13 @@ export class ContextualFileSystem implements ISerializableFileSystem this.fs.listDeepLocks(this.context, startPath, _depth, _callback); } + isLocked(path : Path | string, callback : ReturnCallback) + isLocked(path : Path | string, depth : number, callback : ReturnCallback) + isLocked(path : Path | string, _depth : any, _callback ?: ReturnCallback) + { + this.fs.isLocked(this.context, path, _depth, _callback); + } + serializer() : FileSystemSerializer { return this.fs.serializer(); diff --git a/src/manager/v2/fileSystem/Resource.ts b/src/manager/v2/fileSystem/Resource.ts index 235ff207..17c6a52b 100644 --- a/src/manager/v2/fileSystem/Resource.ts +++ b/src/manager/v2/fileSystem/Resource.ts @@ -152,4 +152,11 @@ export class Resource { this.fs.listDeepLocks(this.context, this.path, _depth, _callback); } + + isLocked(callback : ReturnCallback) + isLocked(depth : number, callback : ReturnCallback) + isLocked(_depth : any, _callback ?: ReturnCallback) + { + this.fs.isLocked(this.context, this.path, _depth, _callback); + } }