Interface ExchangeSink
@ThreadSafe
public interface ExchangeSink
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionabort()Notifies the exchange that the write operation has been aborted.voidadd(int partitionId, io.airlift.slice.Slice data) Appends arbitrarydatato a partition specified bypartitionId.finish()Notifies the exchange sink that no more data will be appended.longGet the total memory that needs to be reserved in the memory pool.Returns a future that will be completed when the exchange sink becomes unblocked.booleanReturnstruewhenExchangeSinkInstanceHandleneeds to be updated throughupdateHandle(ExchangeSinkInstanceHandle)to make further progressvoidUpdateExchangeSinkInstanceHandle.
-
Field Details
-
NOT_BLOCKED
-
-
Method Details
-
isHandleUpdateRequired
boolean isHandleUpdateRequired()ReturnstruewhenExchangeSinkInstanceHandleneeds to be updated throughupdateHandle(ExchangeSinkInstanceHandle)to make further progress -
updateHandle
UpdateExchangeSinkInstanceHandle. Done by the engine upon request initiated by theExchangeSink- 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 returnNOT_BLOCKED -
add
void add(int partitionId, io.airlift.slice.Slice data) Appends arbitrarydatato a partition specified bypartitionId. With method call thedatabuffer ownership is passed from caller to callee. This method is guaranteed not to be invoked afterfinish(). This method can be invoked afterabort(). If this method is invoked afterabort()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
CompletableFuture<Void> finish()Notifies the exchange sink that no more data will be appended. This method is guaranteed not to be called afterabort(). This method is guaranteed not be called more than once. Theabort()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
CompletableFuture<Void> abort()Notifies the exchange that the write operation has been aborted. This method may be called whenfinish()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 whenfinish()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
-