summaryrefslogtreecommitdiff
path: root/lang/csharp/src/IBackup.cs
blob: 54d423eaaeccc80c5572ba9a96dee01430dd1a0d (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) 2011, 2015 Oracle and/or its affiliates.  All rights reserved.
 *
 */
using System;
using System.Collections.Generic;
using System.Text;

namespace BerkeleyDB {
    /// <summary>
    /// An interface that can optionally be used to override the default 
    /// behavior performed by the <see cref="DatabaseEnvironment.Backup"/> and 
    /// <see cref="DatabaseEnvironment.BackupDatabase"/> methods. Implementation 
    /// of this interface is required if the DatabaseEnvironment.backup or 
    /// DatabaseEnvironment.backupDatabase target parameter is null.  You 
    /// configure the environment with this handler via 
    /// <see cref="DatabaseEnvironment.BackupHandler"/>.
    /// </summary>
    public interface IBackup {
        /// <summary>
        /// Called when ending a backup and closing a backup target.
        /// </summary>
        /// <param name="dbname">The name of the database that has been backed 
        /// up.</param>
        /// <returns>0 on success, non-zero on error.</returns>
        int Close(string dbname);
        /// <summary>
        /// Called when a target location is opened during a backup. This method
        /// should do whatever is necessary to prepare the backup destination 
        /// for writing the data.
        /// </summary>
        /// <param name="dbname">The backup's directory destination.</param>
        /// <param name="target">The name of the database being backed up.</param>
        /// <returns>0 on success, non-zero on error.</returns>
        int Open(string dbname, string target);
        /// <summary>
        /// Called when writing data during a backup. 
        /// </summary>
        /// <param name="data">Identifies the buffer which contains the data to
        /// be backed up.</param>
        /// <param name="offset">Identifies the position in the file where 
        /// bytes from buf should be written.</param>
        /// <param name="count">Identifies the number of bytes to write to the 
        /// file from the buffer.</param>
        /// <returns>0 on success, non-zero on error.</returns>
        int Write(byte[] data, long offset, int count);
    }
}