Package com.alibaba.wasp.plan.action

Examples of com.alibaba.wasp.plan.action.InsertAction


    String tableName = "test";
    String primary = "1234";
    String familyName = "info";
    String columnName = "col";
    String value = "8899";
    InsertAction action = new InsertAction(tableName, Bytes.toBytes(primary));
    action.addEntityColumn(tableName, familyName, columnName, DataType.STRING,
        Bytes.toBytes(value));
    MessageProto message = ProtobufUtil.convertInsertAction(action);
    action = (InsertAction) ProtobufUtil.convertWriteAction(message);
    Assert.assertTrue(tableName.equals(action.getFTableName()));
    Assert.assertTrue(primary.equals(Bytes.toString(action.getCombinedPrimaryKey())));
    Assert.assertTrue(action.getColumns().get(0).getFamilyName()
        .equals(familyName)
        && action.getColumns().get(0).getColumnName().equals(columnName)
        && Bytes.toString(action.getColumns().get(0).getValue()).equals(value));
  }
View Full Code Here


      FTable table, LinkedHashSet<String> insertColumns, ValuesClause values)
      throws IOException {
    Pair<List<Pair<String, byte[]>>, List<ColumnStruct>> pair = buildFieldsPair(
        metaEventOperation, table, insertColumns, values);
    byte[] primaryKey = RowBuilder.build().genRowkey(pair.getFirst());
    return new InsertAction(table.getTableName(), pair.getFirst().get(0)
        .getSecond(), primaryKey, pair.getSecond());
  }
View Full Code Here

    entityGroups.add(entityGroup3);

    List<Action> actions1 = new ArrayList<Action>();
    List<Action> actions2 = new ArrayList<Action>();
    List<Action> actions3 = new ArrayList<Action>();
    Action action1 = new InsertAction("testtable1", Bytes.toBytes("PK1"));
    Action action2 = new InsertAction("testtable2", Bytes.toBytes("PK2"));
    Action action3 = new InsertAction("testtable3", Bytes.toBytes("PK3"));
    actions1.add(action1);
    actions2.add(action2);
    actions3.add(action3);

    Map<EntityGroupInfo, List<Action>> transcation = new HashMap<EntityGroupInfo, List<Action>>();
View Full Code Here

    this.entityGroup = initEntityGroup(tableName, method, conf, fileds);

    PublisherBuilder builder = new PublisherBuilder();
    Publisher publisher = builder.build(conf, entityGroup.getEntityGroupInfo());

    Message message = new InsertAction("testtable", Bytes.toBytes("PK"));

    MessageID mId = publisher.doAsynchronous(message);

    assertTrue(mId != null);
View Full Code Here

    PublisherBuilder builder = new PublisherBuilder();
    Publisher publisher1 = builder.build(conf, entityGroup1.getEntityGroupInfo());
    Publisher publisher2 = builder.build(conf, entityGroup2.getEntityGroupInfo());
    Publisher publisher3 = builder.build(conf, entityGroup3.getEntityGroupInfo());

    Message message1 = new InsertAction("testtable1", Bytes.toBytes("PK1"));
    Message message2 = new InsertAction("testtable2", Bytes.toBytes("PK2"));
    Message message3 = new InsertAction("testtable3", Bytes.toBytes("PK3"));

    publisher1.doAsynchronous(message1);
    publisher2.doAsynchronous(message2);
    publisher3.doAsynchronous(message3);
  }
View Full Code Here

  @Override
  public List<ClientProtos.WriteResultProto> execInsertPlan(InsertPlan plan)
      throws ServiceException {
    List<ClientProtos.WriteResultProto> writeResultProtos = new ArrayList<ClientProtos.WriteResultProto>();
    List<InsertAction> actions = plan.getActions();
    InsertAction action = actions.get(0);
    EntityGroupInfo entityGroupInfo = action.getEntityGroupLocation()
        .getEntityGroupInfo();
    ServerName serverName = new ServerName(action.getEntityGroupLocation()
        .getHostname(), action.getEntityGroupLocation().getPort(),
        ServerName.NON_STARTCODE);
    // if actions > 1. will commit by 2pc
    if (actions.size() == 1) {
      try {
View Full Code Here

TOP

Related Classes of com.alibaba.wasp.plan.action.InsertAction

Copyright © 2018 www.massapicom. 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.