本文整理汇总了C#中BerkeleyDB.LSN类的典型用法代码示例。如果您正苦于以下问题:C# LSN类的具体用法?C# LSN怎么用?C# LSN使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LSN类属于BerkeleyDB命名空间,在下文中一共展示了LSN类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ActiveTransaction
internal ActiveTransaction(DB_TXN_ACTIVE active, byte[] GlobalID, string Name) {
txn = active;
_lsn = new LSN(txn.lsn.file, txn.lsn.offset);
_read_lsn = new LSN(txn.read_lsn.file, txn.read_lsn.offset);
gid = GlobalID;
txnname = Name;
}
开发者ID:gildafnai82,项目名称:craq,代码行数:7,代码来源:ActiveTransaction.cs
示例2: RepProcMsgResult
internal RepProcMsgResult(int ret, LSN dblsn)
{
RetLsn = null;
switch (ret) {
case DbConstants.DB_REP_DUPMASTER:
Result = ProcMsgResult.DUPLICATE_MASTER;
break;
case DbConstants.DB_REP_HOLDELECTION:
Result = ProcMsgResult.HOLD_ELECTION;
break;
case DbConstants.DB_REP_IGNORE:
Result = ProcMsgResult.IGNORED;
break;
case DbConstants.DB_REP_ISPERM:
Result = ProcMsgResult.IS_PERMANENT;
break;
case DbConstants.DB_REP_JOIN_FAILURE:
Result = ProcMsgResult.JOIN_FAILURE;
break;
case DbConstants.DB_REP_NEWSITE:
Result = ProcMsgResult.NEW_SITE;
break;
case DbConstants.DB_REP_NOTPERM:
Result = ProcMsgResult.NOT_PERMANENT;
break;
case 0:
Result = ProcMsgResult.SUCCESS;
break;
default:
Result = ProcMsgResult.ERROR;
break;
}
}
开发者ID:rohitlodha,项目名称:DenverDB,代码行数:33,代码来源:RepProcMsgResult.cs
示例3: TransactionStats
internal TransactionStats(Internal.TxnStatStruct stats) {
st = stats.st;
lastCkp = new LSN(st.st_last_ckp.file, st.st_last_ckp.offset);
txns = new List<ActiveTransaction>();
for (int i = 0; i < st.st_nactive; i++)
txns.Add(new ActiveTransaction(
stats.st_txnarray[i], stats.st_txngids[i], stats.st_txnnames[i]));
}
开发者ID:gildafnai82,项目名称:craq,代码行数:8,代码来源:TransactionStats.cs
示例4: getDB_LSN
internal static DB_LSN getDB_LSN(LSN inp) {
if (inp == null)
return null;
DB_LSN ret = new DB_LSN();
ret.file = inp.LogFileNumber;
ret.offset = inp.Offset;
return ret;
}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:9,代码来源:LSN.cs
示例5: ReplicationStats
internal ReplicationStats(Internal.ReplicationStatStruct stats) {
st = stats;
next = new LSN(st.st_next_lsn.file, st.st_next_lsn.offset);
waiting = new LSN(st.st_waiting_lsn.file, st.st_waiting_lsn.offset);
maxPerm =
new LSN(st.st_max_perm_lsn.file, st.st_max_perm_lsn.offset);
winner = new LSN(st.st_election_lsn.file, st.st_election_lsn.offset);
}
开发者ID:gildafnai82,项目名称:craq,代码行数:9,代码来源:ReplicationStats.cs
示例6: LogVerifyConfig
/// <summary>
/// Instantiate a new LogVerifyConfig object, with the default
/// configuration settings.
/// </summary>
public LogVerifyConfig()
{
envhome = null;
dbfile = null;
dbname = null;
caf = true;
verbose = false;
startlsn = new LSN(0, 0);
endlsn = new LSN(0, 0);
cachesz = 0;
}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:15,代码来源:LogVerifyConfig.cs
示例7: Compare
/// <summary>
/// Compare two LSNs.
/// </summary>
/// <param name="lsn1">The first LSN to compare</param>
/// <param name="lsn2">The second LSN to compare</param>
/// <returns>
/// 0 if they are equal, 1 if lsn1 is greater than lsn2, and -1 if lsn1
/// is less than lsn2.
/// </returns>
public static int Compare(LSN lsn1, LSN lsn2) {
DB_LSN a = new DB_LSN();
a.offset = lsn1.Offset;
a.file = lsn1.LogFileNumber;
DB_LSN b = new DB_LSN();
b.offset = lsn2.Offset;
b.file = lsn2.LogFileNumber;
return libdb_csharp.log_compare(a, b);
}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:20,代码来源:LSN.cs
示例8: doRepTransport
private static int doRepTransport(IntPtr envp,
IntPtr controlp, IntPtr recp, IntPtr lsnp, int envid, uint flags) {
DB_ENV dbenv = new DB_ENV(envp, false);
DBT control = new DBT(controlp, false);
DBT rec = new DBT(recp, false);
DB_LSN tmplsn = new DB_LSN(lsnp, false);
LSN dblsn = new LSN(tmplsn.file, tmplsn.offset);
return dbenv.api2_internal.transportHandler(
DatabaseEntry.fromDBT(control),
DatabaseEntry.fromDBT(rec), dblsn, envid, flags);
}
开发者ID:gildafnai82,项目名称:craq,代码行数:11,代码来源:DatabaseEnvironment.cs
示例9: RepProcessMessage
/// <summary>
/// Process an incoming replication message sent by a member of the
/// replication group to the local database environment.
/// </summary>
/// <remarks>
/// <para>
/// RepProcessMessage is not called by most replication applications. It
/// should only be called by applications implementing their own network
/// transport layer, explicitly holding replication group elections and
/// handling replication messages outside of the replication manager
/// framework.
/// </para>
/// <para>
/// For implementation reasons, all incoming replication messages must
/// be processed using the same <see cref="DatabaseEnvironment"/>
/// object. It is not required that a single thread of control process
/// all messages, only that all threads of control processing messages
/// use the same object.
/// </para>
/// <para>
/// Before calling this method, the <see cref="RepTransport"/> delegate
/// must already have been configured to send replication messages.
/// </para>
/// </remarks>
/// <param name="control">
/// A copy of the control parameter specified by Berkeley DB on the
/// sending environment.
/// </param>
/// <param name="rec">
/// A copy of the rec parameter specified by Berkeley DB on the sending
/// environment.
/// </param>
/// <param name="envid">
/// The local identifier that corresponds to the environment that sent
/// the message to be processed (see Replication environment IDs in the
/// Programmer's Reference Guide for more information)..
/// </param>
/// <returns>The result of processing a message</returns>
public RepProcMsgResult RepProcessMessage(
DatabaseEntry control, DatabaseEntry rec, int envid)
{
DB_LSN dblsn = new DB_LSN();
int ret = dbenv.rep_process_message(control,
rec, envid, dblsn);
LSN lsnp = new LSN(dblsn.file, dblsn.offset);
RepProcMsgResult result = new RepProcMsgResult(ret, lsnp);
if (result.Result == RepProcMsgResult.ProcMsgResult.ERROR)
DatabaseException.ThrowException(ret);
return result;
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:50,代码来源:DatabaseEnvironment.cs
示例10: LogFile
/// <summary>
/// Map an LSN object to a log filename
/// </summary>
/// <param name="logSeqNum">
/// The DB_LSN structure for which a filename is wanted.
/// </param>
/// <returns>
/// The name of the file containing the record named by
/// <paramref name="logSeqNum"/>.
/// </returns>
public string LogFile(LSN logSeqNum)
{
return dbenv.log_file(LSN.getDB_LSN(logSeqNum));
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:14,代码来源:DatabaseEnvironment.cs
示例11: TestLsn
public void TestLsn()
{
testName = "TestLsn";
SetUpTest(true);
LSN lsn = new LSN(12, 411);
Assert.AreEqual(12, lsn.LogFileNumber);
Assert.AreEqual(411, lsn.Offset);
LSN newLsn = new LSN(15, 410);
Assert.AreEqual(0, LSN.Compare(lsn, lsn));
Assert.Greater(0, LSN.Compare(lsn, newLsn));
}
开发者ID:bohrasd,项目名称:windowsrtdev,代码行数:13,代码来源:LogConfigTest.cs
示例12: TesCurrentLSN
public void TesCurrentLSN()
{
testName = "TesCurrentLSN";
SetUpTest(true);
RecnoDatabase db;
Logging(testHome, testName, out env, out db);
// Get log cursor to read/write log.
LogCursor logCursor = env.GetLogCursor();
/*
* Move the cursor to the beginning of the #1 log file.
* Get the current LSN and confirm that is the position
* the cursor is moved to.
*/
LSN lsn = new LSN(1, 0);
logCursor.Move(lsn);
Assert.AreEqual(lsn.LogFileNumber,
logCursor.CurrentLSN.LogFileNumber);
Assert.AreEqual(lsn.Offset, logCursor.CurrentLSN.Offset);
// Close all.
logCursor.Close();
db.Close();
env.Close();
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:27,代码来源:LogCursorTest.cs
示例13: TestLogFile
public void TestLogFile()
{
testName = "TestLogFile";
SetUpTest(true);
// Open environment and configure logging subsystem.
DatabaseEnvironmentConfig cfg =
new DatabaseEnvironmentConfig();
cfg.Create = true;
cfg.UseTxns = true;
cfg.AutoCommit = true;
cfg.UseLocking = true;
cfg.UseMPool = true;
cfg.UseLogging = true;
cfg.MPoolSystemCfg = new MPoolConfig();
cfg.MPoolSystemCfg.CacheSize =
new CacheInfo(0, 1048576, 1);
cfg.LogSystemCfg = new LogConfig();
cfg.LogSystemCfg.AutoRemove = false;
cfg.LogSystemCfg.BufferSize = 10240;
cfg.LogSystemCfg.Dir = "./";
cfg.LogSystemCfg.FileMode = 755;
cfg.LogSystemCfg.ForceSync = true;
cfg.LogSystemCfg.InMemory = false;
cfg.LogSystemCfg.MaxFileSize = 1048576;
cfg.LogSystemCfg.NoBuffer = false;
cfg.LogSystemCfg.RegionSize = 204800;
cfg.LogSystemCfg.ZeroOnCreate = true;
DatabaseEnvironment env = DatabaseEnvironment.Open(testHome, cfg);
// Open database.
Transaction allTxn = env.BeginTransaction();
TransactionConfig txnConfig = new TransactionConfig();
txnConfig.Name = "OpenTransaction";
Transaction openTxn = env.BeginTransaction(txnConfig, allTxn);
BTreeDatabaseConfig dbConfig = new BTreeDatabaseConfig();
dbConfig.Creation = CreatePolicy.IF_NEEDED;
dbConfig.Env = env;
BTreeDatabase db = BTreeDatabase.Open(
testName + ".db", dbConfig, openTxn);
List<ActiveTransaction> activeTxns =
env.TransactionSystemStats().Transactions;
for (int i = 0; i < activeTxns.Count; i++)
if (activeTxns[i].Name == "OpenTransaction")
{
LSN lsn = new LSN(
activeTxns[i].Begun.LogFileNumber,
activeTxns[i].Begun.Offset);
env.LogFlush(lsn);
string fileName = env.LogFile(lsn);
}
openTxn.Commit();
// Write "##" to log before putting data into database.
env.WriteToLog("##");
// Write 1000 records into database.
TransactionConfig writeTxnConfig = new TransactionConfig();
writeTxnConfig.Name = "WriteTxn";
Transaction writeTxn = env.BeginTransaction(writeTxnConfig, allTxn);
byte[] byteArr = new byte[1024];
for (int i = 0; i < 1000; i++)
{
db.Put(new DatabaseEntry(BitConverter.GetBytes(i)),
new DatabaseEntry(byteArr), writeTxn);
env.LogFlush();
env.WriteToLog("#" + i.ToString(), writeTxn);
}
activeTxns = env.TransactionSystemStats().Transactions;
for (int i = 0; i < activeTxns.Count; i++)
if (activeTxns[i].Name == "WriteTxn")
{
LSN lsn = new LSN(
activeTxns[i].Begun.LogFileNumber,
activeTxns[i].Begun.Offset);
env.LogFlush(lsn);
string fileName = env.LogFile(lsn);
}
writeTxn.Commit();
db.Close();
// Write "##" after data has been put.
env.WriteToLog("##");
List<string> logFiles = env.LogFiles(true);
env.LogWrite(new DatabaseEntry(), true);
env.RemoveUnusedLogFiles();
allTxn.Commit();
env.Close();
}
开发者ID:sukantoguha,项目名称:INET-Vagrant-Demos,代码行数:97,代码来源:DatabaseEnvironmentTest.cs
示例14: TestMove
public void TestMove()
{
testName = "TestMove";
SetUpTest(true);
DatabaseEnvironment env;
RecnoDatabase db;
Logging(testHome, testName, out env, out db);
// Get log cursor to read/write log.
LogCursor logCursor = env.GetLogCursor();
// Move the cursor to specified location in log files.
LSN lsn = new LSN(1, 0);
Assert.IsTrue(logCursor.Move(lsn));
// Close all.
logCursor.Close();
db.Close();
env.Close();
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:21,代码来源:LogCursorTest.cs
示例15: TestCurrentRecord
public void TestCurrentRecord()
{
testName = "TestCurrentRecord";
SetUpTest(true);
DatabaseEnvironment env;
RecnoDatabase db;
Logging(testHome, testName, out env, out db);
// Get log cursor to read/write log.
LogCursor logCursor = env.GetLogCursor();
/*
* Move the cursor to the beginning of the #1 log file.
* Get the current LSN and confirm that is the position
* the cursor is moved to.
*/
LSN lsn = new LSN(1, 0);
logCursor.Move(lsn);
Assert.IsNotNull(logCursor.CurrentRecord.Data);
// Close all.
logCursor.Close();
db.Close();
env.Close();
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:26,代码来源:LogCursorTest.cs
示例16: SyncMemPool
/// <summary>
/// Flush modified pages in the cache with log sequence numbers less
/// than <paramref name="minLSN"/> to their backing files.
/// </summary>
/// <remarks>
/// Pages in the cache that cannot be immediately written back to disk
/// (for example, pages that are currently in use by another thread of
/// control) are waited for and written to disk as soon as it is
/// possible to do so.
/// </remarks>
/// <param name="minLSN">
/// All modified pages with a log sequence number less than the minLSN
/// parameter are written to disk. If null, all modified pages in the
/// cache are written to disk.
/// </param>
public void SyncMemPool(LSN minLSN)
{
dbenv.memp_sync(LSN.getDB_LSN(minLSN));
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:19,代码来源:DatabaseEnvironment.cs
示例17: TestLsn
public void TestLsn()
{
testName = "TestLsn";
testHome = testFixtureHome + "/" + testName;
Configuration.ClearDir(testHome);
LSN lsn = new LSN(12, 411);
Assert.AreEqual(12, lsn.LogFileNumber);
Assert.AreEqual(411, lsn.Offset);
LSN newLsn = new LSN(15, 410);
Assert.AreEqual(0, LSN.Compare(lsn, lsn));
Assert.Greater(0, LSN.Compare(lsn, newLsn));
}
开发者ID:gildafnai82,项目名称:craq,代码行数:14,代码来源:LogConfigTest.cs
示例18: LogFlush
/// <summary>
/// Write log records to disk.
/// </summary>
/// <param name="logSeqNum">
/// All log records with LSN values less than or equal to
/// <paramref name="logSeqNum"/> are written to disk. If null, all
/// records in the log are flushed.
/// </param>
public void LogFlush(LSN logSeqNum)
{
dbenv.log_flush(LSN.getDB_LSN(logSeqNum));
}
开发者ID:simonzhangsm,项目名称:h-store,代码行数:12,代码来源:DatabaseEnvironment.cs
注:本文中的BerkeleyDB.LSN类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论