org.kitesdk.data
Interface View<E>

Type Parameters:
E - The type of entities stored in the Dataset underlying this View.
All Known Subinterfaces:
Dataset<E>, RandomAccessDataset<E>, RefinableView<E>

@Immutable
public interface View<E>

A View is a subset of a Dataset. A View defines a space of potential storage keys or a partition space. Views can be created from ranges, partial keys, or the union of other views.

Since:
0.9.0

Method Summary
 boolean deleteAll()
          Deletes the entities included in this View or throws an UnsupportedOperationException.
 Dataset<E> getDataset()
          Returns the underlying Dataset for the View.
 boolean includes(E entity)
          Returns whether an entity Object would be included in this View if it were present in the Dataset.
 DatasetReader<E> newReader()
          Get an appropriate DatasetReader implementation based on this View of the underlying Dataset implementation.
 DatasetWriter<E> newWriter()
          Get an appropriate DatasetWriter implementation based on this View of the underlying Dataset implementation.
 

Method Detail

getDataset

Dataset<E> getDataset()
Returns the underlying Dataset for the View.

Returns:
the underlying Dataset

newReader

DatasetReader<E> newReader()
Get an appropriate DatasetReader implementation based on this View of the underlying Dataset implementation. Implementations are free to return different types of readers, depending on the disposition of the data. For example, a partitioned dataset can use a different reader than that of a non-partitioned dataset. Clients should not make any assumptions about the returned implementations: implementations are free to change their internal structure at any time.

Throws:
DatasetException

newWriter

DatasetWriter<E> newWriter()
Get an appropriate DatasetWriter implementation based on this View of the underlying Dataset implementation. Implementations are free to return different types of writers depending on the disposition of the data. For example, a partitioned dataset may use a different writer than that of a non-partitioned dataset. Clients should not make any assumptions about the returned implementations: implementations are free to change their internal structure at any time.

Throws:
DatasetException

includes

boolean includes(E entity)
Returns whether an entity Object would be included in this View if it were present in the Dataset.

Parameters:
entity - an entity Object
Returns:
true if entity is in the partition space of this view.
Since:
0.11.0

deleteAll

boolean deleteAll()
Deletes the entities included in this View or throws an UnsupportedOperationException. Implementations are allowed to throw UnsupportedOperationException if the View could require additional work to delete. For example, if some but not all of the data in an underlying data file must be removed, then the implementation is allowed to reject the deletion rather than copy the remaining records to a new file. Implementations must document what deletes are supported and under what conditions deletes are rejected.

Returns:
true if any data was deleted, false if the View was already empty
Throws:
UnsupportedOperationException - if the requested delete cannot be completed by the implementation
DatasetIOException - if the requested delete failed because of an IOException
Since:
0.12.0


Copyright © 2013–2014. All rights reserved.