use of org.apache.cassandra.streaming.StreamSummary in project cassandra by apache.
the class SessionInfoCompositeData method fromCompositeData.
public static SessionInfo fromCompositeData(CompositeData cd) {
assert cd.getCompositeType().equals(COMPOSITE_TYPE);
Object[] values = cd.getAll(ITEM_NAMES);
InetAddress peer, connecting;
try {
peer = InetAddress.getByName((String) values[1]);
connecting = InetAddress.getByName((String) values[2]);
} catch (UnknownHostException e) {
throw Throwables.propagate(e);
}
Function<CompositeData, StreamSummary> toStreamSummary = new Function<CompositeData, StreamSummary>() {
public StreamSummary apply(CompositeData input) {
return StreamSummaryCompositeData.fromCompositeData(input);
}
};
SessionInfo info = new SessionInfo(peer, (int) values[8], connecting, fromArrayOfCompositeData((CompositeData[]) values[3], toStreamSummary), fromArrayOfCompositeData((CompositeData[]) values[4], toStreamSummary), StreamSession.State.valueOf((String) values[5]));
Function<CompositeData, ProgressInfo> toProgressInfo = new Function<CompositeData, ProgressInfo>() {
public ProgressInfo apply(CompositeData input) {
return ProgressInfoCompositeData.fromCompositeData(input);
}
};
for (ProgressInfo progress : fromArrayOfCompositeData((CompositeData[]) values[6], toProgressInfo)) {
info.updateProgress(progress);
}
for (ProgressInfo progress : fromArrayOfCompositeData((CompositeData[]) values[7], toProgressInfo)) {
info.updateProgress(progress);
}
return info;
}
use of org.apache.cassandra.streaming.StreamSummary in project cassandra by apache.
the class PrepareMessage method toString.
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("Prepare (");
sb.append(requests.size()).append(" requests, ");
int totalFile = 0;
for (StreamSummary summary : summaries) totalFile += summary.files;
sb.append(" ").append(totalFile).append(" files");
sb.append('}');
return sb.toString();
}
Aggregations