File: CursorConfig.cs

package info (click to toggle)
db5.3 5.3.28-12%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 163,332 kB
  • ctags: 82,990
  • sloc: ansic: 448,411; java: 111,824; tcl: 80,544; sh: 44,326; cs: 33,697; cpp: 21,604; perl: 14,557; xml: 10,799; makefile: 4,106; yacc: 1,003; awk: 965; sql: 801; erlang: 342; python: 216; php: 24; asm: 14
file content (93 lines) | stat: -rw-r--r-- 3,720 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2009, 2013 Oracle and/or its affiliates.  All rights reserved.
 *
 */
using System;
using System.Collections.Generic;
using System.Text;
using BerkeleyDB.Internal;

namespace BerkeleyDB {
    /// <summary>
    /// A class representing configuration parameters for <see cref="Cursor"/>
    /// </summary>
    public class CursorConfig {
        /// <summary>
        /// The isolation degree the cursor should use.
        /// </summary>
        /// <remarks>
        /// <para>
        /// <see cref="Isolation.DEGREE_TWO"/> 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. 
        /// </para>
		/// <para>
        /// <see cref="Isolation.DEGREE_ONE"/> allows read operations performed
        /// by the cursor to return modified but not yet committed data.
        /// Silently ignored if the <see cref="DatabaseConfig.ReadUncommitted"/>
        /// was not specified when the underlying database was opened. 
        /// </para>
        /// </remarks>
        public Isolation IsolationDegree;
        /// <summary>
        /// If true, specify that the cursor will be used to update the
        /// database. The underlying database environment must have been opened
        /// with <see cref="DatabaseEnvironmentConfig.UseCDB"/> set. 
        /// </summary>
        public bool WriteCursor;
        /// <summary>
        /// <para>
        /// Configure a transactional cursor to operate with read-only snapshot
        /// isolation. For databases with <see cref="DatabaseConfig.UseMVCC"/>
        /// set, data values will be read as they are when the cursor is opened,
        /// without taking read locks.
        /// </para>
		/// <para>
        /// This setting implicitly begins a transaction that is committed when
        /// the cursor is closed.
        /// </para>
		/// <para>
        /// This setting is silently ignored if
        /// <see cref="DatabaseConfig.UseMVCC"/> is not set on the underlying
        /// database or if a transaction is supplied to
        /// <see cref="BaseDatabase.Cursor"/>
        /// </para>
        /// </summary>
        public bool SnapshotIsolation;
        /// <summary>
        /// The cache priority for pages referenced by the cursor.
        /// </summary>
        /// <remarks>
        /// 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.
        /// </remarks>
        public CachePriority Priority;

        /// <summary>
        /// Instantiate a new CursorConfig object
        /// </summary>
        public CursorConfig() {
            IsolationDegree = Isolation.DEGREE_THREE;
            Priority = CachePriority.DEFAULT;
        }
        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;
            }
        }
    }
}