include node_modules so release .zip is deployable
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.base
|
||||
*/
|
||||
/**
|
||||
* Common interface for lockable mutex.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface ILockable {
|
||||
/**
|
||||
* Locks the mutex.
|
||||
*
|
||||
* Monopolies a mutex until be {@link unlock unlocked}. If there're someone who have already
|
||||
* {@link lock monopolied} the mutex, the function call would be blocked until all of them to
|
||||
* return their acquistions by calling the {@link unlock} method.
|
||||
*
|
||||
* In same reason, if you don't call the {@link unlock} function after your business, the
|
||||
* others who want to {@link lock monopoly} the mutex would be fall into the forever sleep.
|
||||
* Therefore, never forget to calling the {@link unlock} function or utilize the
|
||||
* {@link UniqueLock.lock} function instead to ensure the safety.
|
||||
*/
|
||||
lock(): Promise<void>;
|
||||
/**
|
||||
* Tries to lock the mutex.
|
||||
*
|
||||
* Attempts to monopoly a mutex without blocking. If succeeded to monopoly the mutex
|
||||
* immediately, it returns `true` directly. Otherwise there's someone who has already
|
||||
* {@link lock monopolied} the mutex, the function gives up the trial immediately and returns
|
||||
* `false` directly.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* the mutex would be fall into the forever sleep. Therefore, never forget to calling the
|
||||
* {@link unlock} function or utilize the {@link UniqueLock.try_lock} function instead to
|
||||
* ensure the safety.
|
||||
*
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock(): Promise<boolean>;
|
||||
/**
|
||||
* Unlocks the mutex.
|
||||
*
|
||||
* When you call this {@link unlock} method and there're someone who are currently blocked by
|
||||
* attempting to {@link lock} this mutex, one of them (FIFO; first-in-first-out) would acquire
|
||||
* the lock and continues its execution.
|
||||
*
|
||||
* Otherwise, there's not anyone who is acquiring the {@link lock} of this mutex, the
|
||||
* {@link DomainError} exception would be thrown.
|
||||
*
|
||||
* > As you know, when you succeeded to acquire the `lock`, you don't have to forget to
|
||||
* > calling this {@link unlock} method after your business. If you forget it, it would be a
|
||||
* > terrible situation for the others who're attempting to lock this mutex.
|
||||
* >
|
||||
* > However, if you utilize the {@link UniqueLock}, you don't need to consider about this
|
||||
* > {@link unlock} method. Just define your business into a callback function as a parameter
|
||||
* > of methods of the {@link UniqueLock}, then this {@link unlock} method would be
|
||||
* > automatically called by the {@link UniqueLock} after the business.
|
||||
*
|
||||
* @throw {@link DomainError} when no one is acquiring the {@link lock write lock}.
|
||||
*/
|
||||
unlock(): Promise<void>;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ILockable.js.map
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.base
|
||||
*/
|
||||
import { ILockable } from "./ILockable";
|
||||
/**
|
||||
* Common interface for shared lockable mutex.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface ISharedLockable extends ILockable {
|
||||
/**
|
||||
* Write locks the mutex.
|
||||
*
|
||||
* Monopolies a mutex until be {@link unlock unlocked}. If there're someone who have already
|
||||
* {@link lock monopolied} or {@link lock_shared shared} the mutex, the function call would
|
||||
* be blocked until all of them to return their acquistions by calling {@link unlock} or
|
||||
* {@link unlock_shared} methods.
|
||||
*
|
||||
* In same reason, if you don't call the {@link unlock} function after your business, the
|
||||
* others who want to {@link lock monopoly} or {@link lock_shared share} the mutex would be
|
||||
* fall into the forever sleep. Therefore, never forget to calling the {@link unlock} function
|
||||
* or utilize the {@link UniqueLock.lock} function instead to ensure the safety.
|
||||
*/
|
||||
lock(): Promise<void>;
|
||||
/**
|
||||
* Tries to write lock the mutex.
|
||||
*
|
||||
* Attempts to monopoly a mutex without blocking. If succeeded to monopoly the mutex
|
||||
* immediately, it returns `true` directly. Otherwise there's someone who has already
|
||||
* {@link lock monopolied} or {@link lock_shared shared} the mutex, the function gives up the
|
||||
* trial immediately and returns `false` directly.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* or {@link lock_shared share} the mutex would be fall into the forever sleep. Therefore,
|
||||
* never forget to calling the {@link unlock} function or utilize the
|
||||
* {@link UniqueLock.try_lock} function instead to ensure the safety.
|
||||
*
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock(): Promise<boolean>;
|
||||
/**
|
||||
* Write unlocks the mutex.
|
||||
*
|
||||
* When you call this {@link unlock} method and there're someone who are currently blocked by
|
||||
* attempting to {@link lock write} or {@link lock_shared read} lock this mutex, one of them
|
||||
* (FIFO; first-in-first-out) would acquire the lock and continues its execution.
|
||||
*
|
||||
* Otherwise, there's not anyone who is acquiring the {@link lock write lock} of this mutex,
|
||||
* the {@link DomainError} exception would be thrown.
|
||||
*
|
||||
* > As you know, when you succeeded to acquire the `write lock`, you don't have to forget to
|
||||
* > calling this {@link unlock} method after your business. If you forget it, it would be a
|
||||
* > terrible situation for the others who're attempting to lock this mutex.
|
||||
* >
|
||||
* > However, if you utilize the {@link UniqueLock}, you don't need to consider about this
|
||||
* > {@link unlock} method. Just define your business into a callback function as a parameter
|
||||
* > of methods of the {@link UniqueLock}, then this {@link unlock} method would be
|
||||
* > automatically called by the {@link UniqueLock} after the business.
|
||||
*
|
||||
* @throw {@link DomainError} when no one is acquiring the {@link lock write lock}.
|
||||
*/
|
||||
unlock(): Promise<void>;
|
||||
/**
|
||||
* Read locks the mutex.
|
||||
*
|
||||
* Shares a mutex until be {@link unlock_shared unlocked}. If there're someone who have
|
||||
* already {@link lock monopolied} the mutex, the function call would be blocked until all of
|
||||
* them to {@link unlock return} their acquisitions.
|
||||
*
|
||||
* In same reason, if you don't call the {@link unlock_shared} function after your business,
|
||||
* the others who want to {@link lock monopoly} the mutex would be fall into the forever
|
||||
* sleep. Therefore, never forget to calling the {@link unlock_shared} or utilize the
|
||||
* {@link SharedLock.lock} function instead to ensure the safety.
|
||||
*/
|
||||
lock_shared(): Promise<void>;
|
||||
/**
|
||||
* Tries to read lock the mutex.
|
||||
*
|
||||
* Attemps to share a mutex without blocking. If succeeded to share the mutex immediately, it
|
||||
* returns `true` directly. Otherwise there's someone who has already {@link lock monopolied}
|
||||
* the mutex, the function gives up the trial immediately and returns `false` directly.
|
||||
*
|
||||
* Note that, if you succeeded to share the mutex (returns `true`) but do not call the
|
||||
* {@link unlock_shared} function after your buinsess, the others who want to
|
||||
* {@link lock monopoly} the mutex would be fall into the forever sleep. Therefore, never
|
||||
* forget to calling the {@link unlock_shared} function or utilize the
|
||||
* {@link SharedLock.try_lock} function instead to ensure the safety.
|
||||
*
|
||||
* @return Whether succeeded to share the mutex or not.
|
||||
*/
|
||||
try_lock_shared(): Promise<boolean>;
|
||||
/**
|
||||
* Read unlocks the mutex.
|
||||
*
|
||||
* When you call this {@link unlock_shared} method and there're someone who are currently
|
||||
* blocked by attempting to {@link lock monopoly} this mutex, one of them
|
||||
* (FIFO; first-in-first-out) would acquire the lock and continues its execution.
|
||||
*
|
||||
* Otherwise, there's not anyone who is acquiring the {@link lock_shared read lock} of this
|
||||
* mutex, the {@link DomainError} exception would be thrown.
|
||||
*
|
||||
* > As you know, when you succeeded to acquire the `read lock`, you don't have to forget to
|
||||
* > calling this {@link unlock_shared} method after your business. If you forget it, it would
|
||||
* > be a terrible situation for the others who're attempting to lock this mutex.
|
||||
* >
|
||||
* > However, if you utilize the {@link SharedLock}, you don't need to consider about this
|
||||
* > {@link unlock_shared} method. Just define your business into a callback function as a
|
||||
* > parameter of methods of the {@link SharedLock}, then this {@link unlock_shared} method
|
||||
* > would be automatically called by the {@link SharedLock} after the business.
|
||||
*/
|
||||
unlock_shared(): Promise<void>;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ISharedLockable.js.map
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.base
|
||||
*/
|
||||
import { ISharedLockable } from "./ISharedLockable";
|
||||
/**
|
||||
* Common interface for shared & timed lockable mutex.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface ISharedTimedLockable extends ISharedLockable {
|
||||
/**
|
||||
* Tries to write lock the mutex until timeout.
|
||||
*
|
||||
* Attempts to monopoly a mutex until timeout. If succeeded to monopoly the mutex until the
|
||||
* timeout, it returns `true`. Otherwise failed to acquiring the lock in the given time, the
|
||||
* function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquiring the lock in the given time (returns `false`), it means that there's
|
||||
* someone who has already {@link lock monopolied} or {@link lock_shared shared} the mutex and
|
||||
* does not return it over the timeout.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* or {@link lock_shared share} the mutex would be fall into the forever sleep. Therefore,
|
||||
* never forget to calling the {@link unlock} function or utilize the
|
||||
* {@link UniqueLock.try_lock_for} function instead to ensure the safety.
|
||||
*
|
||||
* @param ms The maximum miliseconds for waiting.
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock_for(ms: number): Promise<boolean>;
|
||||
/**
|
||||
* Tries to write lock the mutex until time expiration.
|
||||
*
|
||||
* Attemps to monopoly a mutex until time expiration. If succeeded to monopoly the mutex
|
||||
* until the time expiration, it returns `true`. Otherwise failed to acquiring the lock in the
|
||||
* given time, the function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquiring the lock in the given time (returns `false`), it means that there's
|
||||
* someone who has already {@link lock monopolied} or {@link lock_shared shared} the mutex and
|
||||
* does not return it over the time expiration.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* or {@link lock_shared share} the mutex would be fall into the forever sleep. Therefore,
|
||||
* never forget to calling the {@link unlock} function or utilize the
|
||||
* {@link UniqueLock.try_lock_until} function instead to ensure the safety.
|
||||
*
|
||||
* @param at The maximum time point to wait.
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock_until(at: Date): Promise<boolean>;
|
||||
/**
|
||||
* Tries to read lock the mutex until timeout.
|
||||
*
|
||||
* Attemps to share a mutex until timeout. If succeeded to share the mutex until timeout, it
|
||||
* returns `true`. Otherwise failed to acquiring the shared lock in the given time, the
|
||||
* function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquring the shared lock in the given time (returns `false`), it means that
|
||||
* there's someone who has already {@link lock monopolied} the mutex and does not return it
|
||||
* over the timeout.
|
||||
*
|
||||
* Note that, if you succeeded to share the mutex (returns `true`) but do not call the
|
||||
* {@link unlock_shared} function after your buinsess, the others who want to
|
||||
* {@link lock monopoly} the mutex would be fall into the forever sleep. Therefore, never
|
||||
* forget to calling the {@link unlock_shared} function or utilize the
|
||||
* {@link SharedLock.try_lock_for} function instead to ensure the safety.
|
||||
*
|
||||
* @param ms The maximum miliseconds for waiting.
|
||||
* @return Whether succeeded to share the mutex or not.
|
||||
*/
|
||||
try_lock_shared_for(ms: number): Promise<boolean>;
|
||||
/**
|
||||
* Tries to read lock the mutex until time expiration.
|
||||
*
|
||||
* Attemps to share a mutex until time expiration. If succeeded to share the mutex until time
|
||||
* expiration, it returns `true`. Otherwise failed to acquiring the shared lock in the given
|
||||
* time, the function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquring the shared lock in the given time (returns `false`), it means that
|
||||
* there's someone who has already {@link lock monopolied} the mutex and does not return it
|
||||
* over the time expiration.
|
||||
*
|
||||
* Note that, if you succeeded to share the mutex (returns `true`) but do not call the
|
||||
* {@link unlock_shared} function after your buinsess, the others who want to
|
||||
* {@link lock monopoly} the mutex would be fall into the forever sleep. Therefore, never
|
||||
* forget to calling the {@link unlock_shared} function or utilize the
|
||||
* {@link SharedLock.try_lock_until} function instead to ensure the safety.
|
||||
*
|
||||
* @param at The maximum time point to wait.
|
||||
* @return Whether succeeded to share the mutex or not.
|
||||
*/
|
||||
try_lock_shared_until(at: Date): Promise<boolean>;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ISharedTimedLockable.js.map
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std.base
|
||||
*/
|
||||
import { ILockable } from "./ILockable";
|
||||
/**
|
||||
* Common interface for timed lockable mutex.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface ITimedLockable extends ILockable {
|
||||
/**
|
||||
* Tries to lock the mutex until timeout.
|
||||
*
|
||||
* Attempts to monopoly a mutex until timeout. If succeeded to monopoly the mutex until the
|
||||
* timeout, it returns `true`. Otherwise failed to acquiring the lock in the given time, the
|
||||
* function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquiring the lock in the given time (returns `false`), it means that there's
|
||||
* someone who has already {@link lock monopolied} the mutex and does not return it over the
|
||||
* timeout.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* the mutex would be fall into the forever sleep. Therefore, never forget to calling the
|
||||
* {@link unlock} function or utilize the {@link UniqueLock.try_lock_for} function instead to
|
||||
* ensure the safety.
|
||||
*
|
||||
* @param ms The maximum miliseconds for waiting.
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock_for(ms: number): Promise<boolean>;
|
||||
/**
|
||||
* Tries to write lock the mutex until time expiration.
|
||||
*
|
||||
* Attemps to monopoly a mutex until time expiration. If succeeded to monopoly the mutex
|
||||
* until the time expiration, it returns `true`. Otherwise failed to acquiring the lock in the
|
||||
* given time, the function gives up the trial and returns `false`.
|
||||
*
|
||||
* Failed to acquiring the lock in the given time (returns `false`), it means that there's
|
||||
* someone who has already {@link lock monopolied} the mutex and does not return it over the
|
||||
* time expiration.
|
||||
*
|
||||
* Note that, if you succeeded to monopoly the mutex (returns `true`) but do not call the
|
||||
* {@link unlock} function after your business, the others who want to {@link lock monopoly}
|
||||
* the mutex would be fall into the forever sleep. Therefore, never forget to calling the
|
||||
* {@link unlock} function or utilize the {@link UniqueLock.try_lock_until} function instead
|
||||
* to ensure the safety.
|
||||
*
|
||||
* @param at The maximum time point to wait.
|
||||
* @return Whether succeeded to monopoly the mutex or not.
|
||||
*/
|
||||
try_lock_until(at: Date): Promise<boolean>;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=ITimedLockable.js.map
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
export * from "./ILockable";
|
||||
export * from "./ITimedLockable";
|
||||
export * from "./ISharedLockable";
|
||||
export * from "./ISharedTimedLockable";
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./ILockable"), exports);
|
||||
__exportStar(require("./ITimedLockable"), exports);
|
||||
__exportStar(require("./ISharedLockable"), exports);
|
||||
__exportStar(require("./ISharedTimedLockable"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
Reference in New Issue
Block a user