Search in sources :

Example 1 with BlobsTable

use of jetbrains.exodus.entitystore.tables.BlobsTable in project xodus by JetBrains.

the class VFSBlobVault method loadAllBlobs.

@NotNull
private static LongSet loadAllBlobs(@NotNull final PersistentEntityStoreImpl store, @NotNull final PersistentStoreTransaction txn) {
    final LongSet result = new PackedLongHashSet();
    final Transaction envTxn = txn.getEnvironmentTransaction();
    try (Cursor entityTypesCursor = store.getEntityTypesTable().getSecondIndexCursor(envTxn)) {
        while (entityTypesCursor.getNext()) {
            final int entityTypeId = IntegerBinding.compressedEntryToInt(entityTypesCursor.getKey());
            final BlobsTable blobs = store.getBlobsTable(txn, entityTypeId);
            final Store primary = blobs.getPrimaryIndex();
            try (Cursor blobsCursor = primary.openCursor(envTxn)) {
                while (blobsCursor.getNext()) {
                    final long blobId = LongBinding.compressedEntryToLong(blobsCursor.getValue());
                    result.add(blobId);
                }
            }
        }
        return result;
    }
}
Also used : Transaction(jetbrains.exodus.env.Transaction) BlobsTable(jetbrains.exodus.entitystore.tables.BlobsTable) Store(jetbrains.exodus.env.Store) Cursor(jetbrains.exodus.env.Cursor) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

BlobsTable (jetbrains.exodus.entitystore.tables.BlobsTable)1 Cursor (jetbrains.exodus.env.Cursor)1 Store (jetbrains.exodus.env.Store)1 Transaction (jetbrains.exodus.env.Transaction)1 NotNull (org.jetbrains.annotations.NotNull)1