fun allTypes()

in entity-browser-app/src/main/kotlin/jetbrains/xodus/browser/web/db/StoreService.kt [95:109]


    fun allTypes(): Array<EntityType> {
        return readonly { txn ->
            val store = txn.store
            val typeIds = arrayListOf<Int>()
            store.entityTypesTable.getSecondIndexCursor(txn.environmentTransaction).use { entityTypesCursor ->
                while (entityTypesCursor.next) {
                    typeIds.add(IntegerBinding.compressedEntryToInt(entityTypesCursor.key))
                }
            }

            typeIds.map {
                EntityType(it, store.getEntityType(txn, it))
            }.sortedBy { it.name }.toTypedArray()
        }
    }