Fix naming.

This commit is contained in:
Nuno Cruces
2025-01-13 09:28:47 +00:00
parent aa4357a78f
commit f025ffb385
6 changed files with 19 additions and 19 deletions

View File

@@ -38,18 +38,18 @@ func WrapLockState(f vfs.File) vfs.LockLevel {
return vfs.LOCK_EXCLUSIVE + 1 // UNKNOWN_LOCK
}
// WrapPersistentWAL helps wrap [vfs.FilePersistentWAL].
func WrapPersistentWAL(f vfs.File) bool {
if f, ok := f.(vfs.FilePersistentWAL); ok {
return f.PersistentWAL()
// WrapPersistWAL helps wrap [vfs.FilePersistWAL].
func WrapPersistWAL(f vfs.File) bool {
if f, ok := f.(vfs.FilePersistWAL); ok {
return f.PersistWAL()
}
return false
}
// WrapSetPersistentWAL helps wrap [vfs.FilePersistentWAL].
// WrapSetPersistentWAL helps wrap [vfs.FilePersistWAL].
func WrapSetPersistentWAL(f vfs.File, keepWAL bool) {
if f, ok := f.(vfs.FilePersistentWAL); ok {
f.SetPersistentWAL(keepWAL)
if f, ok := f.(vfs.FilePersistWAL); ok {
f.SetPersistWAL(keepWAL)
}
}

View File

@@ -238,7 +238,7 @@ func (h *hbshFile) LockState() vfs.LockLevel {
}
func (h *hbshFile) PersistentWAL() bool {
return vfsutil.WrapPersistentWAL(h.File) // notest
return vfsutil.WrapPersistWAL(h.File) // notest
}
func (h *hbshFile) SetPersistentWAL(keepWAL bool) {

View File

@@ -65,14 +65,14 @@ type FileLockState interface {
LockState() LockLevel
}
// FilePersistentWAL extends File to implement the
// FilePersistWAL extends File to implement the
// SQLITE_FCNTL_PERSIST_WAL file control opcode.
//
// https://sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpersistwal
type FilePersistentWAL interface {
type FilePersistWAL interface {
File
PersistentWAL() bool
SetPersistentWAL(bool)
PersistWAL() bool
SetPersistWAL(bool)
}
// FilePowersafeOverwrite extends File to implement the

View File

@@ -142,7 +142,7 @@ var (
_ FileLockState = &vfsFile{}
_ FileHasMoved = &vfsFile{}
_ FileSizeHint = &vfsFile{}
_ FilePersistentWAL = &vfsFile{}
_ FilePersistWAL = &vfsFile{}
_ FilePowersafeOverwrite = &vfsFile{}
)
@@ -217,6 +217,6 @@ func (f *vfsFile) HasMoved() (bool, error) {
func (f *vfsFile) LockState() LockLevel { return f.lock }
func (f *vfsFile) PowersafeOverwrite() bool { return f.psow }
func (f *vfsFile) PersistentWAL() bool { return f.keepWAL }
func (f *vfsFile) PersistWAL() bool { return f.keepWAL }
func (f *vfsFile) SetPowersafeOverwrite(psow bool) { f.psow = psow }
func (f *vfsFile) SetPersistentWAL(keepWAL bool) { f.keepWAL = keepWAL }
func (f *vfsFile) SetPersistWAL(keepWAL bool) { f.keepWAL = keepWAL }

View File

@@ -255,10 +255,10 @@ func vfsFileControlImpl(ctx context.Context, mod api.Module, file File, op _Fcnt
}
case _FCNTL_PERSIST_WAL:
if file, ok := file.(FilePersistentWAL); ok {
if file, ok := file.(FilePersistWAL); ok {
if i := util.ReadUint32(mod, pArg); int32(i) >= 0 {
file.SetPersistentWAL(i != 0)
} else if file.PersistentWAL() {
file.SetPersistWAL(i != 0)
} else if file.PersistWAL() {
util.WriteUint32(mod, pArg, 1)
} else {
util.WriteUint32(mod, pArg, 0)

View File

@@ -234,7 +234,7 @@ func (x *xtsFile) LockState() vfs.LockLevel {
}
func (x *xtsFile) PersistentWAL() bool {
return vfsutil.WrapPersistentWAL(x.File) // notest
return vfsutil.WrapPersistWAL(x.File) // notest
}
func (x *xtsFile) SetPersistentWAL(keepWAL bool) {