This commit is contained in:
Chris Lu 2021-05-09 15:33:01 -07:00
parent 55e060cf61
commit 50be19d23e
3 changed files with 11 additions and 3 deletions

View file

@ -0,0 +1,8 @@
package filesys
type DirtyPages interface {
AddPage(offset int64, data []byte)
FlushData() error
ReadDirtyDataAt(data []byte, startOffset int64) (maxStop int64)
GetStorageOptions() (collection, replication string)
}

View file

@ -22,7 +22,7 @@ type ContinuousDirtyPages struct {
replication string
}
func newDirtyPages(file *File, writeOnly bool) *ContinuousDirtyPages {
func newContinuousDirtyPages(file *File, writeOnly bool) *ContinuousDirtyPages {
dirtyPages := &ContinuousDirtyPages{
intervals: &ContinuousIntervals{},
f: file,

View file

@ -20,7 +20,7 @@ import (
type FileHandle struct {
// cache file has been written to
dirtyPages *ContinuousDirtyPages
dirtyPages DirtyPages
entryViewCache []filer.VisibleInterval
reader io.ReaderAt
contentType string
@ -38,7 +38,7 @@ type FileHandle struct {
func newFileHandle(file *File, uid, gid uint32, writeOnly bool) *FileHandle {
fh := &FileHandle{
f: file,
dirtyPages: newDirtyPages(file, writeOnly),
dirtyPages: newContinuousDirtyPages(file, writeOnly),
Uid: uid,
Gid: gid,
}