|
80 | 80 | import com.arcadedb.utility.MultiIterator; |
81 | 81 | import com.arcadedb.utility.RWLockContext; |
82 | 82 |
|
83 | | -import java.io.*; |
84 | | -import java.nio.channels.*; |
85 | | -import java.nio.file.*; |
86 | | -import java.util.*; |
87 | | -import java.util.concurrent.*; |
88 | | -import java.util.concurrent.atomic.*; |
89 | | -import java.util.concurrent.locks.*; |
90 | | -import java.util.logging.*; |
| 83 | + import java.io.File; |
| 84 | +import java.io.IOException; |
| 85 | +import java.io.RandomAccessFile; |
| 86 | +import java.nio.channels.ClosedChannelException; |
| 87 | +import java.nio.channels.FileChannel; |
| 88 | +import java.nio.channels.FileLock; |
| 89 | +import java.nio.file.Files; |
| 90 | +import java.nio.file.Path; |
| 91 | +import java.util.ArrayList; |
| 92 | +import java.util.Arrays; |
| 93 | +import java.util.Collection; |
| 94 | +import java.util.Collections; |
| 95 | +import java.util.HashMap; |
| 96 | +import java.util.Iterator; |
| 97 | +import java.util.List; |
| 98 | +import java.util.Map; |
| 99 | +import java.util.Objects; |
| 100 | +import java.util.Random; |
| 101 | +import java.util.Set; |
| 102 | +import java.util.concurrent.Callable; |
| 103 | +import java.util.concurrent.ConcurrentHashMap; |
| 104 | +import java.util.concurrent.atomic.AtomicBoolean; |
| 105 | +import java.util.concurrent.atomic.AtomicLong; |
| 106 | +import java.util.concurrent.locks.Lock; |
| 107 | +import java.util.concurrent.locks.ReentrantLock; |
| 108 | +import java.util.concurrent.locks.ReentrantReadWriteLock; |
| 109 | +import java.util.logging.Level; |
91 | 110 |
|
92 | 111 | /** |
93 | 112 | * Local implementation of {@link Database}. It is based on files opened on the local file system. |
|
99 | 118 | public class LocalDatabase extends RWLockContext implements DatabaseInternal { |
100 | 119 | public static final int EDGE_LIST_INITIAL_CHUNK_SIZE = 64; |
101 | 120 | public static final int MAX_RECOMMENDED_EDGE_LIST_CHUNK_SIZE = 8192; |
102 | | - private static final Set<String> SUPPORTED_FILE_EXT = Set.of(Dictionary.DICT_EXT, |
103 | | - LocalBucket.BUCKET_EXT, LSMTreeIndexMutable.NOTUNIQUE_INDEX_EXT, LSMTreeIndexMutable.UNIQUE_INDEX_EXT, |
104 | | - LSMTreeIndexCompacted.NOTUNIQUE_INDEX_EXT, LSMTreeIndexCompacted.UNIQUE_INDEX_EXT, HnswVectorIndex.FILE_EXT); |
| 121 | + private static final Set<String> SUPPORTED_FILE_EXT = Set.of( |
| 122 | + Dictionary.DICT_EXT, |
| 123 | + LocalBucket.BUCKET_EXT, |
| 124 | + LSMTreeIndexMutable.NOTUNIQUE_INDEX_EXT, |
| 125 | + LSMTreeIndexMutable.UNIQUE_INDEX_EXT, |
| 126 | + LSMTreeIndexCompacted.NOTUNIQUE_INDEX_EXT, |
| 127 | + LSMTreeIndexCompacted.UNIQUE_INDEX_EXT, |
| 128 | + HnswVectorIndex.FILE_EXT); |
105 | 129 | public final AtomicLong indexCompactions = new AtomicLong(); |
106 | 130 | protected final String name; |
107 | 131 | protected final ComponentFile.MODE mode; |
@@ -538,10 +562,10 @@ public void scanBucket(final String bucketName, final RecordCallback callback, f |
538 | 562 | public Iterator<Record> iterateType(final String typeName, final boolean polymorphic) { |
539 | 563 | stats.iterateType.incrementAndGet(); |
540 | 564 |
|
541 | | - return (Iterator<Record>) executeInReadLock(() -> { |
| 565 | + return executeInReadLock(() -> { |
542 | 566 | checkDatabaseIsOpen(); |
543 | | - final DocumentType type = schema.getType(typeName); |
544 | | - final MultiIterator iter = new MultiIterator(); |
| 567 | + var type = schema.getType(typeName); |
| 568 | + var iter = new MultiIterator<Record>(); |
545 | 569 |
|
546 | 570 | // SET THE PROFILED LIMITS IF ANY |
547 | 571 | iter.setLimit(getResultSetLimit()); |
@@ -1637,12 +1661,7 @@ record = events.onAfterRead(record); |
1637 | 1661 | if (record instanceof Document document) { |
1638 | 1662 | final DocumentType type = document.getType(); |
1639 | 1663 | if (type != null) { |
1640 | | -// System.out.println("invokeAfterReadEvents for type = pre"); |
1641 | | - |
1642 | | - Record record1 = ((RecordEventsRegistry) type.getEvents()).onAfterRead(record); |
1643 | | -// System.out.println("invokeAfterReadEvents for type = after"); |
1644 | | - |
1645 | | - return record1; |
| 1664 | + return ((RecordEventsRegistry) type.getEvents()).onAfterRead(record); |
1646 | 1665 | } |
1647 | 1666 | } |
1648 | 1667 | return record; |
|
0 commit comments