1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00

use positional arguments to destructure rpc params

This commit is contained in:
Falk Werner 2019-02-22 15:10:12 +01:00
parent 85ae74a57a
commit dd5a8ebd73
2 changed files with 9 additions and 27 deletions

View File

@ -17,7 +17,7 @@ module.exports = {
"array-bracket-newline": "error", "array-bracket-newline": "error",
"array-bracket-spacing": "error", "array-bracket-spacing": "error",
"array-callback-return": "error", "array-callback-return": "error",
"array-element-newline": "error", "array-element-newline": ["error", "consistent"],
"arrow-body-style": "error", "arrow-body-style": "error",
"arrow-parens": [ "arrow-parens": [
"error", "error",

View File

@ -60,7 +60,8 @@ export class Client {
} }
_invoke(method, params, id) { _invoke(method, params, id) {
this._invokeAsync(method, params).then((result) => { this._invokeAsync(method, params).
then((result) => {
const response = { result, id }; const response = { result, id };
this._ws.send(JSON.stringify(response)); this._ws.send(JSON.stringify(response));
}). }).
@ -100,46 +101,27 @@ export class Client {
} }
} }
async _lookup(params) { async _lookup([parent, name]) {
const parent = params[0];
const name = params[1];
return this._provider.lookup(parent, name); return this._provider.lookup(parent, name);
} }
async _getattr(params) { async _getattr([inode]) {
const inode = params[0];
return this._provider.getattr(inode); return this._provider.getattr(inode);
} }
async _readdir(params) { async _readdir([inode]) {
const inode = params[0];
return this._provider.readdir(inode); return this._provider.readdir(inode);
} }
async _open(params) { async _open([inode, mode]) {
const inode = params[0];
const mode = params[1];
return this._provider.open(inode, mode); return this._provider.open(inode, mode);
} }
_close(params) { _close([inode, handle, mode]) {
const inode = params[0];
const handle = params[1];
const mode = params[2];
this._provider.close(inode, handle, mode); this._provider.close(inode, handle, mode);
} }
async _read(params) { async _read([inode, handle, offset, length]) {
const inode = params[0];
const handle = params[1];
const offset = params[2];
const length = params[3];
const data = await this._provider.read(inode, handle, offset, length); const data = await this._provider.read(inode, handle, offset, length);
if ("string" === typeof(data)) { if ("string" === typeof(data)) {