redis-smq
Version:
A high-performance, reliable, and scalable message queue for Node.js.
16 lines • 770 B
JavaScript
import { CallbackEmptyReplyError, } from 'redis-smq-common';
import { OperationBitmask } from '../types/index.js';
import { _getQueueState } from '../../queue-state-manager/_/_get-queue-state.js';
import { operationRegistry } from '../operation-registery.js';
export function _checkOperation(client, queueParams, operation, cb) {
_getQueueState(client, queueParams, (err, queueState) => {
if (err)
return cb(err);
if (!queueState)
return cb(new CallbackEmptyReplyError());
const bitmask = operationRegistry[queueState.to] ?? 0;
const allowed = (bitmask & OperationBitmask[operation]) !== 0;
cb(null, { allowed, currentQueueState: queueState.to });
});
}
//# sourceMappingURL=_check-operation.js.map