List of usage examples for org.apache.cassandra.streaming SessionInfo getTotalSizeReceived
public long getTotalSizeReceived()
From source file:io.cassandrareaper.service.StreamFactory.java
License:Apache License
public static Stream newStream(String host, SessionInfo sessionInfo, long timeStamp) { final String peer = sessionInfo.peer.toString().replaceAll("/", ""); final long sizeSent = sessionInfo.getTotalSizeSent(); final long sizeReceived = sessionInfo.getTotalSizeReceived(); Stream.Direction direction = Stream.Direction.BOTH; if (sizeReceived == 0 && sizeSent != 0) { direction = Stream.Direction.IN; }//from w w w . j a va 2 s . co m if (sizeReceived != 0 && sizeSent == 0) { direction = Stream.Direction.OUT; } final String streamId = String.format("%s-%s-%s", host, direction, peer); final List<Stream.TableProgress> progressReceived = countProgressPerTable(sessionInfo.getReceivingFiles()); final List<Stream.TableProgress> progressSent = countProgressPerTable(sessionInfo.getSendingFiles()); return Stream.builder().withId(streamId).withHost(host).withPeer(peer).withDirection(direction) .withSizeToReceive(sessionInfo.getTotalSizeToReceive()) .withSizeToSend(sessionInfo.getTotalSizeToSend()).withProgressSent(progressSent) .withProgressReceived(progressReceived).withSizeSent(sizeSent).withSizeReceived(sizeReceived) .withLastUpdated(timeStamp).withCompleted(sessionInfo.state == StreamSession.State.COMPLETE) .withSuccess(!sessionInfo.isFailed()).build(); }