@@ -166,11 +166,12 @@ impl Drop for SchemaReparseGuard {
166166 }
167167}
168168
169- /// Re-entrant state for [`Connection::reparse_schema`] /
170- /// [`Connection::reparse_schema_with_cookie`]. `Start` is the fresh state
171- /// (cookie not yet read / schema build not yet begun); `Building` carries the
172- /// half-built schema, captured table-valued functions, the held reparse guard,
173- /// and the current sub-phase across IO yields.
169+ /// Re-entrant state for [`Connection::reparse_schema_nonblock`] and the
170+ /// VACUUM-only [`Connection::reparse_schema_with_cookie_keeping_sequences`].
171+ /// `Start` is the fresh state (cookie not yet read / schema build not yet
172+ /// begun); `Building` carries the half-built schema, captured table-valued
173+ /// functions, the held reparse guard, and the current sub-phase across IO
174+ /// yields.
174175#[ derive( Default ) ]
175176pub enum ReparseSchemaState {
176177 #[ default]
@@ -229,7 +230,7 @@ enum ReparsePhase {
229230/// `__turso_internal_seq_*` backing table and registers its descriptor,
230231/// carrying the worklist and the in-flight descriptor read across IO yields.
231232#[ derive( Default ) ]
232- pub ( crate ) enum LoadSequenceDescriptorsState {
233+ pub enum LoadSequenceDescriptorsState {
233234 #[ default]
234235 Start ,
235236 Reading {
@@ -247,7 +248,7 @@ pub(crate) enum LoadSequenceDescriptorsState {
247248/// Re-entrant driver state for
248249/// [`Connection::sync_autoincrement_backing_tables_from_sqlite_sequence_nonblock`].
249250#[ derive( Default ) ]
250- pub ( crate ) enum SyncAutoincrementState {
251+ pub enum SyncAutoincrementState {
251252 #[ default]
252253 Start ,
253254 /// Reading all `(name, seq)` rows from `sqlite_sequence`.
@@ -265,7 +266,7 @@ pub(crate) enum SyncAutoincrementState {
265266
266267/// Per-row sub-state of [`SyncAutoincrementState::Process`].
267268#[ derive( Default ) ]
268- enum SyncRowStep {
269+ pub enum SyncRowStep {
269270 /// Resolve `rows[idx]`'s backing table and start reading `MAX(value)`.
270271 #[ default]
271272 Start ,
@@ -276,9 +277,7 @@ enum SyncRowStep {
276277 current_max : Option < i64 > ,
277278 } ,
278279 /// Running the `INSERT OR REPLACE` watermark upsert.
279- Upsert {
280- stmt : Box < Statement > ,
281- } ,
280+ Upsert { stmt : Box < Statement > } ,
282281}
283282
284283/// Database connection handle.
@@ -1163,26 +1162,6 @@ impl Connection {
11631162 self . drive_reparse_building ( state)
11641163 }
11651164
1166- /// Blocking shim for callers that already hold the cookie.
1167- pub ( crate ) fn reparse_schema_with_cookie ( self : & Arc < Connection > , cookie : u32 ) -> Result < ( ) > {
1168- let io = self . pager . load ( ) . io . clone ( ) ;
1169- let mut state = ReparseSchemaState :: default ( ) ;
1170- io. block ( || self . reparse_schema_with_cookie_nonblock ( cookie, & mut state) )
1171- }
1172-
1173- /// Non-blocking reparse starting from a known cookie.
1174- pub ( crate ) fn reparse_schema_with_cookie_nonblock (
1175- self : & Arc < Connection > ,
1176- cookie : u32 ,
1177- state : & mut ReparseSchemaState ,
1178- ) -> Result < crate :: types:: IOResult < ( ) > > {
1179- if matches ! ( state, ReparseSchemaState :: Start ) {
1180- * state =
1181- ReparseSchemaState :: Building ( Box :: new ( self . init_reparse_building ( cookie, None ) ?) ) ;
1182- }
1183- self . drive_reparse_building ( state)
1184- }
1185-
11861165 /// Synchronous setup shared by the reparse entry points: install the cookie,
11871166 /// build a fresh schema, capture table-valued functions, install the empty
11881167 /// schema (the reprepare hack), and prepare the sqlite_schema scan.
@@ -3570,8 +3549,9 @@ impl Connection {
35703549 if !has_seq_table {
35713550 return Ok ( IOResult :: Done ( ( ) ) ) ;
35723551 }
3573- let stmt = self
3574- . prepare_internal ( format ! ( "SELECT name, seq FROM {SQLITE_SEQUENCE_TABLE_NAME}" ) ) ?;
3552+ let stmt = self . prepare_internal ( format ! (
3553+ "SELECT name, seq FROM {SQLITE_SEQUENCE_TABLE_NAME}"
3554+ ) ) ?;
35753555 * state = SyncAutoincrementState :: ReadSeqRows {
35763556 stmt : Box :: new ( stmt) ,
35773557 rows : Vec :: new ( ) ,
@@ -3610,8 +3590,9 @@ impl Connection {
36103590 // Read current backing watermark; only upsert if we'd
36113591 // actually advance it (avoids needless writes on boot).
36123592 let escaped = backing_table_name. replace ( '"' , "\" \" " ) ;
3613- let stmt = self
3614- . prepare_internal ( format ! ( "SELECT MAX(value) FROM \" {escaped}\" " ) ) ?;
3593+ let stmt = self . prepare_internal ( format ! (
3594+ "SELECT MAX(value) FROM \" {escaped}\" "
3595+ ) ) ?;
36153596 * sub = SyncRowStep :: ReadMax {
36163597 backing_table_name,
36173598 stmt : Box :: new ( stmt) ,
0 commit comments