本文整理汇总了C#中Store.GetCommitPoints方法的典型用法代码示例。如果您正苦于以下问题:C# Store.GetCommitPoints方法的具体用法?C# Store.GetCommitPoints怎么用?C# Store.GetCommitPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store.GetCommitPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindWorkingTransaction
public void FindWorkingTransaction()
{
Store store = new Store("c:\\brightstar\\twitteringtest\\", false);
FileStoreManager fsm = new FileStoreManager(StoreConfiguration.DefaultStoreConfiguration);
int txnCount = 0;
foreach (var cp in store.GetCommitPoints())
{
var oldStore = fsm.OpenStore("c:\\brightstar\\twitteringtest\\", cp.LocationOffset);
try
{
oldStore.ExecuteSparqlQuery(TestQuery, SparqlResultsFormat.Xml);
Console.WriteLine("Query worked for commit point : {0} @ {1}", cp.LocationOffset, cp.CommitTime);
break;
}
catch (Exception)
{
Console.WriteLine("Query failed for commit point : {0} @ {1}", cp.LocationOffset, cp.CommitTime);
txnCount++;
}
}
var txnLog = fsm.GetTransactionLog("c:\\brightstar\\twitteringtest");
var txnList = txnLog.GetTransactionList();
for(int i = 0 ; i<= txnCount;i++)
{
txnList.MoveNext();
var txnInfo = txnList.Current;
Console.WriteLine("Transaction #{0}: Start: {1}, Status: {2}, JobId: {3}", i, txnInfo.TransactionStartTime, txnInfo.TransactionStatus, txnInfo.JobId);
}
// Going back to last known good
store.RevertToCommitPoint(new CommitPoint(242472899 , 0, DateTime.UtcNow, Guid.Empty));
var toReplay = new List<ITransactionInfo>();
txnList = txnLog.GetTransactionList();
for(int i = 0; i < 10 ; i++)
{
txnList.MoveNext();
toReplay.Add(txnList.Current);
}
var storeWorker = new StoreWorker("c:\\brightstar","twitteringtest");
for(int i = 9; i >= 0; i--)
{
Console.WriteLine("Applying transaction : {0}", toReplay[i].JobId);
txnLog.GetTransactionData(toReplay[i].DataStartPosition);
var jobId = Guid.NewGuid();
var updateJob = new UpdateTransaction(jobId, null, storeWorker);
updateJob.ReadTransactionDataFromStream(txnLog.GetTransactionData(toReplay[i].DataStartPosition));
updateJob.Run();
var readStore = storeWorker.ReadStore as Store;
var resource = readStore.Resolve(1518601251);
Assert.IsNotNull(resource);
try
{
var query = StoreExtensions.ParseSparql(TestQuery);
using (var resultStream = new MemoryStream())
{
storeWorker.Query(query, SparqlResultsFormat.Xml, resultStream,
new[] {Constants.DefaultGraphUri});
}
Console.WriteLine("Query succeeded");
}
catch(Exception ex)
{
Console.WriteLine("Query failed: " + ex.Message);
Assert.Fail();
}
}
}