Skip to content

Replace RingBuffer with Room Database for Connection Logs#17

Open
zerox80 wants to merge 1 commit into
TrustTunnel:masterfrom
zerox80:feat/room-database
Open

Replace RingBuffer with Room Database for Connection Logs#17
zerox80 wants to merge 1 commit into
TrustTunnel:masterfrom
zerox80:feat/room-database

Conversation

@zerox80

@zerox80 zerox80 commented Jan 26, 2026

Copy link
Copy Markdown

Replace RingBuffer with Room Database for Connection Logs

Description

Replaces the in-memory circular buffer (PrefixedLenRingProto) with a persistent local database using Room. This allows for more reliable connection logging that survives app restarts and allows for complex querying if needed in the future.

Changes

  • Added: db/ConnectionLog, ConnectionLogDao, ConnectionLogDatabase (Room entities).
  • Removed: PrefixedLenRingProto.kt, utils/concurrent/* (Custom thread pool removed in favor of Coroutines).
  • Modified: VpnService.kt to write stats to the DB using Coroutines.

Justification

"why your chatbot considers ring buffer not cool?".
Answer: The previous implementation was a custom, low-level file-based Ring Buffer (RandomAccessFile) which is hard to maintain and limited in functionality (e.g., must load all logs to read). Switching to Room provides a standard, robust SQL database that supports efficient querying, thread-safety, and better long-term maintainability.

How to test

  1. Connect VPN.
  2. Generate traffic.
  3. Check if connection stats are visible in the app (if UI is connected)

ialexbond added a commit to ialexbond/TrustTunnelClientForWindows that referenced this pull request Apr 20, 2026
TrustTunnel#14 font-semibold → token (24 файла):
- Все font-semibold в components/ заменены на font-[var(--font-weight-semibold)]
- Единый источник правды для font-weight через дизайн-токены

TrustTunnel#15 input font-size consistency (4 файла):
- ActionInput, ActionPasswordInput, NumberInput, Select: text-base → text-sm
- Все input-компоненты теперь единообразно используют 12px (text-sm)

TrustTunnel#16 colors.ts удалён (16 файлов):
- Все 16 импортов colors.ts мигрированы на CSS-токены:
  successBg → var(--color-status-connected-bg)
  warningBg → var(--color-status-connecting-bg)
  dangerBg → var(--color-status-error-bg)
  dropdownShadow → var(--shadow-lg)
  *Glow → "none" (deprecated)
  accent* → inline rgba (нет токенов)
- gui-app/src/shared/ui/colors.ts удалён

TrustTunnel#17 hardcoded rgba():
- Ключевые rgba() заменены на CSS-токены в рамках миграции colors.ts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant