Class StreamSession

    • Method Detail

      • isFollower

        public boolean isFollower()
      • planId

        public java.util.UUID planId()
      • sessionIndex

        public int sessionIndex()
      • getPendingRepair

        public java.util.UUID getPendingRepair()
      • isPreview

        public boolean isPreview()
      • init

        public void init​(StreamResultFuture streamResult)
        Bind this session to report to specific StreamResultFuture and perform pre-streaming initialization.
        Parameters:
        streamResult - result to report to
      • attachInbound

        public boolean attachInbound​(io.netty.channel.Channel channel,
                                     boolean isControlChannel)
        Attach a channel to this session upon receiving the first inbound message.
        Parameters:
        channel - The channel to attach.
        isControlChannel - If the channel is the one to send control messages to.
        Returns:
        False if the channel was already attached, true otherwise.
      • attachOutbound

        public boolean attachOutbound​(io.netty.channel.Channel channel)
        Attach a channel to this session upon sending the first outbound message.
        Parameters:
        channel - The channel to attach.
        Returns:
        False if the channel was already attached, true otherwise.
      • start

        public void start()
        invoked by the node that begins the stream session (it may be sending files, receiving files, or both)
      • addStreamRequest

        public void addStreamRequest​(java.lang.String keyspace,
                                     RangesAtEndpoint fullRanges,
                                     RangesAtEndpoint transientRanges,
                                     java.util.Collection<java.lang.String> columnFamilies)
        Request data fetch task to this session. Here, we have to encode both _local_ range transientness (encoded in Replica itself, in RangesAtEndpoint) and _remote_ (source) range transientmess, which is encoded by splitting ranges into full and transient.
        Parameters:
        keyspace - Requesting keyspace
        fullRanges - Ranges to retrieve data that will return full data from the source
        transientRanges - Ranges to retrieve data that will return transient data from the source
        columnFamilies - ColumnFamily names. Can be empty if requesting all CF under the keyspace.
      • state

        public void state​(StreamSession.State newState)
        Set current state to newState.
        Parameters:
        newState - new state to set
      • isSuccess

        public boolean isSuccess()
        Return if this session completed successfully.
        Returns:
        true if session completed successfully.
      • messageReceived

        public void messageReceived​(StreamMessage message)
      • onInitializationComplete

        public void onInitializationComplete()
        Call back when connection initialization is complete to start the prepare phase.
      • onError

        public java.util.concurrent.Future<?> onError​(java.lang.Throwable e)
        Signal an error to this stream session: if it's an EOF exception, it tries to understand if the socket was closed after completion or because the peer was down, otherwise sends a SessionFailedMessage and closes the session as StreamSession.State.FAILED.
      • prepare

        public void prepare​(java.util.Collection<StreamRequest> requests,
                            java.util.Collection<StreamSummary> summaries)
        Prepare this session for sending/receiving files.
      • streamSent

        public void streamSent​(OutgoingStreamMessage message)
        Call back after sending StreamMessageHeader.
        Parameters:
        message - sent stream message
      • receive

        public void receive​(IncomingStreamMessage message)
        Call back after receiving a stream.
        Parameters:
        message - received stream
      • progress

        public void progress​(java.lang.String filename,
                             ProgressInfo.Direction direction,
                             long bytes,
                             long total)
      • received

        public void received​(TableId tableId,
                             int sequenceNumber)
      • complete

        public void complete()
        Check if session is completed on receiving StreamMessage.Type.COMPLETE message.
      • sessionFailed

        public void sessionFailed()
        Call back on receiving StreamMessage.Type.SESSION_FAILED message.
      • getSessionInfo

        public SessionInfo getSessionInfo()
        Returns:
        Current snapshot of this session info.
      • prepareReceiving

        public void prepareReceiving​(StreamSummary summary)
      • getNumRequests

        public int getNumRequests()
      • getNumTransfers

        public int getNumTransfers()
      • abort

        public void abort()