File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\store\DataHandler.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License,
3 * Version 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html).
5 * Initial Developer: H2 Group
6 */
7 package org.h2.store;
8
9 import java.sql.Connection;
10 import org.h2.message.DbException;
11 import org.h2.util.SmallLRUCache;
12 import org.h2.util.TempFileDeleter;
13
14 /**
15 * A data handler contains a number of callback methods.
16 * The most important implementing class is a database.
17 */
18 public interface DataHandler {
19
20 /**
21 * Get the database path.
22 *
23 * @return the database path
24 */
25 String getDatabasePath();
26
27 /**
28 * Open a file at the given location.
29 *
30 * @param name the file name
31 * @param mode the mode
32 * @param mustExist whether the file must already exist
33 * @return the file
34 */
35 FileStore openFile(String name, String mode, boolean mustExist);
36
37 /**
38 * Check if the simulated power failure occurred.
39 * This call will decrement the countdown.
40 *
41 * @throws DbException if the simulated power failure occurred
42 */
43 void checkPowerOff() throws DbException;
44
45 /**
46 * Check if writing is allowed.
47 *
48 * @throws DbException if it is not allowed
49 */
50 void checkWritingAllowed() throws DbException;
51
52 /**
53 * Get the maximum length of a in-place large object
54 *
55 * @return the maximum size
56 */
57 int getMaxLengthInplaceLob();
58
59 /**
60 * Get the compression algorithm used for large objects.
61 *
62 * @param type the data type (CLOB or BLOB)
63 * @return the compression algorithm, or null
64 */
65 String getLobCompressionAlgorithm(int type);
66
67 /**
68 * Get the temp file deleter mechanism.
69 *
70 * @return the temp file deleter
71 */
72 TempFileDeleter getTempFileDeleter();
73
74 /**
75 * Get the synchronization object for lob operations.
76 *
77 * @return the synchronization object
78 */
79 Object getLobSyncObject();
80
81 /**
82 * Get the lob file list cache if it is used.
83 *
84 * @return the cache or null
85 */
86 SmallLRUCache<String, String[]> getLobFileListCache();
87
88 /**
89 * Get the lob storage mechanism to use.
90 *
91 * @return the lob storage mechanism
92 */
93 LobStorage getLobStorage();
94
95 /**
96 * Get a database connection to be used for LOB access.
97 *
98 * @return the connection or null
99 */
100 Connection getLobConnection();
101
102 /**
103 * Read from a lob.
104 *
105 * @param lobId the lob
106 * @param hmac the message authentication code
107 * @param offset the offset within the lob
108 * @param buff the target buffer
109 * @param off the offset within the target buffer
110 * @param length the number of bytes to read
111 * @return the number of bytes read
112 */
113 int readLob(long lobId, byte[] hmac, long offset, byte[] buff, int off, int length);
114
115 }
116