public class CassandraServiceImpl<T> extends 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 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(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(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).
|
List<BoundedSource<T>> |
split(CassandraIO.Read<T> spec,
long desiredBundleSizeBytes)
Split a table read into several sources.
|
protected 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)
CassandraServiceBoundedSource.BoundedReader that will read from
Cassandra using the spec from
CassandraIO.CassandraSource.createReader in interface CassandraService<T>public long getEstimatedSizeBytes(CassandraIO.Read<T> spec)
CassandraServicegetEstimatedSizeBytes in interface CassandraService<T>protected static long getEstimatedSizeBytes(List<CassandraServiceImpl.TokenRange> tokenRanges)
public List<BoundedSource<T>> split(CassandraIO.Read<T> spec, long desiredBundleSizeBytes)
CassandraServicesplit in interface CassandraService<T>protected List<BoundedSource<T>> split(CassandraIO.Read<T> spec, long desiredBundleSizeBytes, long estimatedSizeBytes)
protected static double getRingFraction(List<CassandraServiceImpl.TokenRange> tokenRanges)
protected static BigInteger distance(long left, long right)
protected static boolean isMurmur3Partitioner(com.datastax.driver.core.Cluster cluster)
public CassandraService.Writer createWriter(CassandraIO.Write<T> spec)
CassandraServiceCassandraService.Writer that writes entities into the Cassandra instance.createWriter in interface CassandraService<T>Copyright © 2016–2018 The Apache Software Foundation. All rights reserved.