/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.spi;

import io.airlift.slice.Slice;

import java.util.Collection;
import java.util.concurrent.CompletableFuture;

public interface ConnectorPageSink
{
    CompletableFuture<?> NOT_BLOCKED = CompletableFuture.completedFuture(null);

    /**
     * Returns a future that will be completed when the page sink can accept
     * more pages.  If the page sink can accept more pages immediately,
     * this method should return {@code NOT_BLOCKED}.
     */
    CompletableFuture<?> appendPage(Page page);

    CompletableFuture<Collection<Slice>> finish();

    void abort();
}

@@ -1080,24 +1080,379 @@
 age page);%0A%0A
+    /**%0A     * Notifies the connector that no more pages will be appended and returns%0A     * connector-specific information that will be sent to the coordinator to%0A     * complete the write operation. This method may be called immediately%0A     * after the previous call to %7B@link #appendPage%7D (even if the returned%0A     * future is not complete).%0A     */%0A
     Completa

Document ConnectorPageSink#finish