2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved.
8 using System.Collections.Generic;
10 using BerkeleyDB.Internal;
12 namespace BerkeleyDB {
14 /// Enable specific additional informational and debugging messages.
16 public class VerboseMessages {
18 /// Display additional information when performing hot backup.
22 /// Display additional information when doing deadlock detection.
26 /// Display additional information when performing filesystem operations
27 /// such as open, close or rename. May not be available on all
32 /// Display additional information when performing all filesystem
33 /// operations, including read and write. May not be available on all
36 public bool AllFileOps;
38 /// Display additional information when performing recovery.
42 /// Display additional information concerning support for
43 /// <see cref="DatabaseEnvironment.Register"/>
47 /// Display all detailed information about replication. This includes
48 /// the information displayed by all of the other Replication* and
51 public bool Replication;
53 /// Display detailed information about Replication Manager connection
56 public bool RepMgrConnectionFailure;
58 /// Display detailed information about general Replication Manager
61 public bool RepMgrMisc;
63 /// Display detailed information about replication elections.
65 public bool ReplicationElection;
67 /// Display detailed information about replication master leases.
69 public bool ReplicationLease;
71 /// Display detailed information about general replication processing
72 /// not covered by the other Replication* values.
74 public bool ReplicationMisc;
76 /// Display detailed information about replication message processing.
78 public bool ReplicationMessages;
80 /// Display detailed information about replication client
83 public bool ReplicationSync;
85 /// Saves replication system information to a system-owned file. This
86 /// value is on by default.
88 public bool ReplicationSystemInfo;
92 public bool ReplicationTest;
94 /// Display the waits-for table when doing deadlock detection.
96 public bool WaitsForTable;
98 internal uint MessagesOn {
101 ret |= Backup ? DbConstants.DB_VERB_BACKUP : 0;
102 ret |= Deadlock ? DbConstants.DB_VERB_DEADLOCK : 0;
103 ret |= FileOps ? DbConstants.DB_VERB_FILEOPS : 0;
104 ret |= AllFileOps ? DbConstants.DB_VERB_FILEOPS_ALL : 0;
105 ret |= Recovery ? DbConstants.DB_VERB_RECOVERY : 0;
106 ret |= Register ? DbConstants.DB_VERB_REGISTER : 0;
107 ret |= Replication ? DbConstants.DB_VERB_REPLICATION : 0;
108 ret |= RepMgrConnectionFailure ? DbConstants.DB_VERB_REPMGR_CONNFAIL : 0;
109 ret |= RepMgrMisc ? DbConstants.DB_VERB_REPMGR_MISC : 0;
110 ret |= ReplicationElection ? DbConstants.DB_VERB_REP_ELECT : 0;
111 ret |= ReplicationLease ? DbConstants.DB_VERB_REP_LEASE : 0;
112 ret |= ReplicationMisc ? DbConstants.DB_VERB_REP_MISC : 0;
113 ret |= ReplicationMessages ? DbConstants.DB_VERB_REP_MSGS : 0;
114 ret |= ReplicationSync ? DbConstants.DB_VERB_REP_SYNC : 0;
115 ret |= ReplicationSystemInfo ? DbConstants.DB_VERB_REP_SYSTEM : 0;
116 ret |= ReplicationTest ? DbConstants.DB_VERB_REP_TEST : 0;
117 ret |= WaitsForTable ? DbConstants.DB_VERB_WAITSFOR : 0;
121 internal uint MessagesOff {
124 ret |= Backup ? 0 : DbConstants.DB_VERB_BACKUP;
125 ret |= Deadlock ? 0 : DbConstants.DB_VERB_DEADLOCK;
126 ret |= FileOps ? 0 : DbConstants.DB_VERB_FILEOPS;
127 ret |= AllFileOps ? 0 : DbConstants.DB_VERB_FILEOPS_ALL;
128 ret |= Recovery ? 0 : DbConstants.DB_VERB_RECOVERY;
129 ret |= Register ? 0 : DbConstants.DB_VERB_REGISTER;
130 ret |= Replication ? 0 : DbConstants.DB_VERB_REPLICATION;
131 ret |= RepMgrConnectionFailure ? 0 : DbConstants.DB_VERB_REPMGR_CONNFAIL;
132 ret |= RepMgrMisc ? 0 : DbConstants.DB_VERB_REPMGR_MISC;
133 ret |= ReplicationElection ? 0 : DbConstants.DB_VERB_REP_ELECT;
134 ret |= ReplicationLease ? 0 : DbConstants.DB_VERB_REP_LEASE;
135 ret |= ReplicationMisc ? 0 : DbConstants.DB_VERB_REP_MISC;
136 ret |= ReplicationMessages ? 0 : DbConstants.DB_VERB_REP_MSGS;
137 ret |= ReplicationSync ? 0 : DbConstants.DB_VERB_REP_SYNC;
138 ret |= ReplicationSystemInfo ? 0 : DbConstants.DB_VERB_REP_SYSTEM;
139 ret |= ReplicationTest ? 0 : DbConstants.DB_VERB_REP_TEST;
140 ret |= WaitsForTable ? 0 : DbConstants.DB_VERB_WAITSFOR;
145 internal static VerboseMessages FromFlags(uint flags) {
146 VerboseMessages ret = new VerboseMessages();
148 ret.Backup = ((flags & DbConstants.DB_VERB_BACKUP) != 0);
149 ret.Deadlock = ((flags & DbConstants.DB_VERB_DEADLOCK) != 0);
150 ret.FileOps = ((flags & DbConstants.DB_VERB_FILEOPS) != 0);
151 ret.AllFileOps = ((flags & DbConstants.DB_VERB_FILEOPS_ALL) != 0);
152 ret.Recovery = ((flags & DbConstants.DB_VERB_RECOVERY) != 0);
153 ret.Register = ((flags & DbConstants.DB_VERB_REGISTER) != 0);
154 ret.Replication = ((flags & DbConstants.DB_VERB_REPLICATION) != 0);
155 ret.RepMgrConnectionFailure = ((flags & DbConstants.DB_VERB_REPMGR_CONNFAIL) != 0);
156 ret.RepMgrMisc = ((flags & DbConstants.DB_VERB_REPMGR_MISC) != 0);
157 ret.ReplicationElection = ((flags & DbConstants.DB_VERB_REP_ELECT) != 0);
158 ret.ReplicationLease = ((flags & DbConstants.DB_VERB_REP_LEASE) != 0);
159 ret.ReplicationMisc = ((flags & DbConstants.DB_VERB_REP_MISC) != 0);
160 ret.ReplicationMessages = ((flags & DbConstants.DB_VERB_REP_MSGS) != 0);
161 ret.ReplicationSync = ((flags & DbConstants.DB_VERB_REP_SYNC) != 0);
162 ret.ReplicationSystemInfo = ((flags & DbConstants.DB_VERB_REP_SYSTEM) != 0);
163 ret.ReplicationTest = ((flags & DbConstants.DB_VERB_REP_TEST) != 0);
164 ret.WaitsForTable = ((flags & DbConstants.DB_VERB_WAITSFOR) != 0);