com.bigdata.relation
Interface IMutableRelation<E>

Type Parameters:
E - The generic type of the [E]lements of the relation.
All Superinterfaces:
ILocatableResource<IRelation<E>>, IMutableResource<IRelation<E>>, IRelation<E>
All Known Implementing Classes:
AbstractRelation, FullTextIndex, LexiconRelation, MagicRelation, SPORelation

public interface IMutableRelation<E>
extends IRelation<E>, IMutableResource<IRelation<E>>

A mutable IRelation. The relation must maintain any secondary indices under mutation.

The methods declared by this interface return a "mutation count" - the mutation count MUST be exact and MUST NOT count overwrites that do not change the state of the tuple (the same key and value). The mutation counts are used to determine the fixed point for closure of a rule set. If they do not follow this contract then the closure operation will not terminate!

If fact, it is MUCH more efficient if an implementation avoids the overwrite of an element with identical data. All index writes (including overwrites) add data to the AbstractJournal backing the mutable BTree absorbing writes for an index. An "overwrite" thus incurs more IO and will trigger overflow for the journal earlier than if overwrite were avoided. In contrast, while you have a lock on the mutable index you can test for a pre-existing key and compare the serialized byte[] values with relatively little cost (zero additional IO).

Version:
$Id: IMutableRelation.java 2265 2009-10-26 12:51:06Z thompsonbry $
Author:
Bryan Thompson

Method Summary
 long delete(IChunkedOrderedIterator<E> itr)
          Remove elements from the relation.
 long insert(IChunkedOrderedIterator<E> itr)
          Write elements on the relation.
 
Methods inherited from interface com.bigdata.relation.IRelation
getAccessPath, getElementClass, getExecutorService, getIndexManager, getIndexNames, newElement
 
Methods inherited from interface com.bigdata.relation.IMutableResource
create, destroy
 
Methods inherited from interface com.bigdata.relation.locator.ILocatableResource
getContainerNamespace, getNamespace, getTimestamp
 

Method Detail

insert

long insert(IChunkedOrderedIterator<E> itr)
Write elements on the relation.

Parameters:
itr - An iterator visiting the elements to be written.
Returns:
The #of elements that were actually written on the relation.

delete

long delete(IChunkedOrderedIterator<E> itr)
Remove elements from the relation.

Parameters:
itr - An iterator visiting the elements to be removed. Existing elements in the relation having a key equal to the key formed from the visited elements will be removed from the relation.
Returns:
The #of elements that were actually removed from the relation.


Copyright © 2006-2009 SYSTAP, LLC. All Rights Reserved.