Examples of Iface


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

  }

  @Test
  public void testTestShardFailover() throws BlurException, TException, InterruptedException, IOException,
      KeeperException {
    Iface client = getClient();
    int length = 100;
    BlurQuery blurQuery = new BlurQuery();
    blurQuery.setUseCacheIfPresent(false);
    Query query = new Query();
    query.setQuery("test.test:value");
    blurQuery.setQuery(query);
    BlurResults results1 = client.query("test", blurQuery);
    assertEquals(length, results1.getTotalResults());
    assertRowResults(results1);

    MiniCluster.killShardServer(1);

    // make sure the WAL syncs
    Thread.sleep(TimeUnit.SECONDS.toMillis(1));

    // This should block until shards have failed over
    client.shardServerLayout("test");

    assertEquals(length, client.query("test", blurQuery).getTotalResults());

  }
View Full Code Here

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

  }

  @Test
  public void testTermsList() throws BlurException, TException {
    Iface client = getClient();
    List<String> terms = client.terms("test", "test", "test", null, (short) 10);
    List<String> list = new ArrayList<String>();
    list.add("value");
    assertEquals(list, terms);
  }
View Full Code Here

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

    }
  }

  @Test
  public void testCreateDisableAndRemoveTable() throws IOException, BlurException, TException {
    Iface client = getClient();
    String tableName = UUID.randomUUID().toString();
    TableDescriptor tableDescriptor = new TableDescriptor();
    tableDescriptor.setName(tableName);
    tableDescriptor.setShardCount(5);
    tableDescriptor.setTableUri(MiniCluster.getFileSystemUri().toString() + "/blur/" + tableName);

    for (int i = 0; i < 3; i++) {
      client.createTable(tableDescriptor);
      client.disableTable(tableName);
      client.removeTable(tableName, true);
    }

    assertFalse(client.tableList().contains(tableName));

  }
View Full Code Here

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

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

    Iface iface = BlurUtil.wrapFilteredBlurServer(configuration, controllerServer, false);
    iface = BlurUtil.recordMethodCallsAndAverageTimes(iface, Iface.class, true);
    iface = BlurUtil.runWithUser(iface, true);
    iface = BlurUtil.runTrace(iface, true);
    iface = BlurUtil.lastChanceErrorHandling(iface, Iface.class);
    int threadCount = configuration.getInt(BLUR_CONTROLLER_SERVER_THRIFT_THREAD_COUNT, 32);
View Full Code Here

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

  }

  @SuppressWarnings({"unchecked", "rawtypes"})
  private static Map<String, Object> searchAndFetch(String table, String query, String rowQuery, String start, String fetch, String[] families, String remoteHost, String securityUser) throws IOException, TException {
    try {
      Iface client = Config.getClient(remoteHost, securityUser);

      boolean recordsOnly = RECORD_RECORD_OPTION.equalsIgnoreCase(rowQuery);

      BlurQuery blurQuery = new BlurQuery();

      Query q = new Query(query, ROW_ROW_OPTION.equalsIgnoreCase(rowQuery), ScoreType.SUPER, null, null);
      blurQuery.setQuery(q);
      blurQuery.setStart(Long.parseLong(start));
      blurQuery.setFetch(Integer.parseInt(fetch));
      blurQuery.setUserContext(remoteHost);

      Selector s = new Selector();
      s.setRecordOnly(recordsOnly);
      s.setColumnFamiliesToFetch(new HashSet<String>(Arrays.asList(families)));
      blurQuery.setSelector(s);

      BlurResults blurResults = client.query(table, blurQuery);

      Map<String, Object> results = new HashMap<String, Object>();
      results.put(TOTAL_KEY, blurResults.getTotalResults());

      Map<String, List> rows = new HashMap<String, List>();
View Full Code Here

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

    }
  }

  private static Map<String, Object> fullTextSearch(String table, String query, String remoteHost, String securityUser) throws IOException, TException {
    try {
      Iface client = Config.getClient(remoteHost, securityUser);

      BlurQuery blurQuery = new BlurQuery();

      Query q = new Query(query, true, ScoreType.SUPER, null, null);
      blurQuery.setQuery(q);
      blurQuery.setUserContext(remoteHost);
      BlurResults blurResults = client.query(table, blurQuery);

      Map<String, Object> results = new HashMap<String, Object>();
      results.put(TOTAL_KEY, blurResults.getTotalResults());
      return results;
    } finally {
View Full Code Here

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

  }

  @SuppressWarnings({"unchecked", "rawtypes"})
  private static Map<String, Object> fetchRow(String table, String query, String[] families, String remoteHost, String securityUser) throws IOException, TException {
    try {
      Iface client = Config.getClient(remoteHost, securityUser);

      Selector selector = new Selector();
      String rowid = StringUtils.remove(query, "rowid:");
      selector.setRowId(rowid);
      selector.setColumnFamiliesToFetch(new HashSet<String>(Arrays.asList(families)));

      FetchResult fetchRow = client.fetchRow(table, selector);

      Map<String, Object> results = new HashMap<String, Object>();
      results.put(TOTAL_KEY, fetchRow.getRowResult().getRow() == null ? 0 : 1);

      Map<String, List> rows = new HashMap<String, List>();
View Full Code Here

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

public class TableUtil {

  @SuppressWarnings("rawtypes")
  public static Map<String, List> getTableSummaries() throws IOException, TException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    List<Map<String, Object>> summaries = new ArrayList<Map<String, Object>>();

    List<String> clusters = client.shardClusterList();

    for (String cluster : clusters) {
      List<String> tables = client.tableListByCluster(cluster);
      for (String table : tables) {
        Map<String, Object> tableInfo = new HashMap<String, Object>();
        TableDescriptor descriptor = client.describe(table);

        tableInfo.put("cluster", cluster);
        tableInfo.put("name", table);
        tableInfo.put("enabled", descriptor.isEnabled());

        if (descriptor.isEnabled()) {
          TableStats stats = client.tableStats(table);
          tableInfo.put("rows", stats.getRowCount());
          tableInfo.put("records", stats.getRecordCount());

          Schema schema = client.schema(table);
          tableInfo.put("families", new ArrayList<String>(schema.getFamilies().keySet()));
        } else {
          tableInfo.put("rows", "?");
          tableInfo.put("records", "?");
          tableInfo.put("families", new ArrayList<String>());
View Full Code Here

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

    return data;
  }

  public static Map<String, Map<String, Map<String, Object>>> getSchema(String table) throws IOException, TException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    Schema schema = client.schema(table);

    Map<String, Map<String, Map<String, Object>>> schemaInfo = new TreeMap<String, Map<String, Map<String, Object>>>();
    for (Map.Entry<String, Map<String, ColumnDefinition>> famEntry : schema.getFamilies().entrySet()) {
      Map<String, Map<String, Object>> columns = new TreeMap<String, Map<String, Object>>();
      for (Map.Entry<String, ColumnDefinition> colEntry : famEntry.getValue().entrySet()) {
View Full Code Here

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

    return schemaInfo;
  }

  public static List<String> getTerms(String table, String family, String column, String startWith) throws IOException, TException {
    Iface client = BlurClient.getClient(Config.getConnectionString());

    return client.terms(table, family, column, startWith, (short) 10);
  }
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.