/*- * 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 the return value of /// . /// public class RepProcMsgResult { /// /// The result of processing an incoming replication message. /// public enum ProcMsgResult { /// /// The replication group has more than one master. /// /// /// The application should reconfigure itself as a client by calling /// , /// and then call for an election using /// . /// DUPLICATE_MASTER, /// /// An unspecified error occurred. /// ERROR, /// /// An election is needed. /// /// /// The application should call for an election using /// . /// HOLD_ELECTION, /// /// A message cannot be processed. /// /// /// This is an indication that a message is irrelevant to the /// current replication state (for example, an old message from a /// previous generation arrives and is processed late). /// IGNORED, /// /// Processing a message resulted in the processing of records that /// are permanent. /// /// /// is the maximum LSN of the permanent /// records stored. /// IS_PERMANENT, /// /// A new master has been chosen but the client is unable to /// synchronize with the new master. /// /// /// Possibly because the client has been configured with /// to turn off /// automatic internal initialization. /// JOIN_FAILURE, /// /// The system received contact information from a new environment. /// /// /// The rec parameter to /// contains the /// opaque data specified in the cdata parameter to /// . The /// application should take whatever action is needed to establish a /// communication channel with this new environment. /// NEW_SITE, /// /// A message carrying a DB_REP_PERMANENT flag was processed /// successfully, but was not written to disk. /// /// /// is the LSN of this record. The application /// should take whatever action is deemed necessary to retain its /// recoverability characteristics. /// NOT_PERMANENT, /// /// Processing a message succeded. /// SUCCESS }; /// /// The result of processing an incoming replication message. /// public ProcMsgResult Result; /// /// The log sequence number of the permanent log message that could not /// be written to disk if is /// . The largest log /// sequence number of the permanent records that are now written to /// disk as a result of processing the message, if /// is /// . In all other cases the /// value is undefined. /// public LSN RetLsn; internal RepProcMsgResult(int ret, LSN dblsn) { RetLsn = null; switch (ret) { case DbConstants.DB_REP_DUPMASTER: Result = ProcMsgResult.DUPLICATE_MASTER; break; case DbConstants.DB_REP_HOLDELECTION: Result = ProcMsgResult.HOLD_ELECTION; break; case DbConstants.DB_REP_IGNORE: Result = ProcMsgResult.IGNORED; break; case DbConstants.DB_REP_ISPERM: Result = ProcMsgResult.IS_PERMANENT; break; case DbConstants.DB_REP_JOIN_FAILURE: Result = ProcMsgResult.JOIN_FAILURE; break; case DbConstants.DB_REP_NEWSITE: Result = ProcMsgResult.NEW_SITE; break; case DbConstants.DB_REP_NOTPERM: Result = ProcMsgResult.NOT_PERMANENT; break; case 0: Result = ProcMsgResult.SUCCESS; break; default: Result = ProcMsgResult.ERROR; break; } } } }