@@ -3,14 +3,19 @@ package readervfs
33import (
44 "github.com/ncruces/go-sqlite3"
55 "github.com/ncruces/go-sqlite3/util/ioutil"
6+ "github.com/ncruces/go-sqlite3/util/vfsutil"
67 "github.com/ncruces/go-sqlite3/vfs"
78)
89
910type readerVFS struct {}
1011
1112func (readerVFS ) Open (name string , flags vfs.OpenFlag ) (vfs.File , vfs.OpenFlag , error ) {
13+ // Temp journals, as used by the sorter, use SliceFile.
14+ if flags & vfs .OPEN_TEMP_JOURNAL != 0 {
15+ return & vfsutil.SliceFile {}, flags | vfs .OPEN_MEMORY , nil
16+ }
17+ // Refuse to open all other file types.
1218 if flags & vfs .OPEN_MAIN_DB == 0 {
13- // notest
1419 return nil , flags , sqlite3 .CANTOPEN
1520 }
1621 readerMtx .RLock ()
@@ -22,12 +27,12 @@ func (readerVFS) Open(name string, flags vfs.OpenFlag) (vfs.File, vfs.OpenFlag,
2227}
2328
2429func (readerVFS ) Delete (name string , dirSync bool ) error {
25- // notest
30+ // notest // IOCAP_IMMUTABLE
2631 return sqlite3 .IOERR_DELETE
2732}
2833
2934func (readerVFS ) Access (name string , flag vfs.AccessFlag ) (bool , error ) {
30- // notest
35+ // notest // IOCAP_IMMUTABLE
3136 return false , sqlite3 .IOERR_ACCESS
3237}
3338
@@ -42,37 +47,37 @@ func (readerFile) Close() error {
4247}
4348
4449func (readerFile ) WriteAt (b []byte , off int64 ) (n int , err error ) {
45- // notest
50+ // notest // IOCAP_IMMUTABLE
4651 return 0 , sqlite3 .IOERR_WRITE
4752}
4853
4954func (readerFile ) Truncate (size int64 ) error {
50- // notest
55+ // notest // IOCAP_IMMUTABLE
5156 return sqlite3 .IOERR_TRUNCATE
5257}
5358
5459func (readerFile ) Sync (flag vfs.SyncFlag ) error {
55- // notest
60+ // notest // IOCAP_IMMUTABLE
5661 return sqlite3 .IOERR_FSYNC
5762}
5863
5964func (readerFile ) Lock (lock vfs.LockLevel ) error {
60- // notest
65+ // notest // IOCAP_IMMUTABLE
6166 return sqlite3 .IOERR_LOCK
6267}
6368
6469func (readerFile ) Unlock (lock vfs.LockLevel ) error {
65- // notest
70+ // notest // IOCAP_IMMUTABLE
6671 return sqlite3 .IOERR_UNLOCK
6772}
6873
6974func (readerFile ) CheckReservedLock () (bool , error ) {
70- // notest
75+ // notest // IOCAP_IMMUTABLE
7176 return false , sqlite3 .IOERR_CHECKRESERVEDLOCK
7277}
7378
7479func (readerFile ) SectorSize () int {
75- // notest
80+ // notest // IOCAP_IMMUTABLE
7681 return 0
7782}
7883
0 commit comments