summaryrefslogtreecommitdiff
path: root/lang/csharp/src/RepMgrSite.cs
blob: 41bf1a0e22a992dd8470bebe15aee18c28bebb05 (plain)
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
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2009, 2015 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 a replication site used by Replication Manager.
    /// </summary>
    public class RepMgrSite {
        
        /// <summary>
        /// Environment ID assigned by the replication manager. This is the same
        /// value that is passed to
        /// <see cref="DatabaseEnvironment.EventNotify"/> for the
        /// <see cref="NotificationEvent.REP_NEWMASTER"/> event.
        /// </summary>
        public int EId;
        /// <summary>
        /// The address of the site.
        /// </summary>
        public ReplicationHostAddress Address;
        /// <summary>
        /// If true, the site is connected.
        /// </summary>
        public bool isConnected;
        /// <summary>
        /// If true, the site is client-to-client peer.
        /// </summary>
        public bool isPeer;
        /// <summary>
        /// If true, the site is a view site.
        /// </summary>
        public bool isView;

        internal RepMgrSite(DB_REPMGR_SITE site) {
            EId = site.eid;
            Address = new ReplicationHostAddress(site.host, site.port);
            isConnected = (site.status == DbConstants.DB_REPMGR_CONNECTED);
            isPeer = (site.flags & DbConstants.DB_REPMGR_ISPEER) != 0;
            isView = (site.flags & DbConstants.DB_REPMGR_ISVIEW) != 0;
        }
    }
}