CLUSTER_SLOTS.js 656 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.transformReply = exports.transformArguments = void 0;
  4. function transformArguments() {
  5. return ['CLUSTER', 'SLOTS'];
  6. }
  7. exports.transformArguments = transformArguments;
  8. ;
  9. function transformReply(reply) {
  10. return reply.map(([from, to, master, ...replicas]) => {
  11. return {
  12. from,
  13. to,
  14. master: transformNode(master),
  15. replicas: replicas.map(transformNode)
  16. };
  17. });
  18. }
  19. exports.transformReply = transformReply;
  20. function transformNode([ip, port, id]) {
  21. return {
  22. ip,
  23. port,
  24. id
  25. };
  26. }