mute-structs
Version:
NodeJS module providing an implementation of the LogootSplit CRDT algorithm
57 lines (53 loc) • 2.41 kB
JavaScript
/*
This file is part of MUTE-structs.
Copyright (C) 2017 Matthieu Nicolas, Victorien Elvinger
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
import { isObject } from "../../data-validation";
import { Epoch } from "../../epoch/epoch";
import { RenamableLogootSOperation } from "../renamablelogootsoperation";
import { LogootSDel } from "./logootsdel";
var RenamableLogootSDel = /** @class */ (function (_super) {
__extends(RenamableLogootSDel, _super);
function RenamableLogootSDel(op, epoch) {
return _super.call(this, op, epoch) || this;
}
RenamableLogootSDel.fromPlain = function (o) {
if (isObject(o)) {
var op = LogootSDel.fromPlain(o.op);
var epoch = Epoch.fromPlain(o.epoch);
if (op !== null && epoch !== null) {
return new RenamableLogootSDel(op, epoch);
}
}
return null;
};
RenamableLogootSDel.prototype.execute = function (renamableList) {
return renamableList.delRemote(this.epoch, this.op);
};
return RenamableLogootSDel;
}(RenamableLogootSOperation));
export { RenamableLogootSDel };
//# sourceMappingURL=renamablelogootsdel.js.map