iterate through the log buffer

This commit is contained in:
Chris Lu
2020-04-05 16:51:30 -07:00
parent f71b855db5
commit 53626734d4
2 changed files with 47 additions and 7 deletions

View File

@@ -81,6 +81,7 @@ func (f *Filer) ReadLogBuffer(lastReadTime time.Time, eachEventFn func(fullpath
var buf []byte
newLastReadTime, buf = f.metaLogBuffer.ReadFromBuffer(lastReadTime)
var processedTs int64
for pos := 0; pos+4 < len(buf); {
@@ -103,7 +104,10 @@ func (f *Filer) ReadLogBuffer(lastReadTime time.Time, eachEventFn func(fullpath
err = eachEventFn(event.Directory, event.EventNotification)
processedTs = logEntry.TsNs
if err != nil {
newLastReadTime = time.Unix(0, processedTs)
return
}
@@ -111,6 +115,7 @@ func (f *Filer) ReadLogBuffer(lastReadTime time.Time, eachEventFn func(fullpath
}
newLastReadTime = time.Unix(0, processedTs)
return
}