()
| 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 | |
| 544 | module.exports = { FrameReader }; |
no test coverage detected