chore(xen-api/_wrapRecord): basic documentation

This commit is contained in:
Julien Fontanet 2022-04-20 10:46:40 +02:00
parent 6da0aa376f
commit b1429e1df3

View File

@ -1259,6 +1259,15 @@ export class Xapi extends EventEmitter {
}
}
// Wrap a plain object record into an instance of a dedicated class (e.g. VM)
//
// This dedicated class contains the following helpers:
// - `$<name>` fields: return the cached object(s) pointed by the `<name>` field
// - `add_<name>(value)` async method: add a value to a set field
// - `remove_<name>(value)` async method: remove a value from a set field
// - `set_<name>(value)` async method: assigne a value to a field
// - `update_<name>(entry, value)` async method: set an entry of a map field to a value (remove if `null`)
// - `update_<name>(entries)` async method: update entries of a map field
_wrapRecord(type, ref, data) {
const RecordsByType = this._RecordsByType
let Record = RecordsByType[type]