Skip to content

Commit

Permalink
Fix naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Jan 13, 2025
1 parent aa4357a commit f025ffb
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
14 changes: 7 additions & 7 deletions util/vfsutil/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion vfs/adiantum/hbsh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions vfs/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions vfs/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ var (
_ FileLockState = &vfsFile{}
_ FileHasMoved = &vfsFile{}
_ FileSizeHint = &vfsFile{}
_ FilePersistentWAL = &vfsFile{}
_ FilePersistWAL = &vfsFile{}
_ FilePowersafeOverwrite = &vfsFile{}
)

Expand Down Expand Up @@ -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 }
6 changes: 3 additions & 3 deletions vfs/vfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion vfs/xts/xts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f025ffb

Please sign in to comment.