Karta.Kantoor.Deliveries (Karta v1.0.0)

Deleting a received message per delivery (contract 3c.1). Karta stores one message and one encrypted body per SMTP transaction; a message to ann@ and bob@ has two deliveries, and Ann deleting hers must not take Bob's copy. So delete/2 marks the delivery deleted (deleted_at), and only when every delivery of the message is deleted does the message go: its body and its row, through Karta.Messages.discard/3 (a delivery expired by retention goes with its message, see Karta.Messages.Retention).

Deleting is idempotent and reveals nothing: a delivery that is already deleted, is gone with its message, belongs to another server, or is at an address the key may not touch, all answer :ok, and only the last-named cases do nothing. Only an id that is not a UUID is an error.

The message row is locked while the delivery is marked and the remaining ones are counted, so two owners deleting their deliveries at the same moment cannot both see the other's copy as still there.

Summary

Functions

Deletes delivery id for the key (see the module doc). opts go to Karta.Messages.discard/3.

Functions

delete(credential, id, opts \\ [])

@spec delete(map(), String.t(), keyword()) :: :ok | {:error, :invalid_id}

Deletes delivery id for the key (see the module doc). opts go to Karta.Messages.discard/3.