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

Function newFileSink

worker/sink_handler.go:196–218  ·  view source on GitHub ↗
(path *z.SuperFlag)

Source from the content-addressed store, hash-verified

194}
195
196func newFileSink(path *z.SuperFlag) (Sink, error) {
197 dir := path.GetPath("file")
198 if err := os.MkdirAll(dir, 0700); err != nil {
199 return nil, errors.Wrap(err, "unable to create directory for file sink")
200 }
201
202 fp, err := filepath.Abs(filepath.Join(dir, defaultSinkFileName))
203 if err != nil {
204 return nil, errors.Wrap(err, "unable to find file sink path")
205 }
206
207 w := &x.LogWriter{
208 FilePath: fp,
209 MaxSize: 100,
210 MaxAge: 10,
211 }
212 if w, err = w.Init(); err != nil {
213 return nil, errors.Wrap(err, "unable to init the file writer ")
214 }
215 return &fileSink{
216 fileWriter: w,
217 }, nil
218}
219
220type scramClient struct {
221 *scram.Client

Callers 1

GetSinkFunction · 0.85

Calls 1

InitMethod · 0.95

Tested by

no test coverage detected