Examples of DynamicComposite


Examples of me.prettyprint.hector.api.beans.DynamicComposite

    private Mutator<String> indexMutator() {
        return HFactory.createMutator(keyspace, STRING_SERIALIZER);
    }

    private void insertEntryColumn(K itemKey, long timestamp, List<IndexValue<?>> indexValues, Mutator<DynamicComposite> entryMutator) {
        DynamicComposite entryValue = new DynamicComposite();
        IndexValue.addAll(indexValues, entryValue);
        final HColumn<Long, DynamicComposite> entryColumn = HFactory.createColumn(timestamp, entryValue, LONG_SERIALIZER, DYNAMIC_COMPOSITE_SERIALIZER);
        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        final HColumn<Long, DynamicComposite> entryColumn = HFactory.createColumn(timestamp, entryValue, LONG_SERIALIZER, DYNAMIC_COMPOSITE_SERIALIZER);
        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }

    private void insertIndexColumn(K itemKey, long timestamp, List<IndexValue<?>> indexValues, Mutator<String> indexMutator) {
        DynamicComposite indexColumnName = new DynamicComposite();
        IndexValue.addAll(indexValues, indexColumnName);
        indexColumnName.addComponent(itemKey, keySerializer);
        indexColumnName.addComponent(timestamp, LONG_SERIALIZER);
        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }

    private void performCleanup(K key, Mutator<String> indexMutator, Mutator<DynamicComposite> entryMutator) {
        final DynamicComposite entryKey = entryKey(key);
        final List<HColumn<Long, DynamicComposite>> entries = getEntries(entryKey);
        for (HColumn<Long, DynamicComposite> entry : entries) {
            final Long entryTimestamp = entry.getName();

            DynamicComposite indexColumnName = new DynamicComposite();
            appendComponents(entry.getValue(), indexColumnName);
            indexColumnName.addComponent(key, keySerializer);
            indexColumnName.addComponent(entryTimestamp, LONG_SERIALIZER);

            indexMutator.addDeletion(indexName, indexColumnFamily, indexColumnName, DYNAMIC_COMPOSITE_SERIALIZER);
            entryMutator.addDeletion(entryKey, entryColumnFamily, entryTimestamp, LONG_SERIALIZER);
        }
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

            entryMutator.addDeletion(entryKey, entryColumnFamily, entryTimestamp, LONG_SERIALIZER);
        }
    }

    private DynamicComposite entryKey(K itemKey) {
        DynamicComposite entryKey = new DynamicComposite();
        entryKey.addComponent(itemKey, keySerializer);
        entryKey.addComponent(indexName, STRING_SERIALIZER);
        return entryKey;
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        assemblyStack.push(value);
    }

    @Override
    public void initializeFromColumn(byte[] columnValue, ClassResolver classResolver) {
        DynamicComposite dynamicComposite = DynamicCompositeSerializer.get().fromBytes(columnValue);
        this.value = dynamicComposite.get(0);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        this.value = dynamicComposite.get(0);
    }

    @Override
    public ColumnValueDefinition<?> toColumnDefinition() {
        final DynamicComposite dynamicComposite = new DynamicComposite();
        dynamicComposite.addComponent(value, CassidyUtils.inferSerializer(value));
        return new ColumnValueDefinition<>(dynamicComposite, DynamicCompositeSerializer.get());
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

    }

    @Override
    @SuppressWarnings("unchecked")
    public List<K> find(Object... values) {
        DynamicComposite start = new DynamicComposite();
        DynamicComposite end = new DynamicComposite();
        for (int i = 0; i < values.length; i++) {
            Object value = values[i];
            Serializer<Object> serializer = CassidyUtils.inferSerializer(value);
            if(value == null) {
                value = NULL_VALUE;
                serializer = (Serializer<Object>)NULL_VALUE_SERIALIZER;
            }
            final String comparator = serializer.getComparatorType().getTypeName();
            start.addComponent(value, serializer, comparator, AbstractComposite.ComponentEquality.EQUAL);
            end.addComponent(value, serializer, comparator, i == values.length - 1 ? AbstractComposite.ComponentEquality.GREATER_THAN_EQUAL : AbstractComposite.ComponentEquality.EQUAL);
        }
        LOGGER.debug("Searching for '{}' index columns with names between {} and {}...", indexName, start, end);
        final SliceQuery<String, DynamicComposite, K> query = HFactory.createSliceQuery(keyspace, StringSerializer.get(), DynamicCompositeSerializer.get(), keySerializer);
        query.setKey(indexName);
        query.setColumnFamily(indexColumnFamily);
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

    private Mutator<String> indexMutator() {
        return HFactory.createMutator(keyspace, STRING_SERIALIZER);
    }

    private void insertEntryColumn(K itemKey, long timestamp, List<IndexValue<?>> indexValues, Mutator<DynamicComposite> entryMutator) {
        DynamicComposite entryValue = new DynamicComposite();
        IndexValue.addAll(indexValues, entryValue);
        final HColumn<Long, DynamicComposite> entryColumn = HFactory.createColumn(timestamp, entryValue, LONG_SERIALIZER, DYNAMIC_COMPOSITE_SERIALIZER);
        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        entryMutator.addInsertion(entryKey(itemKey), entryColumnFamily, entryColumn);
    }

    private void insertIndexColumn(K itemKey, long timestamp, List<IndexValue<?>> indexValues, Mutator<String> indexMutator) {
        LOGGER.debug("Indexing key {} with values {}...", itemKey, indexValues);
        DynamicComposite indexColumnName = new DynamicComposite();
        IndexValue.addAll(indexValues, indexColumnName);
        indexColumnName.addComponent(itemKey, keySerializer);
        indexColumnName.addComponent(timestamp, LONG_SERIALIZER);
        LOGGER.debug("Creating '{}' index column with name {} and value {}...", indexName, indexColumnName, itemKey);
        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }
View Full Code Here

Examples of me.prettyprint.hector.api.beans.DynamicComposite

        final HColumn<DynamicComposite, K> indexColumn = HFactory.createColumn(indexColumnName, itemKey, DYNAMIC_COMPOSITE_SERIALIZER, keySerializer);
        indexMutator.addInsertion(indexName, indexColumnFamily, indexColumn);
    }

    private void performCleanup(K key, Mutator<String> indexMutator, Mutator<DynamicComposite> entryMutator) {
        final DynamicComposite entryKey = entryKey(key);
        final List<HColumn<Long, DynamicComposite>> entries = getEntries(entryKey);
        for (HColumn<Long, DynamicComposite> entry : entries) {
            final Long entryTimestamp = entry.getName();

            DynamicComposite indexColumnName = new DynamicComposite();
            appendComponents(entry.getValue(), indexColumnName);
            indexColumnName.addComponent(key, keySerializer);
            indexColumnName.addComponent(entryTimestamp, LONG_SERIALIZER);

            indexMutator.addDeletion(indexName, indexColumnFamily, indexColumnName, DYNAMIC_COMPOSITE_SERIALIZER);
            entryMutator.addDeletion(entryKey, entryColumnFamily, entryTimestamp, LONG_SERIALIZER);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.