// SPDX-License-Identifier: MIT // Copyright (c) 2026 Thibault Ducray // // This file is part of MyPwdTool's open-source sync/encryption core — see // LICENSE-SYNC-CRYPTO.md at the repo root and https://tducray.fr/mypwdtool/open-source/. // The rest of this application is proprietary and NOT covered by this license. package fr.tducray.mypwdtool.sync import fr.tducray.mypwdtool.vault.Entry import java.util.UUID /** * Port of `Sync/SyncOutbox.swift` — a trivial in-memory FIFO, deliberately not persisted (the * local vault DB is the source of truth; a lost item just gets requeued next time that entry * changes, or picked up by a future bulk sync). */ class SyncOutbox { data class Item(val op: SyncOp, val entryId: UUID, val updatedAt: String, val entry: Entry?) private val lock = Object() private val items = mutableListOf() fun enqueue(item: Item) { synchronized(lock) { items.add(item) } } fun drain(): List = synchronized(lock) { val drained = items.toList() items.clear() drained } }