From fe1da4ea1271d78afdb16a4cf78fc2db9f667952 Mon Sep 17 00:00:00 2001 From: Julien Fontanet Date: Thu, 28 Mar 2019 16:17:53 +0100 Subject: [PATCH] =?UTF-8?q?chore(xen-api):=20=5FaddObject=20=E2=86=92=20?= =?UTF-8?q?=5FaddRecordToCache,=20=5FremoveObject=20=E2=86=92=20=5FremoveR?= =?UTF-8?q?ecordFromCache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/xen-api/src/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/xen-api/src/index.js b/packages/xen-api/src/index.js index 8dc41da47..57c650a15 100644 --- a/packages/xen-api/src/index.js +++ b/packages/xen-api/src/index.js @@ -755,7 +755,7 @@ export class Xapi extends EventEmitter { } } - _addObject(type, ref, object) { + _addRecordToCache(type, ref, object) { object = this._wrapRecord(type, ref, object) // Finally freezes the object. @@ -811,14 +811,14 @@ export class Xapi extends EventEmitter { } const { ref } = event if (event.operation === 'del') { - this._removeObject(type, ref) + this._removeRecordFromCache(type, ref) } else { - this._addObject(type, ref, event.snapshot) + this._addRecordToCache(type, ref, event.snapshot) } }) } - _removeObject(type, ref) { + _removeRecordFromCache(type, ref) { const byRefs = this._objectsByRef const object = byRefs[ref] if (object !== undefined) { @@ -888,7 +888,7 @@ export class Xapi extends EventEmitter { (record, ref) => { // we can bypass _processEvents here because they are all *add* // event and all objects are of the same type - this._addObject(type, ref, record) + this._addRecordToCache(type, ref, record) } ) } catch (error) { @@ -948,10 +948,10 @@ export class Xapi extends EventEmitter { }) forOwn(tasks, (task, ref) => { toRemove.delete(ref) - this._addObject('task', ref, task) + this._addRecordToCache('task', ref, task) }) toRemove.forEach(ref => { - this._removeObject('task', ref) + this._removeRecordFromCache('task', ref) }) }) ) @@ -972,7 +972,7 @@ export class Xapi extends EventEmitter { this._sessionCall(`${type}.get_all_records`).then( objects => { forEach(objects, (object, ref) => { - this._addObject(type, ref, object) + this._addRecordToCache(type, ref, object) }) }, error => {