| | |
| | | |
| | | /** The comparator for index keys. */ |
| | | private final Comparator<byte[]> comparator; |
| | | |
| | | /** The comparator for index keys. */ |
| | | private final Comparator<ByteSequence> bsComparator; |
| | | |
| | | /** The limit on the number of entry IDs that may be indexed by one key. */ |
| | | private int indexEntryLimit; |
| | | |
| | | /** |
| | | * Limit on the number of entry IDs that may be retrieved by cursoring |
| | | * through an index. |
| | | */ |
| | | private final int cursorEntryLimit; |
| | | |
| | | /** |
| | | * Number of keys that have exceeded the entry limit since this |
| | | * object was created. |
| | |
| | | this.maintainCount = maintainCount; |
| | | this.newImportIDSet = new ImportIDSet(indexEntryLimit, |
| | | indexEntryLimit, maintainCount); |
| | | DatabaseConfig dbNodupsConfig = new DatabaseConfig(); |
| | | |
| | | final DatabaseConfig dbNodupsConfig = new DatabaseConfig(); |
| | | if(env.getConfig().getReadOnly()) |
| | | { |
| | | dbNodupsConfig.setReadOnly(true); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | private void insertKey(DatabaseEntry key, ImportIDSet importIdSet, DatabaseEntry data) throws DatabaseException { |
| | | final OperationStatus status = read(null, key, data, LockMode.DEFAULT); |
| | | if(status == OperationStatus.SUCCESS) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Insert the specified import ID set into this index. Creates a DB |
| | | * cursor if needed. |
| | |
| | | insertKey(key, importIdSet, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Delete the specified import ID set from the import ID set associated with |
| | | * the key. |
| | |
| | | deleteKey(key, importIdSet, data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Add the specified import ID set to the provided keys in the keyset. |
| | | * |
| | | * @param importIDSet A import ID set to use. |
| | | * @param keySet The set containing the keys. |
| | | * @param keyData A key database entry to use. |
| | | * @param data A database entry to use for data. |
| | | * @return <CODE>True</CODE> if the insert was successful. |
| | | * @throws DatabaseException If a database error occurs. |
| | | */ |
| | | public synchronized boolean insert(ImportIDSet importIDSet, Set<byte[]> keySet, |
| | | DatabaseEntry keyData, DatabaseEntry data) |
| | | throws DatabaseException { |
| | | for(byte[] key : keySet) { |
| | | keyData.setData(key); |
| | | insert(keyData, importIDSet, data); |
| | | } |
| | | keyData.setData(null); |
| | | data.setData(null); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * Update the set of entry IDs for a given key. |
| | | * |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reads a range of keys and collects all their entry IDs into a |
| | | * single set. |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update the index buffer for a deleted entry. |
| | | * |