public class CassandraServiceImpl<T> extends java.lang.Object implements CassandraService<T>
CassandraService
that actually use a Cassandra instance.Modifier and Type | Class and Description |
---|---|
protected static class |
CassandraServiceImpl.TokenRange
Represent a token range in Cassandra instance, wrapping the partition count, size and token
range.
|
protected class |
CassandraServiceImpl.WriterImpl<T>
Writer storing an entity into Apache Cassandra database.
|
CassandraService.Writer<T>
Constructor and Description |
---|
CassandraServiceImpl() |
Modifier and Type | Method and Description |
---|---|
org.apache.beam.sdk.io.cassandra.CassandraServiceImpl.CassandraReaderImpl<T> |
createReader(org.apache.beam.sdk.io.cassandra.CassandraIO.CassandraSource<T> source)
Returns a
BoundedSource.BoundedReader that will read from
Cassandra using the spec from
CassandraIO.CassandraSource . |
CassandraService.Writer |
createWriter(CassandraIO.Write<T> spec)
Create a
CassandraService.Writer that writes entities into the Cassandra instance. |
protected static java.math.BigInteger |
distance(long left,
long right)
Measure distance between two tokens.
|
long |
getEstimatedSizeBytes(CassandraIO.Read<T> spec)
Returns an estimation of the size that could be read.
|
protected static long |
getEstimatedSizeBytes(java.util.List<CassandraServiceImpl.TokenRange> tokenRanges)
Actually estimate the size of the data to read on the cluster, based on the given token
ranges to address.
|
protected static double |
getRingFraction(java.util.List<CassandraServiceImpl.TokenRange> tokenRanges)
Compute the percentage of token addressed compared with the whole tokens in the cluster.
|
protected static boolean |
isMurmur3Partitioner(com.datastax.driver.core.Cluster cluster)
Check if the current partitioner is the Murmur3 (default in Cassandra version newer than 2).
|
java.util.List<BoundedSource<T>> |
split(CassandraIO.Read<T> spec,
long desiredBundleSizeBytes)
Split a table read into several sources.
|
protected java.util.List<BoundedSource<T>> |
split(CassandraIO.Read<T> spec,
long desiredBundleSizeBytes,
long estimatedSizeBytes)
Compute the number of splits based on the estimated size and the desired bundle size, and
create several sources.
|
public org.apache.beam.sdk.io.cassandra.CassandraServiceImpl.CassandraReaderImpl<T> createReader(org.apache.beam.sdk.io.cassandra.CassandraIO.CassandraSource<T> source)
CassandraService
BoundedSource.BoundedReader
that will read from
Cassandra using the spec from
CassandraIO.CassandraSource
.createReader
in interface CassandraService<T>
public long getEstimatedSizeBytes(CassandraIO.Read<T> spec)
CassandraService
getEstimatedSizeBytes
in interface CassandraService<T>
protected static long getEstimatedSizeBytes(java.util.List<CassandraServiceImpl.TokenRange> tokenRanges)
public java.util.List<BoundedSource<T>> split(CassandraIO.Read<T> spec, long desiredBundleSizeBytes)
CassandraService
split
in interface CassandraService<T>
protected java.util.List<BoundedSource<T>> split(CassandraIO.Read<T> spec, long desiredBundleSizeBytes, long estimatedSizeBytes)
protected static double getRingFraction(java.util.List<CassandraServiceImpl.TokenRange> tokenRanges)
protected static java.math.BigInteger distance(long left, long right)
protected static boolean isMurmur3Partitioner(com.datastax.driver.core.Cluster cluster)
public CassandraService.Writer createWriter(CassandraIO.Write<T> spec)
CassandraService
CassandraService.Writer
that writes entities into the Cassandra instance.createWriter
in interface CassandraService<T>