Imported Upstream version 5.3.21
[platform/upstream/libdb.git] / lang / csharp / src / VerboseMessages.cs
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2009, 2012 Oracle and/or its affiliates.  All rights reserved.
5  *
6  */
7 using System;
8 using System.Collections.Generic;
9 using System.Text;
10 using BerkeleyDB.Internal;
11
12 namespace BerkeleyDB {
13     /// <summary>
14     /// Enable specific additional informational and debugging messages.
15     /// </summary>
16     public class VerboseMessages {
17         /// <summary>
18         /// Display additional information when performing hot backup.
19         /// </summary>
20         public bool Backup;
21         /// <summary>
22         /// Display additional information when doing deadlock detection.
23         /// </summary>
24         public bool Deadlock;
25         /// <summary>
26         /// Display additional information when performing filesystem operations
27         /// such as open, close or rename. May not be available on all
28         /// platforms. 
29         /// </summary>
30         public bool FileOps;
31         /// <summary>
32         /// Display additional information when performing all filesystem
33         /// operations, including read and write. May not be available on all
34         /// platforms. 
35         /// </summary>
36         public bool AllFileOps;
37         /// <summary>
38         /// Display additional information when performing recovery.
39         /// </summary>
40         public bool Recovery;
41         /// <summary>
42         /// Display additional information concerning support for
43         /// <see cref="DatabaseEnvironment.Register"/>
44         /// </summary>
45         public bool Register;
46         /// <summary>
47         /// Display all detailed information about replication. This includes
48         /// the information displayed by all of the other Replication* and
49         /// RepMgr* values. 
50         /// </summary>
51         public bool Replication;
52         /// <summary>
53         /// Display detailed information about Replication Manager connection
54         /// failures. 
55         /// </summary>
56         public bool RepMgrConnectionFailure;
57         /// <summary>
58         /// Display detailed information about general Replication Manager
59         /// processing. 
60         /// </summary>
61         public bool RepMgrMisc;
62         /// <summary>
63         /// Display detailed information about replication elections.
64         /// </summary>
65         public bool ReplicationElection;
66         /// <summary>
67         /// Display detailed information about replication master leases. 
68         /// </summary>
69         public bool ReplicationLease;
70         /// <summary>
71         /// Display detailed information about general replication processing
72         /// not covered by the other Replication* values. 
73         /// </summary>
74         public bool ReplicationMisc;
75         /// <summary>
76         /// Display detailed information about replication message processing. 
77         /// </summary>
78         public bool ReplicationMessages;
79         /// <summary>
80         /// Display detailed information about replication client
81         /// synchronization. 
82         /// </summary>
83         public bool ReplicationSync;
84         /// <summary>
85         /// Saves replication system information to a system-owned file. This
86         /// value is on by default. 
87         /// </summary>
88         public bool ReplicationSystemInfo;
89         /// <summary>
90         /// 
91         /// </summary>
92         public bool ReplicationTest;
93         /// <summary>
94         /// Display the waits-for table when doing deadlock detection.
95         /// </summary>
96         public bool WaitsForTable;
97
98         internal uint MessagesOn {
99             get {
100                 uint ret = 0;
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;
118                 return ret;
119             }
120         }
121         internal uint MessagesOff {
122             get{
123                 uint ret = 0;
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;
141                 return ret;
142             }
143         }
144
145         internal static VerboseMessages FromFlags(uint flags) {
146             VerboseMessages ret = new VerboseMessages();
147
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);
165             
166             return ret;
167         }
168     }
169 }