/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2009 Oracle. All rights reserved. * */ using System; using System.Collections.Generic; using System.Text; using BerkeleyDB.Internal; namespace BerkeleyDB { /// /// A class representing configuration parameters for /// public class CursorConfig { /// /// The isolation degree the cursor should use. /// /// /// /// ensures the stability of the /// current data item read by this cursor but permits data read by this /// cursor to be modified or deleted prior to the commit of the /// transaction for this cursor. /// /// /// allows read operations performed /// by the cursor to return modified but not yet committed data. /// Silently ignored if the /// was not specified when the underlying database was opened. /// /// public Isolation IsolationDegree; /// /// If true, specify that the cursor will be used to update the /// database. The underlying database environment must have been opened /// with set. /// public bool WriteCursor; /// /// /// Configure a transactional cursor to operate with read-only snapshot /// isolation. For databases with /// set, data values will be read as they are when the cursor is opened, /// without taking read locks. /// /// /// This setting implicitly begins a transaction that is committed when /// the cursor is closed. /// /// /// This setting is silently ignored if /// is not set on the underlying /// database or if a transaction is supplied to /// /// /// public bool SnapshotIsolation; /// /// The cache priority for pages referenced by the cursor. /// /// /// The priority of a page biases the replacement algorithm to be more /// or less likely to discard a page when space is needed in the buffer /// pool. The bias is temporary, and pages will eventually be discarded /// if they are not referenced again. The setting is only advisory, and /// does not guarantee pages will be treated in a specific way. /// public CachePriority Priority; /// /// Instantiate a new CursorConfig object /// public CursorConfig() { IsolationDegree = Isolation.DEGREE_THREE; } internal uint flags { get { uint ret = 0; ret |= (IsolationDegree == Isolation.DEGREE_ONE) ? DbConstants.DB_READ_UNCOMMITTED : 0; ret |= (IsolationDegree == Isolation.DEGREE_TWO) ? DbConstants.DB_READ_COMMITTED : 0; ret |= (WriteCursor) ? DbConstants.DB_WRITECURSOR : 0; ret |= (SnapshotIsolation) ? DbConstants.DB_TXN_SNAPSHOT : 0; return ret; } } } }