From 0bd57577bb85119b2b4495c5ef525ba189d8d17c Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 04 Mar 2015 23:14:55 +0000
Subject: [PATCH] OPENDJ-1848: in-line and remove various storage related access methods from DatabaseContainer.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
index 189e88f..db32aac 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2ID.java
@@ -76,8 +76,7 @@
{
ByteString key = dnToDNKey(dn, prefixRDNComponents);
ByteString value = id.toByteString();
-
- return insert(txn, key, value);
+ return txn.putIfAbsent(getName(), key, value);
}
/**
@@ -93,7 +92,7 @@
{
ByteString key = dnToDNKey(dn, prefixRDNComponents);
- return delete(txn, key);
+ return txn.delete(getName(), key);
}
/**
@@ -101,14 +100,24 @@
* @param txn A JE database transaction to be used for the database read, or
* null if none is required.
* @param dn The DN for which the entry ID is desired.
- * @param isRMW whether the read operation is part of a larger read-modify-write operation
* @return The entry ID, or null if the given DN is not in the DN database.
* @throws StorageRuntimeException If an error occurs in the JE database.
*/
- EntryID get(ReadableStorage txn, DN dn, boolean isRMW) throws StorageRuntimeException
+ EntryID get(ReadableStorage txn, DN dn) throws StorageRuntimeException
{
ByteString key = dnToDNKey(dn, prefixRDNComponents);
- ByteString value = read(txn, key, isRMW);
+ ByteString value = txn.read(getName(), key);
+ if (value != null)
+ {
+ return new EntryID(value);
+ }
+ return null;
+ }
+
+ EntryID getRMW(ReadableStorage txn, DN dn) throws StorageRuntimeException
+ {
+ ByteString key = dnToDNKey(dn, prefixRDNComponents);
+ ByteString value = txn.getRMW(getName(), key);
if (value != null)
{
return new EntryID(value);
--
Gitblit v1.10.0