1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2009 Oracle. All rights reserved. 5 * 6 */ 7using System; 8using System.Collections.Generic; 9using System.Text; 10using BerkeleyDB.Internal; 11 12namespace BerkeleyDB { 13 /// <summary> 14 /// Enable specific additional informational and debugging messages. 15 /// </summary> 16 public class VerboseMessages { 17 /// <summary> 18 /// Display additional information when doing deadlock detection. 19 /// </summary> 20 public bool Deadlock; 21 /// <summary> 22 /// Display additional information when performing filesystem operations 23 /// such as open, close or rename. May not be available on all 24 /// platforms. 25 /// </summary> 26 public bool FileOps; 27 /// <summary> 28 /// Display additional information when performing all filesystem 29 /// operations, including read and write. May not be available on all 30 /// platforms. 31 /// </summary> 32 public bool AllFileOps; 33 /// <summary> 34 /// Display additional information when performing recovery. 35 /// </summary> 36 public bool Recovery; 37 /// <summary> 38 /// Display additional information concerning support for 39 /// <see cref="DatabaseEnvironment.Register"/> 40 /// </summary> 41 public bool Register; 42 /// <summary> 43 /// Display all detailed information about replication. This includes 44 /// the information displayed by all of the other Replication* and 45 /// RepMgr* values. 46 /// </summary> 47 public bool Replication; 48 /// <summary> 49 /// Display detailed information about Replication Manager connection 50 /// failures. 51 /// </summary> 52 public bool RepMgrConnectionFailure; 53 /// <summary> 54 /// Display detailed information about general Replication Manager 55 /// processing. 56 /// </summary> 57 public bool RepMgrMisc; 58 /// <summary> 59 /// Display detailed information about replication elections. 60 /// </summary> 61 public bool ReplicationElection; 62 /// <summary> 63 /// Display detailed information about replication master leases. 64 /// </summary> 65 public bool ReplicationLease; 66 /// <summary> 67 /// Display detailed information about general replication processing 68 /// not covered by the other Replication* values. 69 /// </summary> 70 public bool ReplicationMisc; 71 /// <summary> 72 /// Display detailed information about replication message processing. 73 /// </summary> 74 public bool ReplicationMessages; 75 /// <summary> 76 /// Display detailed information about replication client 77 /// synchronization. 78 /// </summary> 79 public bool ReplicationSync; 80 /// <summary> 81 /// 82 /// </summary> 83 public bool ReplicationTest; 84 /// <summary> 85 /// Display the waits-for table when doing deadlock detection. 86 /// </summary> 87 public bool WaitsForTable; 88 89 internal uint MessagesOn { 90 get { 91 uint ret = 0; 92 ret |= Deadlock ? DbConstants.DB_VERB_DEADLOCK : 0; 93 ret |= FileOps ? DbConstants.DB_VERB_FILEOPS : 0; 94 ret |= AllFileOps ? DbConstants.DB_VERB_FILEOPS_ALL : 0; 95 ret |= Recovery ? DbConstants.DB_VERB_RECOVERY : 0; 96 ret |= Register ? DbConstants.DB_VERB_REGISTER : 0; 97 ret |= Replication ? DbConstants.DB_VERB_REPLICATION : 0; 98 ret |= RepMgrConnectionFailure ? DbConstants.DB_VERB_REPMGR_CONNFAIL : 0; 99 ret |= RepMgrMisc ? DbConstants.DB_VERB_REPMGR_MISC : 0; 100 ret |= ReplicationElection ? DbConstants.DB_VERB_REP_ELECT : 0; 101 ret |= ReplicationLease ? DbConstants.DB_VERB_REP_LEASE : 0; 102 ret |= ReplicationMisc ? DbConstants.DB_VERB_REP_MISC : 0; 103 ret |= ReplicationMessages ? DbConstants.DB_VERB_REP_MSGS : 0; 104 ret |= ReplicationSync ? DbConstants.DB_VERB_REP_SYNC : 0; 105 ret |= ReplicationTest ? DbConstants.DB_VERB_REP_TEST : 0; 106 ret |= WaitsForTable ? DbConstants.DB_VERB_WAITSFOR : 0; 107 return ret; 108 } 109 } 110 internal uint MessagesOff { 111 get{ 112 uint ret = 0; 113 ret |= Deadlock ? 0 : DbConstants.DB_VERB_DEADLOCK; 114 ret |= FileOps ? 0 : DbConstants.DB_VERB_FILEOPS; 115 ret |= AllFileOps ? 0 : DbConstants.DB_VERB_FILEOPS_ALL; 116 ret |= Recovery ? 0 : DbConstants.DB_VERB_RECOVERY; 117 ret |= Register ? 0 : DbConstants.DB_VERB_REGISTER; 118 ret |= Replication ? 0 : DbConstants.DB_VERB_REPLICATION; 119 ret |= RepMgrConnectionFailure ? 0 : DbConstants.DB_VERB_REPMGR_CONNFAIL; 120 ret |= RepMgrMisc ? 0 : DbConstants.DB_VERB_REPMGR_MISC; 121 ret |= ReplicationElection ? 0 : DbConstants.DB_VERB_REP_ELECT; 122 ret |= ReplicationLease ? 0 : DbConstants.DB_VERB_REP_LEASE; 123 ret |= ReplicationMisc ? 0 : DbConstants.DB_VERB_REP_MISC; 124 ret |= ReplicationMessages ? 0 : DbConstants.DB_VERB_REP_MSGS; 125 ret |= ReplicationSync ? 0 : DbConstants.DB_VERB_REP_SYNC; 126 ret |= ReplicationTest ? 0 : DbConstants.DB_VERB_REP_TEST; 127 ret |= WaitsForTable ? 0 : DbConstants.DB_VERB_WAITSFOR; 128 return ret; 129 } 130 } 131 132 internal static VerboseMessages FromFlags(uint flags) { 133 VerboseMessages ret = new VerboseMessages(); 134 135 ret.Deadlock = ((flags & DbConstants.DB_VERB_DEADLOCK) != 0); 136 ret.FileOps = ((flags & DbConstants.DB_VERB_FILEOPS) != 0); 137 ret.AllFileOps = ((flags & DbConstants.DB_VERB_FILEOPS_ALL) != 0); 138 ret.Recovery = ((flags & DbConstants.DB_VERB_RECOVERY) != 0); 139 ret.Register = ((flags & DbConstants.DB_VERB_REGISTER) != 0); 140 ret.Replication = ((flags & DbConstants.DB_VERB_REPLICATION) != 0); 141 ret.RepMgrConnectionFailure = ((flags & DbConstants.DB_VERB_REPMGR_CONNFAIL) != 0); 142 ret.RepMgrMisc = ((flags & DbConstants.DB_VERB_REPMGR_MISC) != 0); 143 ret.ReplicationElection = ((flags & DbConstants.DB_VERB_REP_ELECT) != 0); 144 ret.ReplicationLease = ((flags & DbConstants.DB_VERB_REP_LEASE) != 0); 145 ret.ReplicationMisc = ((flags & DbConstants.DB_VERB_REP_MISC) != 0); 146 ret.ReplicationMessages = ((flags & DbConstants.DB_VERB_REP_MSGS) != 0); 147 ret.ReplicationSync = ((flags & DbConstants.DB_VERB_REP_SYNC) != 0); 148 ret.ReplicationTest = ((flags & DbConstants.DB_VERB_REP_TEST) != 0); 149 ret.WaitsForTable = ((flags & DbConstants.DB_VERB_WAITSFOR) != 0); 150 151 return ret; 152 } 153 } 154} 155