Skip to content

Commit

Permalink
read of bulk of records now returns collection instead of set
Browse files Browse the repository at this point in the history
  • Loading branch information
lvca committed Oct 22, 2015
1 parent 9ad0cba commit ca035bf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
Expand Up @@ -1645,7 +1645,7 @@ public Set<ORecord> executeReadRecords(final Set<ORecordId> iRids, final boolean
if (iRids == null || iRids.isEmpty()) if (iRids == null || iRids.isEmpty())
return records; return records;


final Set<ORecordId> rids = new HashSet<ORecordId>(iRids); final Collection<ORecordId> rids = new ArrayList<ORecordId>(iRids);


for (Iterator<ORecordId> it = rids.iterator(); it.hasNext();) { for (Iterator<ORecordId> it = rids.iterator(); it.hasNext();) {
final ORecordId rid = it.next(); final ORecordId rid = it.next();
Expand All @@ -1669,7 +1669,7 @@ record = getLocalCache().findRecord(rid);
} }
} }


final List<OPair<ORecordId, ORawBuffer>> rawRecords = ((OAbstractPaginatedStorage) storage).readRecords(rids); final Collection<OPair<ORecordId, ORawBuffer>> rawRecords = ((OAbstractPaginatedStorage) storage).readRecords(rids);
for (OPair<ORecordId, ORawBuffer> entry : rawRecords) { for (OPair<ORecordId, ORawBuffer> entry : rawRecords) {
// NO SAME RECORD TYPE: CAN'T REUSE OLD ONE BUT CREATE A NEW ONE FOR IT // NO SAME RECORD TYPE: CAN'T REUSE OLD ONE BUT CREATE A NEW ONE FOR IT
final ORecord record = Orient.instance().getRecordFactoryManager().newInstance(entry.value.recordType); final ORecord record = Orient.instance().getRecordFactoryManager().newInstance(entry.value.recordType);
Expand Down
Expand Up @@ -20,20 +20,6 @@


package com.orientechnologies.orient.core.storage.impl.local; package com.orientechnologies.orient.core.storage.impl.local;


import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

import com.orientechnologies.common.concur.lock.OLockManager; import com.orientechnologies.common.concur.lock.OLockManager;
import com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException; import com.orientechnologies.common.concur.lock.OModificationOperationProhibitedException;
import com.orientechnologies.common.directmemory.ODirectMemoryPointer; import com.orientechnologies.common.directmemory.ODirectMemoryPointer;
Expand Down Expand Up @@ -127,6 +113,20 @@
import com.orientechnologies.orient.core.tx.OTxListener; import com.orientechnologies.orient.core.tx.OTxListener;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;


import java.io.*;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.FileChannel;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

/** /**
* @author Andrey Lomakin * @author Andrey Lomakin
* @since 28.03.13 * @since 28.03.13
Expand Down Expand Up @@ -3221,7 +3221,7 @@ private ORawBuffer readRecord(final OCluster clusterSegment, final ORecordId rid
* @param iRids * @param iRids
* Set of rids to load in one shot * Set of rids to load in one shot
*/ */
public List<OPair<ORecordId, ORawBuffer>> readRecords(final Set<ORecordId> iRids) { public Collection<OPair<ORecordId, ORawBuffer>> readRecords(final Collection<ORecordId> iRids) {
checkOpeness(); checkOpeness();


final List<OPair<ORecordId, ORawBuffer>> records = new ArrayList<OPair<ORecordId, ORawBuffer>>(); final List<OPair<ORecordId, ORawBuffer>> records = new ArrayList<OPair<ORecordId, ORawBuffer>>();
Expand Down Expand Up @@ -4394,7 +4394,7 @@ protected ORID getImmutableResourceId(ORID iResourceId) {
} }
} }


protected Map<Integer, List<ORecordId>> getRidsGroupedByCluster(final Set<ORecordId> iRids) { protected Map<Integer, List<ORecordId>> getRidsGroupedByCluster(final Collection<ORecordId> iRids) {
final Map<Integer, List<ORecordId>> ridsPerCluster = new HashMap<Integer, List<ORecordId>>(); final Map<Integer, List<ORecordId>> ridsPerCluster = new HashMap<Integer, List<ORecordId>>();
for (ORecordId rid : iRids) { for (ORecordId rid : iRids) {
List<ORecordId> rids = ridsPerCluster.get(rid.clusterId); List<ORecordId> rids = ridsPerCluster.get(rid.clusterId);
Expand Down

0 comments on commit ca035bf

Please sign in to comment.