[ 
https://issues.apache.org/jira/browse/STORM-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15040766#comment-15040766
 ] 

ASF GitHub Bot commented on STORM-1211:
---------------------------------------

Github user satishd commented on a diff in the pull request:

    https://github.com/apache/storm/pull/915#discussion_r46651795
  
    --- Diff: 
external/storm-cassandra/src/main/java/org/apache/storm/cassandra/trident/state/CassandraState.java
 ---
    @@ -0,0 +1,154 @@
    +/**
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + * http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package org.apache.storm.cassandra.trident.state;
    +
    +import backtype.storm.task.IMetricsContext;
    +import backtype.storm.topology.FailedException;
    +import backtype.storm.tuple.Values;
    +import com.datastax.driver.core.BatchStatement;
    +import com.datastax.driver.core.Session;
    +import com.datastax.driver.core.Statement;
    +import com.google.common.base.Preconditions;
    +import org.apache.storm.cassandra.client.SimpleClient;
    +import org.apache.storm.cassandra.client.SimpleClientProvider;
    +import org.apache.storm.cassandra.query.CQLResultSetValuesMapper;
    +import org.apache.storm.cassandra.query.CQLStatementTupleMapper;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +import storm.trident.operation.TridentCollector;
    +import storm.trident.state.State;
    +import storm.trident.tuple.TridentTuple;
    +
    +import java.io.Serializable;
    +import java.util.ArrayList;
    +import java.util.List;
    +import java.util.Map;
    +
    +/**
    + *
    + */
    +public class CassandraState implements State {
    +
    +    private static final Logger LOG = 
LoggerFactory.getLogger(CassandraState.class);
    +
    +    private final Map conf;
    +    private final Options options;
    +
    +    private Session session;
    +    private SimpleClient client;
    +
    +    public CassandraState(Map conf, IMetricsContext metrics, int 
partitionIndex, int numPartitions, Options options) {
    +        this.conf = conf;
    +        this.options = options;
    +    }
    +
    +    public static final class Options implements Serializable {
    +        private final SimpleClientProvider clientProvider;
    +        private CQLStatementTupleMapper cqlStatementTupleMapper;
    +        private CQLResultSetValuesMapper cqlResultSetValuesMapper;
    +        private BatchStatement.Type batchingType = 
BatchStatement.Type.LOGGED;
    +
    +
    +        public Options(SimpleClientProvider clientProvider) {
    +            this.clientProvider = clientProvider;
    +        }
    +
    +        public Options withCQLStatementTupleMapper(CQLStatementTupleMapper 
cqlStatementTupleMapper) {
    +            this.cqlStatementTupleMapper = cqlStatementTupleMapper;
    +            return this;
    +        }
    +
    +        public Options 
withCQLResultSetValuesMapper(CQLResultSetValuesMapper cqlResultSetValuesMapper) 
{
    +            this.cqlResultSetValuesMapper = cqlResultSetValuesMapper;
    +            return this;
    +        }
    +
    +        public Options withBatching(BatchStatement.Type batchingType) {
    +            this.batchingType = batchingType;
    +            return this;
    +        }
    +
    +    }
    +
    +    @Override
    +    public void beginCommit(Long txid) {
    +        LOG.debug("beginCommit is noop");
    +    }
    +
    +    @Override
    +    public void commit(Long txid) {
    +        LOG.debug("commit is noop");
    --- End diff --
    
    It seems storm.trident.state.map.TransactionalMap provides the semantics.  
IBackingMap implementation can be wrapped into that. HBase and Redis use these 
APIs for having transactional semantics.


> Add trident state and query support for cassandra connector
> -----------------------------------------------------------
>
>                 Key: STORM-1211
>                 URL: https://issues.apache.org/jira/browse/STORM-1211
>             Project: Apache Storm
>          Issue Type: Improvement
>            Reporter: Satish Duggana
>            Assignee: Satish Duggana
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to