mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor
This commit is contained in:
parent
df25ed3c5b
commit
2955b96ef1
|
@ -35,7 +35,7 @@ type Filer struct {
|
|||
FsyncBuckets []string
|
||||
buckets *FilerBuckets
|
||||
Cipher bool
|
||||
metaLogBuffer *log_buffer.LogBuffer
|
||||
MetaLogBuffer *log_buffer.LogBuffer
|
||||
metaLogCollection string
|
||||
metaLogReplication string
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ func NewFiler(masters []string, grpcDialOption grpc.DialOption, filerHost string
|
|||
fileIdDeletionQueue: util.NewUnboundedQueue(),
|
||||
GrpcDialOption: grpcDialOption,
|
||||
}
|
||||
f.metaLogBuffer = log_buffer.NewLogBuffer(time.Minute, f.logFlushFunc, notifyFn)
|
||||
f.MetaLogBuffer = log_buffer.NewLogBuffer(time.Minute, f.logFlushFunc, notifyFn)
|
||||
f.metaLogCollection = collection
|
||||
f.metaLogReplication = replication
|
||||
|
||||
|
@ -316,6 +316,6 @@ func (f *Filer) cacheSetDirectory(dirpath string, dirEntry *Entry, level int) {
|
|||
}
|
||||
|
||||
func (f *Filer) Shutdown() {
|
||||
f.metaLogBuffer.Shutdown()
|
||||
f.MetaLogBuffer.Shutdown()
|
||||
f.store.Shutdown()
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ func (f *Filer) logMetaEvent(fullpath string, eventNotification *filer_pb.EventN
|
|||
return
|
||||
}
|
||||
|
||||
f.metaLogBuffer.AddToBuffer([]byte(dir), data)
|
||||
f.MetaLogBuffer.AddToBuffer([]byte(dir), data)
|
||||
|
||||
}
|
||||
|
||||
|
@ -83,11 +83,11 @@ func (f *Filer) logFlushFunc(startTime, stopTime time.Time, buf []byte) {
|
|||
func (f *Filer) ReadLogBuffer(lastReadTime time.Time, eachEventFn func(fullpath string, eventNotification *filer_pb.EventNotification) error) (newLastReadTime time.Time, err error) {
|
||||
|
||||
var bytesBuf *bytes.Buffer
|
||||
bytesBuf = f.metaLogBuffer.ReadFromBuffer(lastReadTime)
|
||||
bytesBuf = f.MetaLogBuffer.ReadFromBuffer(lastReadTime)
|
||||
if bytesBuf == nil {
|
||||
return
|
||||
}
|
||||
defer f.metaLogBuffer.ReleaseMeory(bytesBuf)
|
||||
defer f.MetaLogBuffer.ReleaseMeory(bytesBuf)
|
||||
buf := bytesBuf.Bytes()
|
||||
var processedTs int64
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ func (fs *FilerServer) SubscribeMetadata(req *filer_pb.SubscribeMetadataRequest,
|
|||
if req.SinceNs > 0 {
|
||||
lastReadTime = time.Unix(0, req.SinceNs)
|
||||
}
|
||||
|
||||
var readErr error
|
||||
for {
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@ import (
|
|||
)
|
||||
|
||||
func (logBuffer *LogBuffer) LoopProcessLogData(
|
||||
startTreadTime time.Time, waitForDataFn func() bool, eachLogDataFn func(logEntry *filer_pb.LogEntry) error) (processed int64, err error) {
|
||||
startTreadTime time.Time, waitForDataFn func() bool,
|
||||
eachLogDataFn func(logEntry *filer_pb.LogEntry) error) (processed int64, err error) {
|
||||
// loop through all messages
|
||||
var bytesBuf *bytes.Buffer
|
||||
lastReadTime := startTreadTime
|
||||
|
|
Loading…
Reference in a new issue