public bool Remove(IPut put)
{
Reset();
keyStreamPosition = ;
formatterSerialize(keyStream putKey);
DbEntry key = DbEntryInOut(keyStreamGetBuffer() (int)keyStreamPosition);
DeleteStatus status = btreeDelete(txn ref key);
switch (status)
{
case DeleteStatusNotFound:
case DeleteStatusSuccess:
return true;
case DeleteStatusKeyEmpty:
default:
return false;
}
}
public void Dispose()
{
if (!iscomit)
Commit();
dbClose();
dbClose();
}
private void Reset()
{
iscomit = false;
}
private void Init()
{
env = new Env(EnvCreateFlagsNone);
EnvOpenFlags envFlags =
EnvOpenFlagsCreate |
EnvOpenFlagsInitLock |
EnvOpenFlagsInitLog |
EnvOpenFlagsInitMPool |
EnvOpenFlagsInitTxn |
EnvOpenFlagsRecover;
envOpen(directory envFlags );
txn = envTxnBegin(null TxnBeginFlagsNone);
db = envCreateDatabase(DbCreateFlagsNone);
btree = (DbBTree)dbOpen(txn dbName null DbTypeBTree DbOpenFlagsCreate );
}
private void StreamInit()
{
formatter = new BinaryFormatter();
keyStream = new MemoryStream();
dataStream = new MemoryStream();
}
private bool GetNextRecord(DbBTreeCursor cursor ref IPut cust)
{
ReadStatus status;
keyStreamSetLength(keyStreamCapacity);
dataStreamSetLength(dataStreamCapacity);
DbEntry key = DbEntryOut(keyStreamGetBuffer());
DbEntry data = DbEntryOut(dataStreamGetBuffer());
do
{
status = cursorGet(ref key ref data DbFileCursorGetModeNext DbFileCursorReadFlagsNone);
switch (status)
{
case ReadStatusNotFound: return false;
case ReadStatusKeyEmpty: continue; // skip deleted records
case ReadStatusBufferSmall:
[] [] [] [] [] [] []