deletePrefix

fun deletePrefix(prefix: Key, batchSize: Int = DEFAULT_DELETE_BATCH): Long

Deletes every document whose key begins with prefix, and returns how many.

val retired = store.deletePrefix(Key.of("session/2026-07/"))

deleteRange's contract in every respect — point deletes under one snapshot, atomic per batch and not overall, one tombstone per key, converging when called again — differing only in how the keys are chosen. See scanPrefix for why a prefix is named rather than spelled as a range, and Key.startsWith for why the range arithmetic a caller would otherwise write retires one key too many.

An empty prefix deletes every document, exactly as deleteRange() with no bounds does.

Return

the number of keys deleted.

Parameters

prefix

the prefix every deleted key begins with.

batchSize

keys per commit, as deleteRange.