public void SetFlags(SeqFlags flags) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->SetFlags(seqp, flags); } Util.CheckRetVal(ret); }
public void GetRange(out Int64 min, out Int64 max) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->GetRange(seqp, out min, out max); } Util.CheckRetVal(ret); }
public void SetRange(Int64 min, Int64 max) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->SetRange(seqp, min, max); } Util.CheckRetVal(ret); }
public void PrintStats(BerkeleyDb.StatPrintFlags flags) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->StatPrint(seqp, unchecked ((UInt32)flags)); } Util.CheckRetVal(ret); }
public void SetInitialValue(Int64 value) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->InitialValue(seqp, value); } Util.CheckRetVal(ret); }
// does not check if disposed internal static Db GetDb(DB_SEQUENCE *seqp) { // DB* dbp; // DbRetVal ret = seqp->GetDb(seqp, out dbp); // Util.CheckRetVal(ret); // workaround for bug in GetDb - does not return dbp when sequence not open DB *dbp = seqp->seq_dbp; Db db = Util.GetDb(dbp); return(db); }
protected DB_SEQUENCE *CheckDisposed() { // avoid multiple volatile memory access DB_SEQUENCE *seqp = this.seqp; if (seqp == null) { throw new ObjectDisposedException(disposedStr); } return(seqp); }
// should be run in a CER, under a lock on rscLock, and not throw exceptions internal DbRetVal AllocateHandle(DB* dbp, UInt32 flags) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE* seqp; ret = LibDb.db_sequence_create(out seqp, dbp, flags); if (ret == DbRetVal.SUCCESS) { this.seqp = seqp; seqp->api_internal = (IntPtr)instanceHandle; } } return ret; }
public SeqFlags GetFlags() { SeqFlags flags; DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); ret = seqp->GetFlags(seqp, out flags); } Util.CheckRetVal(ret); return(flags); }
// should be run in a CER, under a lock on rscLock, and not throw exceptions internal DbRetVal AllocateHandle(DB *dbp, UInt32 flags) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp; ret = LibDb.db_sequence_create(out seqp, dbp, flags); if (ret == DbRetVal.SUCCESS) { this.seqp = seqp; seqp->api_internal = (IntPtr)instanceHandle; } } return(ret); }
Int64 Get(DB_TXN *txp, Int32 delta, ReadFlags flags) { Int64 value; DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); if (SeqGet == null) { throw new BdbException("Sequence must be open."); } ret = SeqGet(seqp, txp, delta, out value, unchecked ((UInt32)flags)); } Util.CheckRetVal(ret); return(value); }
// should be run in a CER, under a lock on rscLock, and not throw exceptions DbRetVal ReleaseUnmanagedResources() { DB_SEQUENCE *seqp = this.seqp; if (seqp == null) { return(DbRetVal.SUCCESS); } // DB_SEQUENCE->Close() could be a lengthy call, so we call Disposed() first, and the // CER ensures that we reach DB_SEQUENCE->Close() without external interruption. // This is OK because one must not use the handle after DB_SEQUENCE->Close() was called, // regardless of the return value. Disposed(); DbRetVal ret = seqp->Close(seqp, 0); return(ret); }
DbRetVal Open(DB_TXN *txp, ref DbEntry key, OpenFlags flags) { DbRetVal ret; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); fixed(byte *keyBufP = key.Buffer) { key.dbt.data = keyBufP + key.Start; ret = seqp->Open(seqp, txp, ref key.dbt, unchecked ((UInt32)flags)); } // initialize function pointer delegates SeqGet = seqp->Get; } return(ret); }
public SequenceStats GetStats(StatFlags flags) { SequenceStats value; DB_SEQUENCE_STAT *sp; lock (rscLock) { DB_SEQUENCE *seqp = CheckDisposed(); RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { DbRetVal ret = seqp->Stat(seqp, out sp, unchecked ((UInt32)flags)); Util.CheckRetVal(ret); value.seqStats = *sp; LibDb.os_ufree(null, sp); } } return(value); }
DbRetVal Remove(DB_TXN *txp, RemoveFlags flags) { DbRetVal ret; // always lock Db first, to avoid deadlock lock (db.rscLock) { lock (rscLock) { RuntimeHelpers.PrepareConstrainedRegions(); try { } finally { DB_SEQUENCE *seqp = CheckDisposed(); // DB_SEQUENCE->Remove() could be a lengthy call, so we call Disposed() first, and the // CER ensures that we reach DB_SEQUENCE->Remove() without external interruption. // This is OK because one must not use the handle after DB_SEQUENCE->Remove() was called, // regardless of the return value. Disposed(); ret = seqp->Remove(seqp, txp, unchecked ((UInt32)flags)); } } } return(ret); }
// does not check for seqp == null or db == null! void Disposed() { seqp = null; // unregister with resource manager db.RemoveSequence(this); }
// does not check for seqp == null or db == null! void Disposed() { seqp = null; // unregister with resource manager db.RemoveSequence(this); }