File: ADBM.java

package info (click to toggle)
qdbm 1.8.78-6.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,952 kB
  • ctags: 5,454
  • sloc: ansic: 31,454; cpp: 3,623; perl: 2,167; java: 2,079; ruby: 1,690; makefile: 1,318; sh: 396
file content (76 lines) | stat: -rw-r--r-- 2,909 bytes parent folder | download | duplicates (10)
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
68
69
70
71
72
73
74
75
76
/*************************************************************************************************
 * Abstraction for database managers compatible with DBM
 *                                                      Copyright (C) 2000-2006 Mikio Hirabayashi
 * This file is part of QDBM, Quick Database Manager.
 * QDBM is free software; you can redistribute it and/or modify it under the terms of the GNU
 * Lesser General Public License as published by the Free Software Foundation; either version
 * 2.1 of the License or any later version.  QDBM is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
 * details.
 * You should have received a copy of the GNU Lesser General Public License along with QDBM; if
 * not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 * 02111-1307 USA.
 *************************************************************************************************/


package qdbm;



/**
 * Abstraction for database managers compatible with DBM.
 */
public interface ADBM {
  //----------------------------------------------------------------
  // methods
  //----------------------------------------------------------------
  /**
   * Close the database connection.
   * @throws DBMException if an error occurs.
   */
  void close() throws DBMException;
  /**
   * Store a record.
   * @param key a byte array of a key.
   * @param val a byte array of a value.
   * @param replace whether the existing value is to be overwritten or not.
   * @throws DBMException if an error occurs or replace is cancelled.
   */
  void store(byte[] key, byte[] val, boolean replace) throws DBMException;
  /**
   * Delete a record.
   * @param key a byte array of a key.
   * @throws DBMException if an error occurs or no record corresponds.
   */
  void delete(byte[] key) throws DBMException;
  /**
   * Fetch a record.
   * @param key a byte array of a key.
   * @return a byte array of the value of the corresponding record.
   * @throws DBMException if an error occurs or no record corresponds.
   */
  byte[] fetch(byte[] key) throws DBMException;
  /**
   * Get the first key.
   * @return a byte array of the key of the first record.
   * @throws DBMException if an error occurs or no record corresponds.
   */
  byte[] firstkey() throws DBMException;
  /**
   * Get the next key.
   * @return a byte array of the key of the next record.
   * @throws DBMException if an error occurs or no record corresponds.
   */
  byte[] nextkey() throws DBMException;
  /**
   * Check whether a fatal error occured or not.
   * @return true if the database has a fatal error, false if not.
   * @throws DBMException if an error occurs.
   */
  boolean error() throws DBMException;
}



/* END OF FILE */