Package org.apache.blur.thrift.generated.Blur

Examples of org.apache.blur.thrift.generated.Blur.Iface


    if (indexQuery.hasLimit()) {
      blurQuery.setFetch(indexQuery.getLimit());
    }

    String tableName = getTableName(store);
    Iface client = getClient();
    try {
      BlurResults results = client.query(tableName, blurQuery);
      List<String> rowIds = new ArrayList<String>();
      for (BlurResult result : results.getResults()) {
        FetchResult fetchResult = result.getFetchResult();
        FetchRowResult rowResult = fetchResult.getRowResult();
        String id = rowResult.getRow().getId();
View Full Code Here


  }

  @Override
  public void clearStorage() throws StorageException {
    LOG.info("Clearing storage");
    Iface client = getClient();
    try {
      List<String> tableList = client.tableList();
      for (String table : tableList) {
        if (table.startsWith(_tableNamePrefix)) {
          LOG.info("Clearing store table [" + table + "]");
          TableDescriptor describe = client.describe(table);
          LOG.info("Disabling table [" + table + "]");
          client.disableTable(table);
          LOG.info("Removing table [" + table + "]");
          client.removeTable(table, true);
          LOG.info("Creating table [" + table + "]");
          client.createTable(describe);
        }
      }
    } catch (BlurException e) {
      throw new PermanentStorageException("Unknown error while trying to clear storage.", e);
    } catch (TException e) {
View Full Code Here

  @Override
  public void register(String store, String key, Class<?> dataType, TransactionHandle tx) throws StorageException {
    LOG.info("Registering key [" + key + "] with dataType [" + dataType + "] in store [" + store + "]");
    String tableName = getTableName(store);
    Iface client = getClient();
    String family = getFamily(store);
    try {
      createTableIfMissing(tableName, client);
      if (dataType.equals(Integer.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "int", null));
      } else if (dataType.equals(Long.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "long", null));
      } else if (dataType.equals(Double.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "double", null));
      } else if (dataType.equals(Float.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "float", null));
      } else if (dataType.equals(Geoshape.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "geo-pointvector", null));
      } else if (dataType.equals(String.class)) {
        client.addColumnDefinition(tableName, new ColumnDefinition(family, key, null, false, "text", null));
      } else {
        throw new IllegalArgumentException("Unsupported type: " + dataType);
      }
    } catch (BlurException e) {
      LOG.error("Unknown error while trying to registered new type. Store [" + store + "] Key [" + key + "] dateType ["
View Full Code Here

    final TraceStorage traceStorage = setupTraceStorage(configuration);
    Trace.setStorage(traceStorage);
    Trace.setNodeName(nodeName);

    Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, shardServer, true);
    iface = BlurUtil.recordMethodCallsAndAverageTimes(iface, Iface.class, false);
    iface = BlurUtil.runWithUser(iface, false);
    iface = BlurUtil.runTrace(iface, false);
    iface = BlurUtil.lastChanceErrorHandling(iface, Iface.class);
    if (httpServer != null) {
View Full Code Here

    miniCluster.startZooKeeper("./tmp/zk");
    miniCluster.startControllers(1, false);
    miniCluster.startShards(1, false);

    try {
      Iface client = BlurClient.getClient(miniCluster.getControllerConnectionStr());
      miniCluster.createTable("test", client);
      long start = System.nanoTime();
      for (int i = 0; i < 1000; i++) {
        long now = System.nanoTime();
        if (start + 5000000000L < now) {
View Full Code Here

    }
  }

  private void waitForSafeModeToExit() throws BlurException, TException {
    String controllerConnectionStr = getControllerConnectionStr();
    Iface client = BlurClient.getClient(controllerConnectionStr);
    String clusterName = "default";
    boolean inSafeMode;
    boolean isNoLonger = false;
    do {
      inSafeMode = client.isInSafeMode(clusterName);
      if (!inSafeMode) {
        if (isNoLonger) {
          System.out.println("Cluster " + cluster + " is no longer in safemode.");
        } else {
          System.out.println("Cluster " + cluster + " is not in safemode.");
View Full Code Here

    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setShardCount(1);
    tableDescriptor.setTableUri(tableUri);
    tableDescriptor.setName(tableName);

    Iface client = getClient();
    client.createTable(tableDescriptor);

    BlurOutputFormat.setupJob(job, tableDescriptor);
    Path tablePath = new Path(tableUri);
    Path shardPath = new Path(tablePath, BlurUtil.getShardName(0));
    FileStatus[] listStatus = fileSystem.listStatus(shardPath);
    assertEquals(3, listStatus.length);
    System.out.println("======" + listStatus.length);
    for (FileStatus fileStatus : listStatus) {
      System.out.println(fileStatus.getPath());
    }

    assertTrue(job.waitForCompletion(true));
    Counters ctrs = job.getCounters();
    System.out.println("Counters: " + ctrs);

    while (true) {
      TableStats tableStats = client.tableStats(tableName);
      System.out.println(tableStats);
      if (tableStats.getRowCount() > 0) {
        break;
      }
      Thread.sleep(5000);
View Full Code Here

  @Before
  public void ensureCleanTables() throws Exception {
    setupConfigIfNeeded();

    Iface client = BlurClient.getClient(Config.getConnectionString());
    List<String> tableList = client.tableList();
    if (!tableList.isEmpty()) {
      for (String table : tableList) {
        client.disableTable(table);
        client.removeTable(table, true);
      }
    }
  }
View Full Code Here

  }

  @SuppressWarnings({"unchecked", "rawtypes"})
  @Test
  public void testGetTableSummaries() throws Exception {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    TableDescriptor td = new TableDescriptor();
    td.setShardCount(11);
    td.setTableUri("file://" + TABLE_PATH + "/tableUnitTable");
    td.setCluster("default");
    td.setName("tableUnitTable");
    td.setEnabled(true);
    client.createTable(td);

    Map<String, List> data = TableUtil.getTableSummaries();

    assertEquals(1, data.get("tables").size());
    assertEquals(0l, ((Map<String, Object>) data.get("tables").get(0)).get("rows"));
View Full Code Here

public class QueryUtilTest extends ConsoleTestBase {
  @Before
  public void setup() throws Exception {
    setupConfigIfNeeded();

    Iface client = BlurClient.getClient(Config.getConnectionString());

    if (!client.tableList().contains("queryUnitTable")) {
      TableDescriptor td = new TableDescriptor();
      td.setShardCount(11);
      td.setTableUri("file://" + TABLE_PATH + "/queryUnitTable");
      td.setCluster("default");
      td.setName("queryUnitTable");
      td.setEnabled(true);
      client.createTable(td);

      Record record = new Record("abcd", "fam0", Arrays.asList(new Column[]{new Column("col0", "testvalue")}));
      RecordMutation recordMutation = new RecordMutation(RecordMutationType.REPLACE_ENTIRE_RECORD, record);
      RowMutation rowMutation = new RowMutation("queryUnitTable", "12345", RowMutationType.REPLACE_ROW, Arrays.asList(new RecordMutation[]{recordMutation}));
      client.mutate(rowMutation);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.blur.thrift.generated.Blur.Iface

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.