org.kitesdk.data
Interface RandomAccessDataset<E>

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

@Immutable
public interface RandomAccessDataset<E>
extends Dataset<E>

A Dataset that supports random access operations on entities.

Implementations of RandomAccessDataset are immutable.

Since:
0.9.0
See Also:
Dataset

Method Summary
 boolean delete(E entity)
          Deletes the entity passed to this method in the dataset.
 void delete(Key key)
          Deletes the entity in the dataset with Key key.
 E get(Key key)
          Return the entity stored in the dataset at the row specified with Key key.
 long increment(Key key, String fieldName, long amount)
          Increment a field named fieldName on the entity by the specified amount.
 boolean put(E entity)
          Put the entity into the dataset.
 
Methods inherited from interface org.kitesdk.data.Dataset
dropPartition, getDescriptor, getName, getPartition, getPartitions, getUri
 
Methods inherited from interface org.kitesdk.data.RefinableView
from, fromAfter, to, toBefore, with
 
Methods inherited from interface org.kitesdk.data.View
deleteAll, getDataset, getType, includes, isEmpty, newReader, newWriter
 

Method Detail

get

E get(Key key)
Return the entity stored in the dataset at the row specified with Key key. Return null if no such entity exists.

Parameters:
key - The key of the entity to get
Returns:
The entity of type E, or null if one is not found

put

boolean put(E entity)
Put the entity into the dataset.

Parameters:
entity - The entity to store
Returns:
True if the put succeeded, false if the put failed due to an update conflict

increment

long increment(Key key,
               String fieldName,
               long amount)
Increment a field named fieldName on the entity by the specified amount.

Parameters:
key - The key of the entity to increment
fieldName - The name of the field on the entity to increment. If the fieldName doesn't exist, an exception is thrown.
amount - The amount to increment the field by
Returns:
The new field amount.

delete

void delete(Key key)
Deletes the entity in the dataset with Key key.

Parameters:
key - The key of the entity to delete.

delete

boolean delete(E entity)
Deletes the entity passed to this method in the dataset. If that entity has a checkConflict field, then the delete is performed only if the entity in the dataset has the same value as the one in the passed entity object. .

Parameters:
entity - The entity, whose checkConflict field can be validated before the delete is performed
Returns:
True if the delete succeeded, false if the delete failed due to an update conflict


Copyright © 2013–2014. All rights reserved.