All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.datastax.driver.core.Segment Maven / Gradle / Ivy

Go to download

A driver for Apache Cassandra 1.2+ that works exclusively with the Cassandra Query Language version 3 (CQL3) and Cassandra's binary protocol.

There is a newer version: 4.0.0
Show newest version
/*
 * Copyright DataStax, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.datastax.driver.core;

import io.netty.buffer.ByteBuf;

/**
 * A container of {@link Frame}s in protocol v5 and above. This is a new protocol construct that
 * allows checksumming and compressing multiple messages together.
 *
 * 

{@link #getPayload()} contains either: * *

    *
  • a sequence of encoded {@link Frame}s, all concatenated together. In this case, {@link * #isSelfContained()} return true. *
  • or a slice of an encoded large {@link Frame} (if that frame is longer than {@link * #MAX_PAYLOAD_LENGTH}). In this case, {@link #isSelfContained()} returns false. *
* * The payload is not compressed; compression is handled at a lower level when encoding or decoding * this object. * *

Naming is provisional: "segment" is not the official name, I picked it arbitrarily for the * driver code to avoid a name clash. It's possible that this type will be renamed to "frame", and * {@link Frame} to something else, at some point in the future (this is an ongoing discussion on * the server ticket). */ class Segment { static int MAX_PAYLOAD_LENGTH = 128 * 1024 - 1; private final ByteBuf payload; private final boolean isSelfContained; Segment(ByteBuf payload, boolean isSelfContained) { this.payload = payload; this.isSelfContained = isSelfContained; } public ByteBuf getPayload() { return payload; } public boolean isSelfContained() { return isSelfContained; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy