Ran UCDetector on the pluggable and PDB backend
4 files deleted
11 files modified
| | |
| | | abstract class AbstractTree implements Tree, Comparable<Tree> |
| | | { |
| | | /** The name of the tree within the entryContainer. */ |
| | | private TreeName name; |
| | | private final TreeName name; |
| | | |
| | | AbstractTree(final TreeName name) |
| | | { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public final void setName(TreeName name) |
| | | { |
| | | this.name = name; |
| | | } |
| | | |
| | | @Override |
| | | public final String toString() |
| | | { |
| | | return name.toString(); |
| | |
| | | return new SearchResultReference(URIList); |
| | | } |
| | | |
| | | ByteString toKey(DN dn) |
| | | private ByteString toKey(DN dn) |
| | | { |
| | | return DnKeyFormat.dnToDNKey(dn, prefixRDNComponents); |
| | | } |
| | | |
| | | ByteSequence toValue(DN dn, Entry entry) |
| | | { |
| | | // FIXME JNR This is not very efficient: |
| | | // getReferralsURL() converts from bytestring into string |
| | | // and the code down below then does the reverse |
| | | return encode(dn, entry.getReferralURLs()); |
| | | } |
| | | } |
| | |
| | | * is a byte array, and is constructed from some normalized form of an attribute value (or fragment |
| | | * of a value) appearing in the entry. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | class DefaultIndex extends AbstractTree implements Index |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | |
| | | return codec.decode(key, value); |
| | | } |
| | | |
| | | ByteString toValue(EntryID entryID) |
| | | { |
| | | return codec.encode(newDefinedSet(entryID.longValue())); |
| | | } |
| | | |
| | | ByteString toValue(EntryIDSet entryIDSet) |
| | | { |
| | | return codec.encode(entryIDSet); |
| | | } |
| | | |
| | | ByteString toValue(ImportIDSet importIDSet) |
| | | { |
| | | return importIDSet.valueToByteString(codec); |
| | | } |
| | | |
| | | @Override |
| | | public final void update(final WriteableTransaction txn, final ByteString key, final EntryIDSet deletedIDs, |
| | | final EntryIDSet addedIDs) throws StorageRuntimeException |
| | |
| | | } |
| | | } |
| | | |
| | | void addEntry0(final Entry entry, final DN parentDN, final EntryID entryID, final IndexBuffer indexBuffer, |
| | | private void addEntry0(final Entry entry, final DN parentDN, final EntryID entryID, final IndexBuffer indexBuffer, |
| | | final ByteString encodedEntry, WriteableTransaction txn) throws DirectoryException |
| | | { |
| | | // Check that the parent entry exists. |
| | |
| | | } |
| | | |
| | | /** |
| | | * Clear the contents for a tree from disk. |
| | | * |
| | | * @param txn a non null transaction |
| | | * @param tree The tree to clear. |
| | | * @throws StorageRuntimeException if a storage error occurs. |
| | | */ |
| | | void clearTree(WriteableTransaction txn, Tree tree) throws StorageRuntimeException |
| | | { |
| | | try |
| | | { |
| | | tree.delete(txn); |
| | | } |
| | | finally |
| | | { |
| | | tree.open(txn, true); |
| | | } |
| | | if(logger.isTraceEnabled()) |
| | | { |
| | | logger.trace("Cleared the tree %s", tree.getName()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Finds an existing entry whose DN is the closest ancestor of a given baseDN. |
| | | * |
| | | * @param baseDN the DN for which we are searching a matched DN. |
| | |
| | | return concreteImpl.getRange(); |
| | | } |
| | | |
| | | static long addWithoutOverflow(long a, long b) { |
| | | // a and b must be > 0 |
| | | final long result = a + b; |
| | | return result >= 0 ? result : Long.MAX_VALUE; |
| | | } |
| | | |
| | | private static long[] mergeOverlappingEntryIDSet(long set1[], long set2[]) |
| | | { |
| | | final long[] a, b; |
| | |
| | | return getKeyFromEntryIDAndBucket(entryID, bucket); |
| | | } |
| | | |
| | | ByteSequence toKey(EntryID entryID) |
| | | { |
| | | if (entryID == null) |
| | | { |
| | | entryID = TOTAL_COUNT_ENTRY_ID; |
| | | } |
| | | return getShardedKey(entryID); |
| | | } |
| | | |
| | | ByteString toValue(final long count) |
| | | { |
| | | Reject.ifFalse(count != 0, "count must be != 0"); |
| | |
| | | private final EntryID entryID; |
| | | private final EntryContainer entryContainer; |
| | | |
| | | EntryInformation(Entry entry, EntryID entryID, EntryContainer entryContainer) |
| | | private EntryInformation(Entry entry, EntryID entryID, EntryContainer entryContainer) |
| | | { |
| | | this.entry = entry; |
| | | this.entryID = entryID; |
| | |
| | | this.importStrategy = importStrategy; |
| | | } |
| | | |
| | | public void doImport(final Source source) throws Exception |
| | | private void doImport(final Source source) throws Exception |
| | | { |
| | | final long phaseOneStartTime = System.currentTimeMillis(); |
| | | final PhaseOneWriteableTransaction transaction = new PhaseOneWriteableTransaction(importStrategy); |
| | |
| | | private final long startOffset; |
| | | private long size; |
| | | private MappedByteBuffer mmapBuffer; |
| | | private OutputStream mmapBufferOS = new OutputStream() |
| | | private final OutputStream mmapBufferOS = new OutputStream() |
| | | { |
| | | @Override |
| | | public void write(int arg0) throws IOException |
| | |
| | | } |
| | | } |
| | | |
| | | static boolean supportOffHeap() |
| | | private static boolean supportOffHeap() |
| | | { |
| | | return unsafe != null; |
| | | } |
| | |
| | | return bufferSize; |
| | | } |
| | | |
| | | public Buffer get() |
| | | private Buffer get() |
| | | { |
| | | try |
| | | { |
| | |
| | | * @return name for this tree. |
| | | */ |
| | | TreeName getName(); |
| | | |
| | | /** |
| | | * Set the name to use for this tree. |
| | | * |
| | | * @param name The name to use for this tree. |
| | | */ |
| | | void setName(TreeName name); |
| | | } |
| | |
| | | /** Constant used to open the Storage in read-write mode; implies trees will be created if not already present. */ |
| | | READ_WRITE(true); |
| | | |
| | | private boolean readWrite; |
| | | private final boolean readWrite; |
| | | |
| | | AccessMode(boolean update) |
| | | { |
| | |
| | | return indexId; |
| | | } |
| | | |
| | | /** |
| | | * Returns a new tree name object created by replacing the baseDN of the current object. |
| | | * |
| | | * @param newBaseDN |
| | | * the new base DN that replaces the existing base DN |
| | | * @return a new tree name object with the provided the base DN |
| | | */ |
| | | public TreeName replaceBaseDN(String newBaseDN) |
| | | { |
| | | return new TreeName(newBaseDN, indexId); |
| | | } |
| | | |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |