summaryrefslogtreecommitdiff
path: root/lang/java/src/com/sleepycat/db/BackupHandler.java
blob: 7e2f3ddbb133fca2a05da37eddaae2ead697aa2b (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
/*-
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2011, 2015 Oracle and/or its affiliates.  All rights reserved.
 *
 * $Id$
 */

package com.sleepycat.db;

/**
An interface that can optionally be used to override the default behavior
performed by the
{@link com.sleepycat.db.Environment#backup Environment.backup}
and
{@link com.sleepycat.db.Environment#backupDatabase Environment.backupDatabase}
methods. Implementation of this interface is required if the 
Environment.backup or Environment.backupDatabase target parameter is null.
<p>
You configure the environment with this handler using the
{@link com.sleepycat.db.EnvironmentConfig#setBackupHandler EnvironmentConfig.setBackupHandler}
method.
*/


public interface BackupHandler {
    /**
     Called when ending a backup and closing a backup target.
     <p>
     @param dbname
     The name of the database that has been backed up.
     */
    int close(String dbname);
    /**
     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. 
     <p>
     @param target
     The backup's directory destination.
     <p>
     @param dbname
     The name of the database being backed up.
     */
    int open(String target, String dbname);
    /**
     Called when writing data during a backup. 
     <p>
     @param file_pos
     Identifies the position in the target file where the bytes 
     from the buffer should be written.
     <p>
     @param buf
     Identifies the buffer which contains the data to be backed up.
     <p>
     @param off
     Specifies the start of the data in the buffer. This will always be
     zero.
     <p>
     @param len
     Identifies the number of bytes to back up from the buffer.
     */
    int write(long file_pos, byte[] buf, int off, int len);
}