本文整理汇总了C#中HBaseClient.DeleteTable方法的典型用法代码示例。如果您正苦于以下问题:C# HBaseClient.DeleteTable方法的具体用法?C# HBaseClient.DeleteTable怎么用?C# HBaseClient.DeleteTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HBaseClient
的用法示例。
在下文中一共展示了HBaseClient.DeleteTable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Context
protected override void Context()
{
if (!_arrangementCompleted)
{
// at present, no tables are modified so only arrange the tables once per test pass
// and putting the arrangement into a static context.
// (this knocked test runs down to ~30 seconds from ~5 minutes).
_credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt");
var client = new HBaseClient(_credentials);
// ensure tables from previous tests are cleaned up
TableList tables = client.ListTables();
foreach (string name in tables.name)
{
string pinnedName = name;
if (name.StartsWith(TableNamePrefix, StringComparison.Ordinal))
{
client.DeleteTable(pinnedName);
}
}
AddTable();
PopulateTable();
_arrangementCompleted = true;
}
}
示例2: Context
protected override void Context()
{
_credentials = ClusterCredentialsFactory.CreateFromFile(@".\credentials.txt");
var client = new HBaseClient(_credentials);
// ensure tables from previous tests are cleaned up
TableList tables = client.ListTables();
foreach (string name in tables.name)
{
if (name.StartsWith(TestTablePrefix, StringComparison.Ordinal))
{
client.DeleteTable(name);
}
}
// add a table specific to this test
_testTableName = TestTablePrefix + _random.Next(10000);
_testTableSchema = new TableSchema();
_testTableSchema.name = _testTableName;
_testTableSchema.columns.Add(new ColumnSchema { name = "d" });
client.CreateTable(_testTableSchema);
}
示例3: Main
private static void Main(string[] args)
{
const string clusterURL = "http://localhost:5555";
const string hadoopUsername = "root";
const string hadoopUserPassword = "hadoop";
var serializer = new JsonDotNetSerializer();
// Create a new instance of an HBase client.
var hbaseClient = new HBaseClient(new ClusterCredentials(new Uri(clusterURL), hadoopUsername, hadoopUserPassword));
var itemMapper = new ItemMapper(serializer);
hbaseClient.DeleteTable("Items");
var tableSchema = itemMapper.CreateTableSchema("Items");
hbaseClient.CreateTable(tableSchema);
//var perfCheck = new PerformanceChecksManager(hbaseClient, "Items", itemMapper, new ItemsGenerator(),50,100);
//perfCheck.RunPerformanceLoad();
//Generating item.
var itemsGenerator = new ItemsGenerator();
var item = itemsGenerator.CreateItem("mycode");
//Generating cells relevant to the generate item and saving the entity to Hbae.
var itemCellSet = itemMapper.GetCells(item, "en-US");
var stausCell = itemCellSet.rows.Single().values.Single(cell => Encoding.UTF8.GetString(cell.column).Equals("CF1:Status"));
stausCell.data = new byte[0];
hbaseClient.StoreCells("Items", itemCellSet);
//making sure item stored well.
var originalItemCells = hbaseClient.GetCells("Items", item.Code);
var originalItemFetchedFromDb = itemMapper.GetDto(originalItemCells, "en-US");
if (!string.IsNullOrEmpty(originalItemFetchedFromDb.Status))
throw new Exception();
//Describing the conditional update expression.
var cellToCheck = new Cell { column = Encoding.UTF8.GetBytes("CF1:Status"), data = new byte[0] };
//manipulating original item.
stausCell = itemCellSet.rows.Single().values.Single(cell => Encoding.UTF8.GetString(cell.column).Equals("CF1:Status"));
var newStatusValue = Encoding.UTF8.GetBytes("new");
stausCell.data = newStatusValue;
//Testing new functionality...
hbaseClient.CheckAndPutCells("Items", itemCellSet, cellToCheck);
//Thread.Sleep(1);
itemCellSet = hbaseClient.GetCells("Items", item.Code);
var itemFromDb = itemMapper.GetDto(itemCellSet, "en-US");
if (!itemFromDb.Status.Equals(Encoding.UTF8.GetString(newStatusValue)))
throw new Exception();
#region Old-Helper
//string clusterURL = "http://localhost:5555";
//string hadoopUsername = "root";
//string hadoopUserPassword = "hadoop";
//string hbaseTableName = "MyCoolTable";
//// Create a new instance of an HBase client.
//ClusterCredentials creds = new ClusterCredentials(new Uri(clusterURL), hadoopUsername, hadoopUserPassword);
//HBaseClient hbaseClient = new HBaseClient(creds);
//var hbaseHelper = new Helper(hbaseClient, "ThisIsJustATableForShirly1", "DummyKey1ForShirly1");
//hbaseHelper.CreateTable();
//var myClass = new Dto()
//{
// Field1 = "1",
// Field2 = "2",
// Field3 = "3",
// Field4 = "4",
// Field5 = "5",
// NestedData = new NestedDto() { Field1 = "n1", Field2 = "n2" }
//};
//hbaseHelper.SaveMyDto(myClass);
//var dto = hbaseHelper.GetMyDto();
#endregion
}
示例4: DeleteHBaseTable
/// <summary>
/// Delete the HBase table
/// </summary>
/// <param name="hbaseClient"></param>
public static void DeleteHBaseTable(HBaseClient hbaseClient)
{
hbaseClient.DeleteTable(Properties.Settings.Default.HBaseTableName);
Console.WriteLine("Table deleted.");
}