http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ErrorType.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ErrorType.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ErrorType.java index 0e5dae6..56c205e 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ErrorType.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ErrorType.java @@ -31,12 +31,14 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * The error type of a BlurException.<br/><br/> - * UNKNOWN - Unknown error.<br/><br/> - * QUERY_CANCEL - Query has been cancel.<br/><br/> - * QUERY_TIMEOUT - Query has timed out.<br/><br/> - * BACK_PRESSURE - Server has run out of memory and is trying to prevent a failure.<br/><br/> - * REQUEST_TIMEOUT - The TCP connection has timed out.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The error type of a BlurException.</td></tr> + * <tr><td>UNKNOWN</td><td>Unknown error.</td></tr> + * <tr><td>QUERY_CANCEL</td><td>Query has been cancel.</td></tr> + * <tr><td>QUERY_TIMEOUT</td><td>Query has timed out.</td></tr> + * <tr><td>BACK_PRESSURE</td><td>Server has run out of memory and is trying to prevent a failure.</td></tr> + * <tr><td>REQUEST_TIMEOUT</td><td>The TCP connection has timed out.</td></tr> + * </table> */ public enum ErrorType implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { UNKNOWN(0),
http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryState.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryState.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryState.java index 25b02bc..4b9ad48 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryState.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/QueryState.java @@ -31,10 +31,12 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * The state of a query.<br/><br/> - * RUNNING - Query is running.<br/><br/> - * INTERRUPTED - Query has been interrupted.<br/><br/> - * COMPLETE - Query is complete.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The state of a query.</td></tr> + * <tr><td>RUNNING</td><td>Query is running.</td></tr> + * <tr><td>INTERRUPTED</td><td>Query has been interrupted.</td></tr> + * <tr><td>COMPLETE</td><td>Query is complete.</td></tr> + * </table> */ public enum QueryState implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { RUNNING(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RecordMutationType.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RecordMutationType.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RecordMutationType.java index 1ea9d37..c256e6a 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RecordMutationType.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RecordMutationType.java @@ -31,11 +31,13 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * Specifies the type of Record mutation that should occur during a mutation of a given Record.<br/><br/> - * DELETE_ENTIRE_RECORD - Indicates the Record with the given recordId in the given Row is to be deleted. If the target record does not exist, then no changes are made.<br/><br/> - * REPLACE_ENTIRE_RECORD - Indicates the Record with the given recordId in the given Row is to be deleted, and a new Record with the same id is to be added. If the specified record does not exist the new record is still added.<br/><br/> - * REPLACE_COLUMNS - Replace the columns that are specified in the Record mutation. If the target record does not exist then this mutation will result in a BlurException.<br/><br/> - * APPEND_COLUMN_VALUES - Append the columns in the Record mutation to the Record that could already exist. If the target record does not exist then this mutation will result in a BlurException.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">Specifies the type of Record mutation that should occur during a mutation of a given Record.</td></tr> + * <tr><td>DELETE_ENTIRE_RECORD</td><td>Indicates the Record with the given recordId in the given Row is to be deleted. If the target record does not exist, then no changes are made.</td></tr> + * <tr><td>REPLACE_ENTIRE_RECORD</td><td>Indicates the Record with the given recordId in the given Row is to be deleted, and a new Record with the same id is to be added. If the specified record does not exist the new record is still added.</td></tr> + * <tr><td>REPLACE_COLUMNS</td><td>Replace the columns that are specified in the Record mutation. If the target record does not exist then this mutation will result in a BlurException.</td></tr> + * <tr><td>APPEND_COLUMN_VALUES</td><td>Append the columns in the Record mutation to the Record that could already exist. If the target record does not exist then this mutation will result in a BlurException.</td></tr> + * </table> */ public enum RecordMutationType implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { DELETE_ENTIRE_RECORD(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RowMutationType.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RowMutationType.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RowMutationType.java index 312232a..64ab0f9 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RowMutationType.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/RowMutationType.java @@ -31,10 +31,12 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * Specifies the type of Row mutation that should occur during a mutation of a given Row.<br/><br/> - * DELETE_ROW - Indicates that the entire Row is to be deleted. No changes are made if the specified row does not exist.<br/><br/> - * REPLACE_ROW - Indicates that the entire Row is to be deleted, and then a new Row with the same id is to be added. If the specified row does not exist, the new row will still be created.<br/><br/> - * UPDATE_ROW - Indicates that mutations of the underlying Records will be processed individually. Mutation will result in a BlurException if the specified row does not exist.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">Specifies the type of Row mutation that should occur during a mutation of a given Row.</td></tr> + * <tr><td>DELETE_ROW</td><td>Indicates that the entire Row is to be deleted. No changes are made if the specified row does not exist.</td></tr> + * <tr><td>REPLACE_ROW</td><td>Indicates that the entire Row is to be deleted, and then a new Row with the same id is to be added. If the specified row does not exist, the new row will still be created.</td></tr> + * <tr><td>UPDATE_ROW</td><td>Indicates that mutations of the underlying Records will be processed individually. Mutation will result in a BlurException if the specified row does not exist.</td></tr> + * </table> */ public enum RowMutationType implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { DELETE_ROW(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ScoreType.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ScoreType.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ScoreType.java index 11bcc07..7e7cc5e 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ScoreType.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ScoreType.java @@ -31,11 +31,13 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * The scoring type used during a SuperQuery to score multi Record hits within a ColumnFamily.<br/><br/> - * SUPER - During a multi Record match, a calculation of the best match Record plus how often it occurs within the match Row produces the score that is used in the scoring of the SuperQuery.<br/><br/> - * AGGREGATE - During a multi Record match, the aggregate score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.<br/><br/> - * BEST - During a multi Record match, the best score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.<br/><br/> - * CONSTANT - A constant score of 1 is used in the scoring of the SuperQuery.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The scoring type used during a SuperQuery to score multi Record hits within a ColumnFamily.</td></tr> + * <tr><td>SUPER</td><td>During a multi Record match, a calculation of the best match Record plus how often it occurs within the match Row produces the score that is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>AGGREGATE</td><td>During a multi Record match, the aggregate score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>BEST</td><td>During a multi Record match, the best score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>CONSTANT</td><td>A constant score of 1 is used in the scoring of the SuperQuery.</td></tr> + * </table> */ public enum ScoreType implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { SUPER(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardState.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardState.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardState.java index b562898..2c2d6a3 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardState.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/ShardState.java @@ -31,7 +31,15 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * See shardServerLayoutOptions method in the Blur service for details. + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The shard state, see shardServerLayoutOptions method in the Blur service for details.</td></tr> + * <tr><td>OPENING</td><td>The shard is opening.</td></tr> + * <tr><td>OPEN</td><td>The shard is open.</td></tr> + * <tr><td>OPENING_ERROR</td><td>An error during the opening of the shard.</td></tr> + * <tr><td>CLOSING</td><td>In the process of closing.</td></tr> + * <tr><td>CLOSED</td><td>The shard is closed.</td></tr> + * <tr><td>CLOSING_ERROR</td><td>An error during the closing of the shard.</td></tr> + * </table> */ public enum ShardState implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { OPENING(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Status.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Status.java b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Status.java index 2086772..34a652a 100644 --- a/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Status.java +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/generated/Status.java @@ -31,8 +31,10 @@ import java.util.HashMap; import org.apache.blur.thirdparty.thrift_0_9_0.TEnum; /** - * NOT_FOUND - when UUID is not found<br/><br/> - * FOUND - when UUID is present<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td>NOT_FOUND</td><td>Blur status UUID is not found.</td></tr> + * <tr><td>FOUND</td><td>Blur status UUID is present.</td></tr> + * </table> */ public enum Status implements org.apache.blur.thirdparty.thrift_0_9_0.TEnum { NOT_FOUND(0), http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/util/DebugSimpleQueryExample.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/DebugSimpleQueryExample.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/DebugSimpleQueryExample.java new file mode 100644 index 0000000..da7cc87 --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/DebugSimpleQueryExample.java @@ -0,0 +1,51 @@ +package org.apache.blur.thrift.util; + +/** + * 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. + */ +import java.io.IOException; + +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.BlurQuery; +import org.apache.blur.thrift.generated.BlurResult; +import org.apache.blur.thrift.generated.BlurResults; +import org.apache.blur.thrift.generated.SimpleQuery; + +public class DebugSimpleQueryExample { + + public static void main(String[] args) throws BlurException, TException, IOException { + String connectionStr = args[0]; + String tableName = args[1]; +// String query = args[2]; + String query = "cool AND examiner"; + + Iface client = BlurClient.getClient(connectionStr); + + final BlurQuery blurQuery = new BlurQuery(); + SimpleQuery simpleQuery = new SimpleQuery(); + blurQuery.setSimpleQuery(simpleQuery); + simpleQuery.setQueryStr(query); + BlurResults results = client.query(tableName, blurQuery); + System.out.println("Total Results: " + results.totalResults); + + for (BlurResult result : results.getResults()) { + System.out.println(result); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/util/ExampleSpatialLoader.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/ExampleSpatialLoader.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/ExampleSpatialLoader.java new file mode 100644 index 0000000..c01d60a --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/ExampleSpatialLoader.java @@ -0,0 +1,96 @@ +package org.apache.blur.thrift.util; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.List; + +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.Column; +import org.apache.blur.thrift.generated.Record; +import org.apache.blur.thrift.generated.RecordMutation; +import org.apache.blur.thrift.generated.RecordMutationType; +import org.apache.blur.thrift.generated.RowMutation; +import org.apache.blur.thrift.generated.RowMutationType; + +public class ExampleSpatialLoader { + + public static void main(String[] args) throws IOException, BlurException, TException { + Iface client = BlurClient.getClient(args[0]); + String tableName = args[1]; + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream( + "/Users/amccurry/Downloads/zipcode/zipcode.csv"))); + String line; + List<String> header = new ArrayList<String>(); + List<RowMutation> batch = new ArrayList<RowMutation>(); + int count = 0; + int total = 0; + int max = 1000; + while ((line = reader.readLine()) != null) { + if (count >= max) { + System.out.println(total); + count = 0; + } + line = line.trim(); + if (line.isEmpty()) { + continue; + } + String[] split = line.split("\",\""); + if (header.isEmpty()) { + for (String s : split) { + header.add(trim(s)); + } + } else { + Record record = new Record(); + String zip = trim(split[0]); + record.setRecordId(zip); + record.setFamily("zip"); + record.addToColumns(new Column("zip", zip)); + record.addToColumns(new Column("city", trim(split[1]))); + record.addToColumns(new Column("state", trim(split[2]))); + record.addToColumns(new Column("location", trim(split[3]) + "," + trim(split[4]))); + record.addToColumns(new Column("timezone", trim(split[5]))); + record.addToColumns(new Column("dst", trim(split[6]))); + + RowMutation mutation = new RowMutation(); + mutation.setTable(tableName); + mutation.setRowId(zip); + mutation.setRowMutationType(RowMutationType.REPLACE_ROW); + List<RecordMutation> recordMutations = new ArrayList<RecordMutation>(); + RecordMutation recordMutation = new RecordMutation(); + recordMutation.setRecord(record); + recordMutation.setRecordMutationType(RecordMutationType.REPLACE_ENTIRE_RECORD); + recordMutations.add(recordMutation); + mutation.setRecordMutations(recordMutations); + + // zip=99950 + // city=Ketchikan + // state=AK + // latitude=55.875767 + // longitude=-131.46633 + // timezone=-9 + // dst=1 + batch.add(mutation); + count++; + total++; + if (batch.size() > 100) { + client.mutateBatch(batch); + batch.clear(); + } + } + } + if (batch.size() > 0) { + client.mutateBatch(batch); + } + } + + private static String trim(String s) { + return s.replace("\"", ""); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/util/OverloadSystem.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/OverloadSystem.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/OverloadSystem.java new file mode 100644 index 0000000..a8d1e8a --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/OverloadSystem.java @@ -0,0 +1,61 @@ +package org.apache.blur.thrift.util; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.BlurException; +import org.apache.blur.thrift.generated.BlurQuery; +import org.apache.blur.thrift.generated.BlurResults; +import org.apache.blur.thrift.generated.Selector; +import org.apache.blur.thrift.generated.SimpleQuery; + +public class OverloadSystem { + + public static void main(String[] args) throws InterruptedException, ExecutionException { + + ExecutorService service = Executors.newFixedThreadPool(100); + final Iface client = BlurClient.getClient("blur-vm:40010"); + + while (true) { + List<Future<Void>> futures = new ArrayList<Future<Void>>(); + for (int i = 0; i < 100; i++) { + futures.add(service.submit(new Callable<Void>() { + @Override + public Void call() throws Exception { + BlurQuery blurQuery = new BlurQuery(); + SimpleQuery simpleQuery = new SimpleQuery(); + simpleQuery.setQueryStr("fam0.col0:*a* fam0.col0:*b* fam0.col0:*d* fam0.col0:*e* fam1.col0:*a* fam1.col0:*b* fam1.col0:*d* fam1.col0:*e*"); + blurQuery.setSimpleQuery(simpleQuery); + blurQuery.setUseCacheIfPresent(false); + blurQuery.setCacheResult(false); + blurQuery.setSelector(new Selector()); + blurQuery.setStart(0); + blurQuery.setStart(100); + try { + BlurResults results = client.query("testtable", blurQuery); + System.out.println(results.getTotalResults()); + } catch (BlurException e) { + e.printStackTrace(); + } catch (TException e) { + e.printStackTrace(); + } + return null; + } + })); + + } + for (Future<Void> future : futures) { + future.get(); + } + } + } + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-thrift/src/main/java/org/apache/blur/thrift/util/PrintConfiguration.java ---------------------------------------------------------------------- diff --git a/blur-thrift/src/main/java/org/apache/blur/thrift/util/PrintConfiguration.java b/blur-thrift/src/main/java/org/apache/blur/thrift/util/PrintConfiguration.java new file mode 100644 index 0000000..91f71f1 --- /dev/null +++ b/blur-thrift/src/main/java/org/apache/blur/thrift/util/PrintConfiguration.java @@ -0,0 +1,40 @@ +package org.apache.blur.thrift.util; + +/** + * 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. + */ +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import org.apache.blur.thirdparty.thrift_0_9_0.TException; +import org.apache.blur.thrift.BlurClient; +import org.apache.blur.thrift.Connection; +import org.apache.blur.thrift.generated.Blur.Iface; +import org.apache.blur.thrift.generated.BlurException; + +public class PrintConfiguration { + + public static void main(String[] args) throws BlurException, TException, IOException { + String connectionStr = args[0]; + Iface client = BlurClient.getClient(new Connection("localhost", 40020,10000)); + Map<String, String> map = new TreeMap<String, String>(client.configuration()); + for (Entry<String, String> e : map.entrySet()) { + System.out.println(e.getKey() + " " + e.getValue()); + } + } +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-util/src/main/java/org/apache/blur/doc/CreateBlurApiHtmlPage.java ---------------------------------------------------------------------- diff --git a/blur-util/src/main/java/org/apache/blur/doc/CreateBlurApiHtmlPage.java b/blur-util/src/main/java/org/apache/blur/doc/CreateBlurApiHtmlPage.java new file mode 100644 index 0000000..d867f31 --- /dev/null +++ b/blur-util/src/main/java/org/apache/blur/doc/CreateBlurApiHtmlPage.java @@ -0,0 +1,187 @@ +package org.apache.blur.doc; + +/** + * 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. + */ +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CreateBlurApiHtmlPage { + + private static final String ENUM = "Enum_"; + private static final String STRUCT = "Struct_"; + private static final String SERVICE = "Service"; + private static final String FN_BLUR = "Fn_Blur_"; + private static final String STRUCTS = "Data structures"; + private static final String ENUMERATIONS = "Enumerations"; + private static final String ID = "id=\""; + private static final String DIV_CLASS_DEFINITION = "<div class=\"definition\">"; + + public static void main(String[] args) throws Exception { + + File file = new File(args[0]); + FileInputStream inputStream = new FileInputStream(file); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + + Map<String, List<String>> markers = new HashMap<String, List<String>>(); + + while ((line = bufferedReader.readLine()) != null) { + line = line.trim(); + if (line.contains(DIV_CLASS_DEFINITION)) { + int indexOf = line.indexOf(DIV_CLASS_DEFINITION); + int start = line.indexOf(ID, indexOf + DIV_CLASS_DEFINITION.length()) + ID.length(); + int end = line.indexOf("\"", start); + String id = line.substring(start, end); + if (id.startsWith(ENUM)) { + String name = id.substring(5); + List<String> list = markers.get(ENUMERATIONS); + if (list == null) { + list = new ArrayList<String>(); + markers.put(ENUMERATIONS, list); + } + list.add("<li><a href=\"#" + id + "\">" + name + "</a></li>"); + } else if (id.startsWith(STRUCT)) { + String name = id.substring(7); + List<String> list = markers.get(STRUCTS); + if (list == null) { + list = new ArrayList<String>(); + markers.put(STRUCTS, list); + } + list.add("<li><a href=\"#" + id + "\">" + name + "</a></li>"); + } else if (id.startsWith(FN_BLUR)) { + String name = id.substring(8); + List<String> list = markers.get(SERVICE); + if (name.equals("query")) { + list.add("</ul></li>"); + list.add("<li><a href=\"#" + id + "\">Data Methods</a><ul class=\"nav\">"); + } else if (name.equals("shardClusterList")) { + list.add("</ul></li>"); + list.add("<li><a href=\"#" + id + "\">Cluster Methods</a><ul class=\"nav\">"); + } + if (list == null) { + list = new ArrayList<String>(); + markers.put(SERVICE, list); + list.add("<li><a href=\"#" + id + "\">Table Methods</a><ul class=\"nav\">"); + } + list.add("<li><a href=\"#" + id + "\"> " + name + "</a></li>"); + } else { + throw new RuntimeException("Unknown name type [" + id + "]"); + } + } + } + List<String> lst = markers.get(SERVICE); + lst.add("</ul></li>"); + + bufferedReader.close(); + + inputStream = new FileInputStream(file); + bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + line = null; + boolean process = false; + + FileOutputStream outputStream = new FileOutputStream(args[1]); + PrintWriter printWriter = new PrintWriter(outputStream); + printFile(printWriter, "header.html"); + + printWriter.println("<div class=\"container bs-docs-container\">"); + printWriter.println("<div class=\"row\">"); + printWriter.println("<div class=\"col-md-3\">"); + printWriter.println("<div class=\"bs-sidebar hidden-print affix\" role=\"complementary\">"); + printWriter.println("<ul class=\"nav bs-sidenav\">"); + + List<String> orderedCategories = Arrays.asList("Enumerations", "Data structures", "Service"); + + for (String category : orderedCategories) { + printWriter.println("<li><a href=\"#" + getLink(category) + "\">" + category + "</a>"); + printWriter.println("<ul class=\"nav\">"); + List<String> list = markers.get(category); + for (String link : list) { + printWriter.println(link); + } + printWriter.println("</ul>"); + printWriter.println("</li>"); + } + printWriter.println("</ul>"); + printWriter.println("</div>"); + printWriter.println("</div>"); + printWriter.println("<div class=\"col-md-9\" role=\"main\">"); + while ((line = bufferedReader.readLine()) != null) { + line = line.trim(); + if (line.equals("<hr/><h2 id=\"Enumerations\">Enumerations</h2>")) { + process = true; + } + int index = line.indexOf("</div></body></html>"); + if (index >= 0) { + line = line.substring(0, index); + } + if (line.contains("<br>")) { + line = line.replace("<br>", "<br/>"); + } + if (process) { + if (line.contains("</div>")) { + line = line.replace("</div>", "</p></section>"); + } + if (line.contains(DIV_CLASS_DEFINITION)) { + line = line.replace(DIV_CLASS_DEFINITION, "<section><div class=\"page-header\">"); + line += "</div><p class=\"lead\">"; + } + printWriter.println(line); + } + + } + printWriter.println("</div>"); + printWriter.println("</div>"); + printWriter.println("</div>"); + for (int i = 0; i < 100; i++) { + printWriter.println("<br/>"); + } + printFile(printWriter, "footer.html"); + printWriter.close(); + bufferedReader.close(); + } + + private static String getLink(String category) { + if (category.equals("Service")) { + return "Svc_Blur"; + } else if (category.equals(STRUCTS)) { + return "Structs"; + } + return category; + } + + private static void printFile(PrintWriter printWriter, String file) throws IOException { + InputStream inputStream = CreateBlurApiHtmlPage.class.getResourceAsStream(file); + BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); + String line; + while ((line = bufferedReader.readLine()) != null) { + printWriter.println(line.trim()); + } + bufferedReader.close(); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-util/src/main/resources/org/apache/blur/doc/footer.html ---------------------------------------------------------------------- diff --git a/blur-util/src/main/resources/org/apache/blur/doc/footer.html b/blur-util/src/main/resources/org/apache/blur/doc/footer.html new file mode 100644 index 0000000..120bbd2 --- /dev/null +++ b/blur-util/src/main/resources/org/apache/blur/doc/footer.html @@ -0,0 +1,9 @@ + <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> + <script src="resources/js/jquery-2.0.3.min.js"></script> + <!-- Include all compiled plugins (below), or include individual files as needed --> + <script src="resources/js/bootstrap.min.js"></script> + <!-- Enable responsive features in IE8 with Respond.js (https://github.com/scottjehl/Respond) --> + <script src="resources/js/respond.min.js"></script> + <script src="resources/js/docs.js"></script> + </body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/blur-util/src/main/resources/org/apache/blur/doc/header.html ---------------------------------------------------------------------- diff --git a/blur-util/src/main/resources/org/apache/blur/doc/header.html b/blur-util/src/main/resources/org/apache/blur/doc/header.html new file mode 100644 index 0000000..1718d16 --- /dev/null +++ b/blur-util/src/main/resources/org/apache/blur/doc/header.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<!-- + 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. +--> +<html> + <head> + <title>Extra - Apache Blur (Incubator) Documentation</title> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <!-- Bootstrap --> + <link href="resources/css/bootstrap.min.css" rel="stylesheet" media="screen"> + <link href="resources/css/bs-docs.css" rel="stylesheet" media="screen"> + </head> + <body> + <div class="navbar navbar-inverse navbar-fixed-top"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="index.html">Apache Blur (Incubator)</a> + </div> + <div class="collapse navbar-collapse"> + <ul class="nav navbar-nav"> + <li><a href="getting-started.html">Getting Started</a></li> + <li><a href="data-model.html">Data Model</a></li> + <li><a href="cluster-setup.html">Cluster Setup</a></li> + <li><a href="using-blur.html">Using Blur</a></li> + <li class="active"><a href="Blur.html">Blur API</a></li> + </ul> + </div> + </div> + </div> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/d05d4ba2/distribution/src/main/scripts/interface/Blur.thrift ---------------------------------------------------------------------- diff --git a/distribution/src/main/scripts/interface/Blur.thrift b/distribution/src/main/scripts/interface/Blur.thrift index fad3727..9b80d21 100644 --- a/distribution/src/main/scripts/interface/Blur.thrift +++ b/distribution/src/main/scripts/interface/Blur.thrift @@ -20,12 +20,14 @@ namespace rb blur namespace perl Blur /** - * The error type of a BlurException.<br/><br/> - * UNKNOWN - Unknown error.<br/><br/> - * QUERY_CANCEL - Query has been cancel.<br/><br/> - * QUERY_TIMEOUT - Query has timed out.<br/><br/> - * BACK_PRESSURE - Server has run out of memory and is trying to prevent a failure.<br/><br/> - * REQUEST_TIMEOUT - The TCP connection has timed out.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The error type of a BlurException.</td></tr> + * <tr><td>UNKNOWN</td><td>Unknown error.</td></tr> + * <tr><td>QUERY_CANCEL</td><td>Query has been cancel.</td></tr> + * <tr><td>QUERY_TIMEOUT</td><td>Query has timed out.</td></tr> + * <tr><td>BACK_PRESSURE</td><td>Server has run out of memory and is trying to prevent a failure.</td></tr> + * <tr><td>REQUEST_TIMEOUT</td><td>The TCP connection has timed out.</td></tr> + * </table> */ enum ErrorType { UNKNOWN, @@ -53,12 +55,14 @@ exception BlurException { 3:ErrorType errorType } -/** - * The scoring type used during a SuperQuery to score multi Record hits within a ColumnFamily.<br/><br/> - * SUPER - During a multi Record match, a calculation of the best match Record plus how often it occurs within the match Row produces the score that is used in the scoring of the SuperQuery.<br/><br/> - * AGGREGATE - During a multi Record match, the aggregate score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.<br/><br/> - * BEST - During a multi Record match, the best score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.<br/><br/> - * CONSTANT - A constant score of 1 is used in the scoring of the SuperQuery.<br/> +/** + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The scoring type used during a SuperQuery to score multi Record hits within a ColumnFamily.</td></tr> + * <tr><td>SUPER</td><td>During a multi Record match, a calculation of the best match Record plus how often it occurs within the match Row produces the score that is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>AGGREGATE</td><td>During a multi Record match, the aggregate score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>BEST</td><td>During a multi Record match, the best score of all the Records within a ColumnFamily is used in the scoring of the SuperQuery.</td></tr> + * <tr><td>CONSTANT</td><td>A constant score of 1 is used in the scoring of the SuperQuery.</td></tr> + * </table> */ enum ScoreType { SUPER, @@ -68,10 +72,12 @@ enum ScoreType { } /** - * The state of a query.<br/><br/> - * RUNNING - Query is running.<br/><br/> - * INTERRUPTED - Query has been interrupted.<br/><br/> - * COMPLETE - Query is complete.<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The state of a query.</td></tr> + * <tr><td>RUNNING</td><td>Query is running.</td></tr> + * <tr><td>INTERRUPTED</td><td>Query has been interrupted.</td></tr> + * <tr><td>COMPLETE</td><td>Query is complete.</td></tr> + * </table> */ enum QueryState { RUNNING, @@ -81,8 +87,10 @@ enum QueryState { } /** - * NOT_FOUND - when UUID is not found<br/><br/> - * FOUND - when UUID is present<br/> + * <table class="table-bordered table-striped table-condensed"> + * <tr><td>NOT_FOUND</td><td>Blur status UUID is not found.</td></tr> + * <tr><td>FOUND</td><td>Blur status UUID is present.</td></tr> + * </table> */ enum Status { NOT_FOUND, @@ -90,11 +98,13 @@ enum Status { } /** - * Specifies the type of Row mutation that should occur during a mutation of a given Row.<br/><br/> - * DELETE_ROW - Indicates that the entire Row is to be deleted. No changes are made if the specified row does not exist.<br/><br/> - * REPLACE_ROW - Indicates that the entire Row is to be deleted, and then a new Row with the same id is to be added. If the specified row does not exist, the new row will still be created.<br/><br/> - * UPDATE_ROW - Indicates that mutations of the underlying Records will be processed individually. Mutation will result in a BlurException if the specified row does not exist.<br/> - */ + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">Specifies the type of Row mutation that should occur during a mutation of a given Row.</td></tr> + * <tr><td>DELETE_ROW</td><td>Indicates that the entire Row is to be deleted. No changes are made if the specified row does not exist.</td></tr> + * <tr><td>REPLACE_ROW</td><td>Indicates that the entire Row is to be deleted, and then a new Row with the same id is to be added. If the specified row does not exist, the new row will still be created.</td></tr> + * <tr><td>UPDATE_ROW</td><td>Indicates that mutations of the underlying Records will be processed individually. Mutation will result in a BlurException if the specified row does not exist.</td></tr> + * </table> + */ enum RowMutationType { DELETE_ROW, REPLACE_ROW, @@ -102,12 +112,14 @@ enum RowMutationType { } /** - * Specifies the type of Record mutation that should occur during a mutation of a given Record.<br/><br/> - * DELETE_ENTIRE_RECORD - Indicates the Record with the given recordId in the given Row is to be deleted. If the target record does not exist, then no changes are made.<br/><br/> - * REPLACE_ENTIRE_RECORD - Indicates the Record with the given recordId in the given Row is to be deleted, and a new Record with the same id is to be added. If the specified record does not exist the new record is still added.<br/><br/> - * REPLACE_COLUMNS - Replace the columns that are specified in the Record mutation. If the target record does not exist then this mutation will result in a BlurException.<br/><br/> - * APPEND_COLUMN_VALUES - Append the columns in the Record mutation to the Record that could already exist. If the target record does not exist then this mutation will result in a BlurException.<br/> - */ + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">Specifies the type of Record mutation that should occur during a mutation of a given Record.</td></tr> + * <tr><td>DELETE_ENTIRE_RECORD</td><td>Indicates the Record with the given recordId in the given Row is to be deleted. If the target record does not exist, then no changes are made.</td></tr> + * <tr><td>REPLACE_ENTIRE_RECORD</td><td>Indicates the Record with the given recordId in the given Row is to be deleted, and a new Record with the same id is to be added. If the specified record does not exist the new record is still added.</td></tr> + * <tr><td>REPLACE_COLUMNS</td><td>Replace the columns that are specified in the Record mutation. If the target record does not exist then this mutation will result in a BlurException.</td></tr> + * <tr><td>APPEND_COLUMN_VALUES</td><td>Append the columns in the Record mutation to the Record that could already exist. If the target record does not exist then this mutation will result in a BlurException.</td></tr> + * </table> + */ enum RecordMutationType { DELETE_ENTIRE_RECORD, REPLACE_ENTIRE_RECORD, @@ -116,8 +128,16 @@ enum RecordMutationType { } /** - * See shardServerLayoutOptions method in the Blur service for details. - */ + * <table class="table-bordered table-striped table-condensed"> + * <tr><td colspan="2">The shard state, see shardServerLayoutOptions method in the Blur service for details.</td></tr> + * <tr><td>OPENING</td><td>The shard is opening.</td></tr> + * <tr><td>OPEN</td><td>The shard is open.</td></tr> + * <tr><td>OPENING_ERROR</td><td>An error during the opening of the shard.</td></tr> + * <tr><td>CLOSING</td><td>In the process of closing.</td></tr> + * <tr><td>CLOSED</td><td>The shard is closed.</td></tr> + * <tr><td>CLOSING_ERROR</td><td>An error during the closing of the shard.</td></tr> + * </table> + */ enum ShardState { OPENING, OPEN, @@ -720,59 +740,54 @@ struct Metric { */ service Blur { + //Table Commands + /** - * Returns a list of all the shard clusters. - * @return list of all the shard clusters. - */ - list<string> shardClusterList() throws (1:BlurException ex) - /** - * Returns a list of all the shard servers for the given cluster. - * @return list of all the shard servers within the cluster. + * Creates a table with the given TableDescriptor. */ - list<string> shardServerList( - /** the cluster name. */ - 1:string cluster + void createTable( + /** the TableDescriptor. */ + 1:TableDescriptor tableDescriptor ) throws (1:BlurException ex) + /** - * Returns a list of all the controller servers. - * @return list of all the controllers. + * Enables the given table, blocking until all shards are online. */ - list<string> controllerServerList() throws (1:BlurException ex) + void enableTable( + /** the table name. */ + 1:string table + ) throws (1:BlurException ex) + /** - * Returns a map of the layout of the given table, where the key is the shard name - * and the value is the shard server.<br><br> - * This method will return the "correct" layout for the given shard, or the - * "correct" layout of cluster if called on a controller.<br><br> - * The meaning of correct:<br>Given the current state of the shard cluster with failures taken - * into account, the correct layout is what the layout should be given the current state. In - * other words, what the shard server should be serving. The act of calling the shard - * server layout method with the NORMAL option will block until the layout shard server - * matches the correct layout. Meaning it will block until indexes that should be open are - * open and ready for queries. However indexes are lazily closed, so if a table is being - * disabled then the call will return immediately with an empty map, but the indexes may - * not be close yet.<br><br> - * @return map of shards in a table to the shard servers. + * Disables the given table, blocking until all shards are offline. */ - map<string,string> shardServerLayout( + void disableTable( /** the table name. */ 1:string table ) throws (1:BlurException ex) /** - * Returns a map of the layout of the given table, where the key is the shard name and the - * value is the shard server.<br><br> - * This method will return immediately with what shards are currently - * open in the shard server. So if a shard is being moved to another server and is being - * closed by this server it WILL be returned in the map. The shardServerLayout method would not return - * the shard given the same situation. - * @return map of shards to a map of shard servers with the state of the shard. + * Removes the given table, with an optional to delete the underlying index storage as well. */ - map<string,map<string,ShardState>> shardServerLayoutState( + void removeTable( /** the table name. */ - 1:string table + 1:string table, + /** true to remove the index storage and false if to preserve.*/ + 2:bool deleteIndexFiles ) throws (1:BlurException ex) /** + * Attempts to add a column definition to the given table. + * @return true if successfully defined false if not. + */ + bool addColumnDefinition( + /** the name of the table. */ + 1:string table, + /** the ColumnDefinition. */ + 2:ColumnDefinition columnDefinition + ) throws (1:BlurException ex) + + /** * Returns a list of the table names across all shard clusters. * @return list of all tables in all shard clusters. */ @@ -797,6 +812,62 @@ service Blur { ) throws (1:BlurException ex) /** + * Gets the schema for a given table. + * @return Schema. + */ + Schema schema( + /** the table name. */ + 1:string table + ) throws (1:BlurException ex) + + /** + * Parses the given query and return the string represents the query. + * @return string representation of the parsed query. + */ + string parseQuery( + /** the table name. */ + 1:string table, + /** the query to parse. */ + 2:SimpleQuery simpleQuery + ) throws (1:BlurException ex) + + /** + * Gets the table stats for the given table. + * @return TableStats. + */ + TableStats tableStats( + /** the table name. */ + 1:string table + ) throws (1:BlurException ex) + + /** + * Will perform a forced optimize on the index in the given table. + */ + void optimize( + /** table the name of the table. */ + 1:string table, + /** the maximum of segments per shard index after the operation is completed. */ + 2:i32 numberOfSegmentsPerShard + ) throws (1:BlurException ex) + + /** + * Creates a snapshot for the table with the given name + */ + void createSnapshot(1:string table, 2:string name) throws (1:BlurException ex) + + /** + * Removes a previous snapshot(identified by name) of the table + */ + void removeSnapshot(1:string table, 2:string name) throws (1:BlurException ex) + + /** + * Returns a map where the key is the shard, and the list is the snapshots within that shard + */ + map<string,list<string>> listSnapshots(1:string table) throws (1:BlurException ex) + + // Data Commands + + /** * Executes a query against a the given table and returns the results. If this method is * executed against a controller the results will contain the aggregated results from all * the shards. If this method is executed against a shard server the results will only @@ -812,14 +883,30 @@ service Blur { ) throws (1:BlurException ex) /** - * Parses the given query and return the string represents the query. - * @return string representation of the parsed query. + * Fetches a Row or a Record in the given table with the given Selector. + * @return the FetchResult. */ - string parseQuery( + FetchResult fetchRow( /** the table name. */ 1:string table, - /** the query to parse. */ - 2:SimpleQuery simpleQuery + /** the Selector to use to fetch the Row or Record. */ + 2:Selector selector + ) throws (1:BlurException ex) + + /** + * Mutates a Row given the RowMutation the is provided. + */ + void mutate( + /** the RowMutation.*/ + 1:RowMutation mutation + ) throws (1:BlurException ex) + + /** + * Mutates a group of Rows given the list of RowMutations that are provided. Note: This is not an atomic operation. + */ + void mutateBatch( + /** the batch of RowMutations.*/ + 1:list<RowMutation> mutations ) throws (1:BlurException ex) /** @@ -854,24 +941,6 @@ service Blur { ) throws (1:BlurException ex) /** - * Gets the schema for a given table. - * @return Schema. - */ - Schema schema( - /** the table name. */ - 1:string table - ) throws (1:BlurException ex) - - /** - * Gets the table stats for the given table. - * @return TableStats. - */ - TableStats tableStats( - /** the table name. */ - 1:string table - ) throws (1:BlurException ex) - - /** * Gets the terms list from the index for the given table, family, column using the * startWith value to page through the results. This method only makes sense to use with * string and text field types. @@ -905,87 +974,59 @@ service Blur { 4:string value ) throws (1:BlurException ex) - /** - * Fetches a Row or a Record in the given table with the given Selector. - * @return the FetchResult. - */ - FetchResult fetchRow( - /** the table name. */ - 1:string table, - /** the Selector to use to fetch the Row or Record. */ - 2:Selector selector - ) throws (1:BlurException ex) + // Cluster methods /** - * Mutates a Row given the RowMutation the is provided. + * Returns a list of all the shard clusters. + * @return list of all the shard clusters. */ - void mutate( - /** the RowMutation.*/ - 1:RowMutation mutation - ) throws (1:BlurException ex) - + list<string> shardClusterList() throws (1:BlurException ex) /** - * Mutates a group of Rows given the list of RowMutations that are provided. Note: This is not an atomic operation. + * Returns a list of all the shard servers for the given cluster. + * @return list of all the shard servers within the cluster. */ - void mutateBatch( - /** the batch of RowMutations.*/ - 1:list<RowMutation> mutations + list<string> shardServerList( + /** the cluster name. */ + 1:string cluster ) throws (1:BlurException ex) - /** - * Creates a table with the given TableDescriptor. + * Returns a list of all the controller servers. + * @return list of all the controllers. */ - void createTable( - /** the TableDescriptor. */ - 1:TableDescriptor tableDescriptor - ) throws (1:BlurException ex) - + list<string> controllerServerList() throws (1:BlurException ex) /** - * Enables the given table, blocking until all shards are online. + * Returns a map of the layout of the given table, where the key is the shard name + * and the value is the shard server.<br><br> + * This method will return the "correct" layout for the given shard, or the + * "correct" layout of cluster if called on a controller.<br><br> + * The meaning of correct:<br>Given the current state of the shard cluster with failures taken + * into account, the correct layout is what the layout should be given the current state. In + * other words, what the shard server should be serving. The act of calling the shard + * server layout method with the NORMAL option will block until the layout shard server + * matches the correct layout. Meaning it will block until indexes that should be open are + * open and ready for queries. However indexes are lazily closed, so if a table is being + * disabled then the call will return immediately with an empty map, but the indexes may + * not be close yet.<br><br> + * @return map of shards in a table to the shard servers. */ - void enableTable( + map<string,string> shardServerLayout( /** the table name. */ 1:string table ) throws (1:BlurException ex) /** - * Disables the given table, blocking until all shards are offline. + * Returns a map of the layout of the given table, where the key is the shard name and the + * value is the shard server.<br><br> + * This method will return immediately with what shards are currently + * open in the shard server. So if a shard is being moved to another server and is being + * closed by this server it WILL be returned in the map. The shardServerLayout method would not return + * the shard given the same situation. + * @return map of shards to a map of shard servers with the state of the shard. */ - void disableTable( + map<string,map<string,ShardState>> shardServerLayoutState( /** the table name. */ 1:string table ) throws (1:BlurException ex) - - /** - * Removes the given table, with an optional to delete the underlying index storage as well. - */ - void removeTable( - /** the table name. */ - 1:string table, - /** true to remove the index storage and false if to preserve.*/ - 2:bool deleteIndexFiles - ) throws (1:BlurException ex) - - /** - * Attempts to add a column definition to the given table. - * @return true if successfully defined false if not. - */ - bool addColumnDefinition( - /** the name of the table. */ - 1:string table, - /** the ColumnDefinition. */ - 2:ColumnDefinition columnDefinition - ) throws (1:BlurException ex) - - /** - * Will perform a forced optimize on the index in the given table. - */ - void optimize( - /** table the name of the table. */ - 1:string table, - /** the maximum of segments per shard index after the operation is completed. */ - 2:i32 numberOfSegmentsPerShard - ) throws (1:BlurException ex) /** * Checks to see if the given cluster is in safemode. @@ -1011,20 +1052,6 @@ service Blur { 1:set<string> metrics ) throws (1:BlurException ex) - /** - * Creates a snapshot for the table with the given name - */ - void createSnapshot(1:string table, 2:string name) throws (1:BlurException ex) - - /** - * Removes a previous snapshot(identified by name) of the table - */ - void removeSnapshot(1:string table, 2:string name) throws (1:BlurException ex) - - /** - * Returns a map where the key is the shard, and the list is the snapshots within that shard - */ - map<string,list<string>> listSnapshots(1:string table) throws (1:BlurException ex) }
