me.prettyprint.hector.api.Serializer Java Examples

The following examples show how to use me.prettyprint.hector.api.Serializer. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecondaryIndexDeletionBuffer.java    From cumulusrdf with Apache License 2.0 6 votes vote down vote up
/**
 * Flushes the buffer.
 * 
 * @param mutator The mutator to fill with deletions.
 * @param columnFamilyName The column family (name) to delete from.
 * @param column The column to delete from.
 * @param serializer The serializer to use for the column.
 * @param dao the rdf index data access object.
 * @param <T> The type of the column key.
 * @return True if the buffer was flushed and at least one element was checked for deletion, false otherwise.
 * @throws DataAccessLayerException in case of data access failure.
 */
<T> boolean flush(
		final Mutator<byte[]> mutator, 
		final String columnFamilyName, 
		final T column, 
		final Serializer<T> serializer,
		final TripleIndexDAO dao) throws DataAccessLayerException {
	if (_candidates.size() == 0) {
		return false;
	}
	
	for (SecondaryIndexDeletionCandidate candidate : _candidates) {
		if (!dao.query(candidate.getQuery(), 1).hasNext()) {
			mutator.addDeletion(candidate.getRow(), columnFamilyName, column, serializer);
		}
	}
	
	return true;
}
 
Example #2
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <SN> Mutator<K> addSuperDelete( final K key, final String cf, final SN sColumnName,
                                       final Serializer<SN> sNameSerializer ) {
    target.addSuperDelete( key, cf, sColumnName, sNameSerializer );
    checkAndFlush();
    return this;
}
 
Example #3
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <N> Mutator<K> addCounterDeletion( final K key, final String cf, final N counterColumnName,
                                          final Serializer<N> nameSerializer ) {
    target.addCounterDeletion( key, cf, counterColumnName, nameSerializer );
    checkAndFlush();
    return this;
}
 
Example #4
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <SN, N> Mutator<K> addSubDelete( final K key, final String cf, final SN sColumnName, final N columnName,
                                        final Serializer<SN> sNameSerializer, final Serializer<N> nameSerialer,
                                        final long clock ) {
    target.addSubDelete( key, cf, sColumnName, columnName, sNameSerializer, nameSerialer, clock );
    checkAndFlush();
    return this;
}
 
Example #5
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <SN, N> Mutator<K> addSubDelete( final K key, final String cf, final SN sColumnName, final N columnName,
                                        final Serializer<SN> sNameSerializer, final Serializer<N> nameSerialer ) {
    target.addSubDelete( key, cf, sColumnName, columnName, sNameSerializer, nameSerialer );
    checkAndFlush();
    return this;
}
 
Example #6
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <N> Mutator<K> addDeletion( final K key, final String cf, final N columnName,
                                   final Serializer<N> nameSerializer, final long clock ) {
    target.addDeletion( key, cf, columnName, nameSerializer, clock );
    checkAndFlush();
    return this;
}
 
Example #7
Source File: CountingMutator.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public <N> Mutator<K> addDeletion( final K key, final String cf, final N columnName,
                                   final Serializer<N> nameSerializer ) {
    target.addDeletion( key, cf, columnName, nameSerializer );
    checkAndFlush();
    return this;
}
 
Example #8
Source File: SecondaryIndexDeletionBuffer.java    From cumulusrdf with Apache License 2.0 5 votes vote down vote up
/**
 * Flushes the buffer if it is full.
 * 
 * @param mutator The mutator to fill with deletions.
 * @param columnFamilyName The column (name) family to delete from.
 * @param column The column to delete from.
 * @param serializer The serializer to use for the column.
 * @param dao the rdf index data access object.
 * @param <T> The type of the column key.
 * @return True if the buffer was flushed and at least one element was checked for deletion, false otherwise.
 * @throws DataAccessLayerException in case of data access failure.
 */
<T> boolean flushIfFull(
		final Mutator<byte[]> mutator, 
		final String columnFamilyName, 
		final T column, 
		final Serializer<T> serializer,
		final TripleIndexDAO dao) throws DataAccessLayerException {
	if (_candidates.size() >= _capacity) {
		return flush(mutator, columnFamilyName, column, serializer, dao);
	} else {
		return false;
	}
}
 
Example #9
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <SN> MutationResult superDelete( final K key, final String cf, final SN supercolumnName,
                                        final Serializer<SN> sNameSerializer ) {
    return target.superDelete( key, cf, supercolumnName, sNameSerializer );
}
 
Example #10
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <SN, N> MutationResult subDelete( final K key, final String cf, final SN supercolumnName, final N columnName,
                                         final Serializer<SN> sNameSerializer,
                                         final Serializer<N> nameSerializer ) {
    return target.subDelete( key, cf, supercolumnName, columnName, sNameSerializer, nameSerializer );
}
 
Example #11
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <N> MutationResult delete( final K key, final String cf, final N columnName,
                                  final Serializer<N> nameSerializer, final long clock ) {
    return target.delete( key, cf, columnName, nameSerializer, clock );
}
 
Example #12
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <N> MutationResult delete( final K key, final String cf, final N columnName,
                                  final Serializer<N> nameSerializer ) {
    return target.delete( key, cf, columnName, nameSerializer );
}
 
Example #13
Source File: Count.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public Serializer<C> getColumnNameSerializer() {
    return columnNameSerializer;
}
 
Example #14
Source File: Count.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public Serializer<K> getKeySerializer() {
    return keySerializer;
}
 
Example #15
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <N> MutationResult deleteCounter( final K key, final String cf, final N columnName,
                                         final Serializer<N> nameSerializer ) {
    return target.deleteCounter( key, cf, columnName, nameSerializer );
}
 
Example #16
Source File: CountingMutator.java    From usergrid with Apache License 2.0 4 votes vote down vote up
@Override
public <SN, N> MutationResult subDeleteCounter( final K key, final String cf, final SN supercolumnName,
                                                final N columnName, final Serializer<SN> sNameSerializer,
                                                final Serializer<N> nameSerializer ) {
    return target.subDeleteCounter( key, cf, supercolumnName, columnName, sNameSerializer, nameSerializer );
}
 
Example #17
Source File: Utils.java    From cumulusrdf with Apache License 2.0 2 votes vote down vote up
/**
 * Returns the {@link Serializer} associated with a given class.
 * 
 * @param clazz the class.
 * @param <T> the class kind.
 * @return the {@link Serializer} associated with a given class.
 */
public static <T> Serializer<T> guessSerializer(final Class<T> clazz) {
	return SerializerTypeInferer.getSerializer(clazz);
}
 
Example #18
Source File: CountingMutator.java    From usergrid with Apache License 2.0 2 votes vote down vote up
/**
 * Create a mutator that will flush when the maximum size is reached
 * @param keyspace
 * @param keySerializer
 * @param <K>
 * @return
 */
public static <K> CountingMutator<K> createFlushingMutator( Keyspace keyspace, Serializer<K> keySerializer ) {
    Mutator<K> target = HFactory.createMutator( keyspace, keySerializer );

    return new CountingMutator<K>( target, MAX_SIZE );
}