summaryrefslogtreecommitdiff
path: root/lang/csharp/src/BackupOptions.cs
blob: de5c48069547c4e61f560af72f71740d3e25f1b9 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2011, 2015 Oracle and/or its affiliates.  All rights reserved.
 *
 */
using System;
using System.Collections.Generic;
using System.Text;

using BerkeleyDB.Internal;

namespace BerkeleyDB {
    /// <summary>
    /// Configuration parameters for hot backup.
    /// </summary>
    public class BackupOptions {
        /// <summary>
        /// If true, all files are removed from the target backup directory 
        /// before the backup is performed.
        /// </summary>
        public bool Clean;
        /// <summary>
        /// If true, all ordinary files that might exist in the environment or
        /// in the environment's subdirectories are backed up; otherwise, only files
        /// necessary for the proper operation of Berkeley DB are backed up.
        /// </summary>
        public bool Files;
        /// <summary>
        /// If true, log files are not included in the backup. Instead, only 
        /// *.db files are copied to the target directory.
        /// </summary>
        public bool NoLogs;
        /// <summary>
        /// If true, then regardless of the directory structure used by the 
        /// source environment, place all backup files in the single target 
        /// directory.  Use this option if absolute path names to your 
        /// environment directory and the files within that directory are 
        /// required by your application. 
        /// </summary>
        public bool SingleDir;
        /// <summary>
        /// If true, perform an incremental back up, instead of a full backup.
        /// When this option is specified, only log files are copied to the 
        /// target directory. 
        /// </summary>
        public bool Update;
        /// <summary>
        /// Specify whether the target directory is created if it does not
        /// already exist.
        /// </summary>
        public CreatePolicy Creation = CreatePolicy.NEVER;

        internal uint flags {
            get {
                uint ret = 0;
                ret |= Clean ? DbConstants.DB_BACKUP_CLEAN : 0;
                ret |= Files ? DbConstants.DB_BACKUP_FILES : 0;
                ret |= NoLogs ? DbConstants.DB_BACKUP_NO_LOGS : 0;
                ret |= SingleDir ? DbConstants.DB_BACKUP_SINGLE_DIR : 0;
                ret |= Update ? DbConstants.DB_BACKUP_UPDATE : 0;
                ret |= (uint)Creation;
                return ret;
            }
        }
    }
}