All communication between Cassandra clients and servers is done through discrete packets. Request packets are sent by clients, response packets are sent by Cassandra servers, usually (but not always) in response to requests.
For full details, consult the Cassandra documentation.
All packets have the following properties:
packetType (string): the type of the packet, e.g. "Query" or "ResultRows" - read only
packetOpCode (int): an integer corresponding to the packet type - read-only
isRequest (boolean): true if the packet is a request, false if it's a response - read-only
protocolVersion (int): the current version of the Cassandra protocol, can be 3, 4 or 5. Read-only as you cannot change protocol version once a connection has been established.
flagCompression (boolean): if true, the payload in this packet is compressed. This should not be changed.
flagCustomPayload (boolean): true if the payload in this packet is a custom payload
streamId (int): the stream ID for this packet. A single database connection can have up to 65,535 different streams, allowing the client to issue many concurrent requests. This streamId should normally not be changed as that would cause confusion for both the client and the server.
traceId (UUID): clients can add a UUID to their requests for the purpose of traceability, in which case the response(s) to these requests will also contain that same traceability UUID.
warnings (list<string>): in responses only, any warnings from the server.
All packets also have the following methods:
void setModified(): marks the packet as having been modified. This is normally done automatically, so this should rarely get used.
string toString(): returns a short description of the packet
string toLongString(): returns a longer description of the packet
The packet types most commonly used in user logic are: Query, Prepare, Execute, and ResultRows, though when dealing with result sets, most people use result set filters, which deal with ResultRow objects.
Authenticate: asks client to authenticate
Error: signals an error while executing a request
Event: signals a change to the system
Ready: signals that the server is ready to accept queries
ResultRows: a result set
ResultSchemaChange: response to a request changing the schema
ResultSetKeyspace: response to a query setting the current keyspace
ResultVoid: response to a query that has no result
Supported: returns the options supported by the server
These objects are not packets, but they are part of some packets.