# sayore/applied-quickergistics architecture

> Architecture diagram of the GitHub repository sayore/applied-quickergistics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sayore/applied-quickergistics
- Repository: https://github.com/sayore/applied-quickergistics

## Overview

This fork adds an optional Rust-backed, read-only mirror for AE2 network item totals. The workflow is: mounted storages are synchronized when their versions change, Rust maintains aggregate totals and deltas, and AE2 uses the mirror for cached network queries; if native support is unavailable or disabled, AE2 retains its Java path. The README documents the native bridge and fallback behavior; sampled Java excerpts show storage-service caching and the mirror, while Rust internals are represented from the file tree rather than sampled source.

Main entry points: [`ae2-src/src/main/java/appeng/me/service/StorageService.java`](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/service/StorageService.java) (Storage service), [`ae2-src/src/main/java/appeng/me/storage/RustStorageIndex.java`](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/storage/RustStorageIndex.java) (Rust index adapter), [`ae2-src/rust/ae2store/src/index.rs`](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index.rs) (Network index), [`ae2-src/rust/ae2store/src/lib.rs`](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/lib.rs) (Index API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["AE2 integration"]
  node_storage_mounts["Mounted storage"]
  node_storage_bus["Storage bus"]
  node_storage_service["Storage service"]
  node_rust_index_java["Rust index adapter"]
end

subgraph group_native["Native bridge"]
  node_native_loader["Native loader"]
  node_jni["JNI bindings<br/>[lib.rs]"]
end

subgraph group_rust["Rust index"]
  node_rust_core["Index API<br/>[lib.rs]"]
  node_cell["Cell tally<br/>[cell.rs]"]
  node_index[("Network index<br/>[index.rs]")]
  node_postings["Query postings<br/>[postings.rs]"]
  node_query["Index queries<br/>[query.rs]"]
  node_delta["Change deltas<br/>[delta.rs]"]
end

subgraph group_consumers["Network consumers"]
  node_terminal["ME terminals"]
  node_storage_menu["Storage menu<br/>[MEStorageMenu.java]"]
  node_storage_helper["Powered storage<br/>[StorageHelper.java]"]
end

node_external_user(("Player"))
node_java_path["AE2 Java path"]

node_storage_bus -->|"provides storage"| node_storage_service
node_storage_service -->|"mounts inventories"| node_storage_mounts
node_storage_service -.->|"syncs mounts"| node_rust_index_java
node_rust_index_java -.->|"loads native"| node_native_loader
node_native_loader -.->|"loads library"| node_jni
node_rust_index_java -.->|"calls JNI"| node_jni
node_jni -.->|"dispatches calls"| node_rust_core
node_rust_core -.->|"updates tally"| node_cell
node_rust_core -.->|"updates index"| node_index
node_index -.->|"maintains postings"| node_postings
node_index -.->|"answers queries"| node_query
node_index -.->|"records changes"| node_delta
node_rust_index_java -.->|"supplies totals"| node_storage_service
node_storage_service -->|"falls back"| node_java_path
node_external_user -->|"views inventory"| node_terminal
node_terminal -->|"sends actions"| node_storage_menu
node_storage_menu -->|"powered operations"| node_storage_helper

click node_storage_mounts "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/service/StorageService.java"
click node_storage_bus "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/parts/storagebus/StorageBusPart.java"
click node_storage_service "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/service/StorageService.java"
click node_rust_index_java "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/storage/RustStorageIndex.java"
click node_native_loader "https://github.com/sayore/applied-quickergistics/tree/master/ae2-src/src/main/java/appeng/storage/nativebridge"
click node_jni "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store-jni/src/lib.rs"
click node_rust_core "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/lib.rs"
click node_cell "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/cell.rs"
click node_index "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index.rs"
click node_postings "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/postings.rs"
click node_query "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/query.rs"
click node_delta "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/delta.rs"
click node_terminal "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/client/java/appeng/client/gui/me/common/MEStorageScreen.java"
click node_storage_menu "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/menu/me/common/MEStorageMenu.java"
click node_storage_helper "https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/api/storage/StorageHelper.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_storage_mounts,node_storage_bus,node_storage_service,node_rust_index_java toneBlue
class node_native_loader,node_jni toneAmber
class node_rust_core,node_cell,node_index,node_postings,node_query,node_delta toneMint
class node_terminal,node_storage_menu,node_storage_helper toneRose
class node_external_user,node_java_path toneIndigo
```

## Components

### AE2 integration

- [Mounted storage](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/service/StorageService.java): `ae2-src/src/main/java/appeng/me/service/StorageService.java`
- [Storage bus](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/parts/storagebus/StorageBusPart.java): `ae2-src/src/main/java/appeng/parts/storagebus/StorageBusPart.java`
- [Storage service](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/service/StorageService.java): `ae2-src/src/main/java/appeng/me/service/StorageService.java`
- [Rust index adapter](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/me/storage/RustStorageIndex.java): `ae2-src/src/main/java/appeng/me/storage/RustStorageIndex.java`

### Native bridge

- [Native loader](https://github.com/sayore/applied-quickergistics/tree/master/ae2-src/src/main/java/appeng/storage/nativebridge): `ae2-src/src/main/java/appeng/storage/nativebridge`
- [JNI bindings](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store-jni/src/lib.rs): `ae2-src/rust/ae2store-jni/src/lib.rs`

### Rust index

- [Index API](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/lib.rs): `ae2-src/rust/ae2store/src/lib.rs`
- [Cell tally](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/cell.rs): `ae2-src/rust/ae2store/src/cell.rs`
- [Network index](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index.rs): `ae2-src/rust/ae2store/src/index.rs`
- [Query postings](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/postings.rs): `ae2-src/rust/ae2store/src/index/postings.rs`
- [Index queries](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/query.rs): `ae2-src/rust/ae2store/src/index/query.rs`
- [Change deltas](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/rust/ae2store/src/index/delta.rs): `ae2-src/rust/ae2store/src/index/delta.rs`

### Network consumers

- [ME terminals](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/client/java/appeng/client/gui/me/common/MEStorageScreen.java): `ae2-src/src/client/java/appeng/client/gui/me/common/MEStorageScreen.java`
- [Storage menu](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/menu/me/common/MEStorageMenu.java): `ae2-src/src/main/java/appeng/menu/me/common/MEStorageMenu.java`
- [Powered storage](https://github.com/sayore/applied-quickergistics/blob/master/ae2-src/src/main/java/appeng/api/storage/StorageHelper.java): `ae2-src/src/main/java/appeng/api/storage/StorageHelper.java`

### Other components

- **Player**
- **AE2 Java path**

## Connections

- Storage bus → Storage service: provides storage
- Storage service → Mounted storage: mounts inventories
- Storage service → Rust index adapter: syncs mounts
- Rust index adapter → Native loader: loads native
- Native loader → JNI bindings: loads library
- Rust index adapter → JNI bindings: calls JNI
- JNI bindings → Index API: dispatches calls
- Index API → Cell tally: updates tally
- Index API → Network index: updates index
- Network index → Query postings: maintains postings
- Network index → Index queries: answers queries
- Network index → Change deltas: records changes
- Rust index adapter → Storage service: supplies totals
- Storage service → AE2 Java path: falls back
- Player → ME terminals: views inventory
- ME terminals → Storage menu: sends actions
- Storage menu → Powered storage: powered operations
