MCPcopy
hub / github.com/benbjohnson/litestream / Sync

Method Sync

vfs.go:1671–1693  ·  view source on GitHub ↗
(flag sqlite3vfs.SyncType)

Source from the content-addressed store, hash-verified

1669}
1670
1671func (f *VFSFile) Sync(flag sqlite3vfs.SyncType) error {
1672 f.logger.Debug("syncing file", "flag", flag)
1673
1674 f.mu.Lock()
1675 defer f.mu.Unlock()
1676
1677 // If write support is not enabled, no-op
1678 if !f.writeEnabled {
1679 return nil
1680 }
1681
1682 // Skip sync if no dirty pages
1683 if len(f.dirty) == 0 {
1684 return nil
1685 }
1686 // Skip sync during active transaction
1687 if f.inTransaction {
1688 f.logger.Debug("skipping sync during transaction")
1689 return nil
1690 }
1691
1692 return f.syncToRemoteWithLock()
1693}
1694
1695// SetWriteEnabled enables or disables write support at runtime.
1696// This is equivalent to SetWriteEnabledWithTimeout(enabled, 0) which waits indefinitely.

Callers 7

syncLoopMethod · 0.95
SyncMethod · 0.45
CloseMethod · 0.45
saveMetaMethod · 0.45
syncDirFunction · 0.45

Calls 3

syncToRemoteWithLockMethod · 0.95
LockMethod · 0.45
UnlockMethod · 0.45