MCPcopy Create free account
hub / github.com/apache/cassandra-nodejs-driver / parseSchemaChange

Method parseSchemaChange

lib/readers.js:501–541  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

499 }
500
501 parseSchemaChange() {
502 let result;
503 if (!types.protocolVersion.supportsSchemaChangeFullMetadata(this.header.version)) {
504 //v1/v2: 3 strings, the table value can be empty
505 result = {
506 eventType: types.protocolEvents.schemaChange,
507 schemaChangeType: this.readString(),
508 keyspace: this.readString(),
509 table: this.readString()
510 };
511 result.isKeyspace = !result.table;
512 return result;
513 }
514 //v3+: 3 or 4 strings: change_type, target, keyspace and (table, type, functionName or aggregate)
515 result = {
516 eventType: types.protocolEvents.schemaChange,
517 schemaChangeType: this.readString(),
518 target: this.readString(),
519 keyspace: this.readString(),
520 table: null,
521 udt: null,
522 signature: null
523 };
524 result.isKeyspace = result.target === 'KEYSPACE';
525 switch (result.target) {
526 case 'TABLE':
527 result.table = this.readString();
528 break;
529 case 'TYPE':
530 result.udt = this.readString();
531 break;
532 case 'FUNCTION':
533 result.functionName = this.readString();
534 result.signature = this.readStringList();
535 break;
536 case 'AGGREGATE':
537 result.aggregate = this.readString();
538 result.signature = this.readStringList();
539 }
540 return result;
541 }
542}
543
544module.exports = { FrameReader };

Callers 2

readEventMethod · 0.95
streams.jsFile · 0.80

Calls 2

readStringMethod · 0.95
readStringListMethod · 0.95

Tested by

no test coverage detected