maedhroz commented on code in PR #1962: URL: https://github.com/apache/cassandra/pull/1962#discussion_r1041555157
########## test/unit/org/apache/cassandra/service/accord/txn/TxnBuilder.java: ########## @@ -0,0 +1,191 @@ +/* + * 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.cassandra.service.accord.txn; + +import java.nio.ByteBuffer; +import java.util.ArrayList; +import java.util.List; +import java.util.SortedSet; +import java.util.TreeSet; + +import accord.primitives.Keys; +import com.google.common.base.Preconditions; +import com.google.common.collect.Iterables; + +import accord.api.Key; +import accord.primitives.Txn; +import org.apache.cassandra.cql3.ColumnIdentifier; +import org.apache.cassandra.cql3.QueryOptions; +import org.apache.cassandra.cql3.QueryProcessor; +import org.apache.cassandra.cql3.VariableSpecifications; +import org.apache.cassandra.cql3.statements.ModificationStatement; +import org.apache.cassandra.cql3.statements.SelectStatement; +import org.apache.cassandra.db.ReadQuery; +import org.apache.cassandra.db.SinglePartitionReadCommand; +import org.apache.cassandra.db.SinglePartitionReadQuery; +import org.apache.cassandra.db.partitions.PartitionUpdate; +import org.apache.cassandra.schema.ColumnMetadata; +import org.apache.cassandra.schema.Schema; +import org.apache.cassandra.schema.TableMetadata; +import org.apache.cassandra.service.ClientState; +import org.apache.cassandra.service.accord.api.AccordKey; + +public class TxnBuilder +{ + private final List<TxnNamedRead> reads = new ArrayList<>(); + private final List<TxnWrite.Fragment> writes = new ArrayList<>(); + private final List<TxnCondition> conditions = new ArrayList<>(); + + public static TxnBuilder builder() + { + return new TxnBuilder(); + } + + public TxnBuilder withRead(String name, String query) + { + return withRead(TxnDataName.user(name), query, VariableSpecifications.empty()); + } + + public TxnBuilder withRead(TxnDataName name, String query) + { + return withRead(name, query, VariableSpecifications.empty()); + } + + public TxnBuilder withRead(TxnDataName name, String query, VariableSpecifications bindVariables, Object... values) + { + SelectStatement.RawStatement parsed = (SelectStatement.RawStatement) QueryProcessor.parseStatement(query); Review Comment: Looks like we're just going to nix `TxnBuilder`. It's outlived its usefulness. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

