hazelcast-client
Version:
Hazelcast - open source In-Memory Data Grid - client for NodeJS
53 lines • 2.95 kB
JavaScript
;
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var PartitionSpecificProxy_1 = require("./PartitionSpecificProxy");
var Util_1 = require("../Util");
var SemaphoreInitCodec_1 = require("../codec/SemaphoreInitCodec");
var SemaphoreAcquireCodec_1 = require("../codec/SemaphoreAcquireCodec");
var SemaphoreAvailablePermitsCodec_1 = require("../codec/SemaphoreAvailablePermitsCodec");
var SemaphoreDrainPermitsCodec_1 = require("../codec/SemaphoreDrainPermitsCodec");
var SemaphoreReducePermitsCodec_1 = require("../codec/SemaphoreReducePermitsCodec");
var SemaphoreReleaseCodec_1 = require("../codec/SemaphoreReleaseCodec");
var SemaphoreTryAcquireCodec_1 = require("../codec/SemaphoreTryAcquireCodec");
var SemaphoreProxy = (function (_super) {
__extends(SemaphoreProxy, _super);
function SemaphoreProxy() {
return _super !== null && _super.apply(this, arguments) || this;
}
SemaphoreProxy.prototype.init = function (permits) {
Util_1.assertNotNegative(permits, 'Permits cannot be negative.');
return this.encodeInvoke(SemaphoreInitCodec_1.SemaphoreInitCodec, permits);
};
SemaphoreProxy.prototype.acquire = function (permits) {
if (permits === void 0) { permits = 1; }
Util_1.assertNotNegative(permits, 'Permits cannot be negative.');
return this.encodeInvoke(SemaphoreAcquireCodec_1.SemaphoreAcquireCodec, permits);
};
SemaphoreProxy.prototype.availablePermits = function () {
return this.encodeInvoke(SemaphoreAvailablePermitsCodec_1.SemaphoreAvailablePermitsCodec);
};
SemaphoreProxy.prototype.drainPermits = function () {
return this.encodeInvoke(SemaphoreDrainPermitsCodec_1.SemaphoreDrainPermitsCodec);
};
SemaphoreProxy.prototype.reducePermits = function (reduction) {
Util_1.assertNotNegative(reduction, 'Reduction cannot be negative.');
return this.encodeInvoke(SemaphoreReducePermitsCodec_1.SemaphoreReducePermitsCodec, reduction);
};
SemaphoreProxy.prototype.release = function (permits) {
if (permits === void 0) { permits = 1; }
Util_1.assertNotNegative(permits, 'Permits cannot be negative.');
return this.encodeInvoke(SemaphoreReleaseCodec_1.SemaphoreReleaseCodec, permits);
};
SemaphoreProxy.prototype.tryAcquire = function (permits, timeout) {
if (timeout === void 0) { timeout = 0; }
Util_1.assertNotNegative(permits, 'Permits cannot be negative.');
return this.encodeInvoke(SemaphoreTryAcquireCodec_1.SemaphoreTryAcquireCodec, permits, timeout);
};
return SemaphoreProxy;
}(PartitionSpecificProxy_1.PartitionSpecificProxy));
exports.SemaphoreProxy = SemaphoreProxy;
//# sourceMappingURL=SemaphoreProxy.js.map