Interface ExchangeSink


@ThreadSafe public interface ExchangeSink
  • Field Details

  • Method Details

    • isHandleUpdateRequired

      boolean isHandleUpdateRequired()
      Returns true when ExchangeSinkInstanceHandle needs to be updated through updateHandle(ExchangeSinkInstanceHandle) to make further progress
    • updateHandle

      void updateHandle(ExchangeSinkInstanceHandle handle)
      Update ExchangeSinkInstanceHandle. Done by the engine upon request initiated by the ExchangeSink
      Parameters:
      handle - updated handle
    • isBlocked

      CompletableFuture<Void> isBlocked()
      Returns a future that will be completed when the exchange sink becomes unblocked. If the exchange sink is not blocked, this method should return NOT_BLOCKED
    • add

      void add(int partitionId, io.airlift.slice.Slice data)
      Appends arbitrary data to a partition specified by partitionId. With method call the data buffer ownership is passed from caller to callee. This method is guaranteed not to be invoked after finish(). This method can be invoked after abort(). If this method is invoked after abort() the invocation should be ignored.
    • getMemoryUsage

      long getMemoryUsage()
      Get the total memory that needs to be reserved in the memory pool. This memory should include any buffers, etc. that are used for writing data
    • finish

      Notifies the exchange sink that no more data will be appended. This method is guaranteed not to be called after abort(). This method is guaranteed not be called more than once. The abort() method will not be called if the finish operation fails. The finish implementation is responsible for safely releasing resources in case of a failure.
      Returns:
      future that will be resolved when the finish operation either succeeds or fails
    • abort

      Notifies the exchange that the write operation has been aborted. This method may be called when finish() is still running. In this situation the implementation is free to either cancel the finish operation and abort or let the finish operation succeed. This method may also be called when finish() is done. In this situation the implementation is free to either ignore the call or invalidate the sink. This method is guaranteed not be called more than once.
      Returns:
      future that will be resolved when the abort operation either succeeds or fails