Search in sources :

Example 1 with StreamEvent

use of org.apache.cassandra.streaming.StreamEvent in project cassandra by apache.

the class LocalSyncTask method handleStreamEvent.

public void handleStreamEvent(StreamEvent event) {
    if (state == null)
        return;
    switch(event.eventType) {
        case STREAM_PREPARED:
            StreamEvent.SessionPreparedEvent spe = (StreamEvent.SessionPreparedEvent) event;
            state.trace("Streaming session with {} prepared", spe.session.peer);
            break;
        case STREAM_COMPLETE:
            StreamEvent.SessionCompleteEvent sce = (StreamEvent.SessionCompleteEvent) event;
            state.trace("Streaming session with {} {}", sce.peer, sce.success ? "completed successfully" : "failed");
            break;
        case FILE_PROGRESS:
            ProgressInfo pi = ((StreamEvent.ProgressEvent) event).progress;
            state.trace("{}/{} ({}%) {} idx:{}{}", new Object[] { FBUtilities.prettyPrintMemory(pi.currentBytes), FBUtilities.prettyPrintMemory(pi.totalBytes), pi.currentBytes * 100 / pi.totalBytes, pi.direction == ProgressInfo.Direction.OUT ? "sent to" : "received from", pi.sessionIndex, pi.peer });
    }
}
Also used : StreamEvent(org.apache.cassandra.streaming.StreamEvent) ProgressInfo(org.apache.cassandra.streaming.ProgressInfo)

Aggregations

ProgressInfo (org.apache.cassandra.streaming.ProgressInfo)1 StreamEvent (org.apache.cassandra.streaming.StreamEvent)1