Пример #1
0
 protected void SetBeginLsn(ref DB_LSN* lsnp) {
   DbRetVal ret;
   lock (rscLock) {
     DB_TXN* txp = CheckDisposed();
     ret = txp->SetBeginLsnp(txp, out lsnp);
   }
   Util.CheckRetVal(ret);
 }
Пример #2
0
 public Lsn(DB_LSN lsn) {
   this.lsn = lsn;
 }
Пример #3
0
    static DbRetVal AppRecoverWrapCLS(DB_ENV* evp, ref DBT logrec, DB_LSN* lsnp, DB_RECOPS op) {
      Env env = null;
      try {
        env = (Env)((GCHandle)evp->api_internal).Target;

        // construct DbEntry for log_rec
        int size = unchecked((int)logrec.size);
        // we are not using a shared buffer - the call-back might take
        // a long time and we do not want to lock the buffer that long
        byte[] buffer = new byte[size];
        Marshal.Copy((IntPtr)logrec.data, buffer, 0, size);
        DbEntry logEntry = DbEntry.InOut(buffer, 0, size);
        logEntry.dbt.flags = logrec.flags;
        logEntry.dbt.dlen = logrec.dlen;
        logEntry.dbt.doff = logrec.doff;
        // construct Lsn
        Lsn? lsn;
        if (lsnp == null) lsn = null; else lsn = new Lsn(*lsnp);
        // call CLS compliant delegate - we assume it is not null
        CallbackStatus cs =  env.appRecoverCLS(env, ref logEntry, lsn, (RecoveryOps)op);
        return cs == CallbackStatus.Success ? DbRetVal.SUCCESS : DbRetVal.APP_RECOVER_FAILED;
      }
      catch (Exception ex) {
        Trace.WriteLine(ex.Message, "TxnRecover");
        return DbRetVal.APP_RECOVER_FAILED;
      }
    }
Пример #4
0
 static DbRetVal AppRecoverWrapFast(DB_ENV* evp, ref DBT logrec, DB_LSN* lsnp, DB_RECOPS op) {
   Env env = null;
   try {
     env = (Env)((GCHandle)evp->api_internal).Target;
     CallbackStatus cs = env.appRecoverFast(env, ref logrec, lsnp, (RecoveryOps)op);
     return cs == CallbackStatus.Success ? DbRetVal.SUCCESS : DbRetVal.APP_RECOVER_FAILED;
   }
   catch (Exception ex) {
     Trace.WriteLine(ex.Message, "TxnRecover");
     return DbRetVal.APP_RECOVER_FAILED;
   }
 }
Пример #5
0
 static DbRetVal RepSendWrapCLS(
   DB_ENV* evp,
   ref DBT control,
   ref DBT rec,
   DB_LSN* lsnp,
   int envid,
   uint flags)
 {
   Env env = null;
   try {
     env = Util.GetEnv(evp);
     lock (env.callBackLock) {
       // construct DbEntry for control
       int size = unchecked((int)control.size);
       if (size > env.callBackBuffer1.Length)
         env.callBackBuffer1 = new byte[size];
       Marshal.Copy((IntPtr)control.data, env.callBackBuffer1, 0, size);
       DbEntry ctrlEntry = DbEntry.InOut(env.callBackBuffer1, 0, size);
       // construct DbEntry for rec
       size = unchecked((int)rec.size);
       if (size > env.callBackBuffer2.Length)
         env.callBackBuffer2 = new byte[size];
       Marshal.Copy((IntPtr)rec.data, env.callBackBuffer2, 0, size);
       DbEntry recEntry = DbEntry.InOut(env.callBackBuffer2, 0, size);
       // construct Lsn
       Lsn? lsn;
       if (lsnp == null) lsn = null; else lsn = new Lsn(*lsnp);
       // call CLS compliant delegate - we assume it is not null
       CallbackStatus cs = env.repSendCLS(
         env, ref ctrlEntry, ref recEntry, lsn, envid, unchecked((RepSendFlags)flags));
       return cs == CallbackStatus.Success ? DbRetVal.SUCCESS : DbRetVal.REPSEND_FAILED;
     }
   }
   catch (Exception ex) {
     Trace.WriteLine(ex.Message, "RepSend");
     if (env != null)
       env.Error((int)DbRetVal.REPSEND_FAILED, ex.Message);
     else
       evp->Err(evp, (int)DbRetVal.REPSEND_FAILED, null);
     return DbRetVal.REPSEND_FAILED;
   }
 }
Пример #6
0
 static DbRetVal RepSendWrapFast(
   DB_ENV* evp, 
   ref DBT control,
   ref DBT rec,
   DB_LSN* lsnp,
   int envid,
   uint flags)
 {
   Env env = null;
   try {
     env = Util.GetEnv(evp);
     CallbackStatus cs = env.repSendFast(
       env, ref control, ref rec, lsnp, envid, unchecked((RepSendFlags)flags));
     return cs == CallbackStatus.Success ? DbRetVal.SUCCESS : DbRetVal.REPSEND_FAILED;
   }
   catch (Exception ex) {
     Trace.WriteLine(ex.Message, "RepSend");
     if (env != null)
       env.Error((int)DbRetVal.REPSEND_FAILED, ex.Message);
     else
       evp->Err(evp, (int)DbRetVal.REPSEND_FAILED, null);
     return DbRetVal.REPSEND_FAILED;
   }
 }