MCPcopy
hub / github.com/dgraph-io/dgraph / Init

Method Init

x/log_writer.go:55–80  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53}
54
55func (l *LogWriter) Init() (*LogWriter, error) {
56 if l == nil {
57 return nil, nil
58 }
59
60 l.manageOldLogs()
61 if err := l.open(); err != nil {
62 return nil, fmt.Errorf("not able to create new file %v", err)
63 }
64 l.closer = z.NewCloser(2)
65 l.manageChannel = make(chan bool, 1)
66 go func() {
67 defer l.closer.Done()
68 for {
69 select {
70 case <-l.manageChannel:
71 l.manageOldLogs()
72 case <-l.closer.HasBeenClosed():
73 return
74 }
75 }
76 }()
77
78 go l.flushPeriodic()
79 return l, nil
80}
81
82func (l *LogWriter) Write(p []byte) (int, error) {
83 if l == nil {

Callers 11

TestLogWriterFunction · 0.95
InitLoggerFunction · 0.95
newFileSinkFunction · 0.95
NewNodeFunction · 0.45
TestPushFunction · 0.45
MergeSortedPackedFunction · 0.45

Calls 5

manageOldLogsMethod · 0.95
openMethod · 0.95
flushPeriodicMethod · 0.95
ErrorfMethod · 0.45
DoneMethod · 0.45

Tested by 4

TestLogWriterFunction · 0.76
TestPushFunction · 0.36