Skip to content

Commit

Permalink
Add Spiller and SpillerFactory interface
Browse files Browse the repository at this point in the history
  • Loading branch information
pnowojski authored and cberner committed Oct 4, 2016
1 parent b8e2cf9 commit e953c50
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
42 changes: 42 additions & 0 deletions presto-main/src/main/java/com/facebook/presto/spiller/Spiller.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* 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.spiller;

import com.facebook.presto.spi.Page;

import java.io.Closeable;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CompletableFuture;

public interface Spiller
extends Closeable
{
/**
* Initiate spilling of pages stream. Returns completed future once spilling has finished.
*/
CompletableFuture<?> spill(Iterator<Page> pageIterator);

/**
* Returns list of previously spilled Pages streams.
*/
List<Iterator<Page>> getSpills();

/**
* Close releases/removes all underlying resources used during spilling
* like for example all created temporary files.
*/
@Override
void close();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* 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.spiller;

import com.facebook.presto.spi.type.Type;

import java.util.List;

public interface SpillerFactory
{
Spiller create(List<Type> types);
}

0 comments on commit e953c50

Please sign in to comment.