MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / readGqlSchema

Function readGqlSchema

dgraph/cmd/bulk/loader.go:465–488  ·  view source on GitHub ↗
(opt *BulkOptions)

Source from the content-addressed store, hash-verified

463}
464
465func readGqlSchema(opt *BulkOptions) []byte {
466 f, err := filestore.Open(opt.GqlSchemaFile)
467 x.Check(err)
468 defer func() {
469 if err := f.Close(); err != nil {
470 glog.Warningf("error while closing fd: %v", err)
471 }
472 }()
473
474 key := opt.EncryptionKey
475 if !opt.Encrypted {
476 key = nil
477 }
478 r, err := enc.GetReader(key, f)
479 x.Check(err)
480 if filepath.Ext(opt.GqlSchemaFile) == ".gz" {
481 r, err = gzip.NewReader(r)
482 x.Check(err)
483 }
484
485 buf, err := io.ReadAll(r)
486 x.Check(err)
487 return buf
488}
489
490func (ld *loader) processGqlSchema(loadType chunker.InputFormat) {
491 if ld.opt.GqlSchemaFile == "" {

Callers 2

genDQLSchemaFunction · 0.85
processGqlSchemaMethod · 0.85

Calls 5

OpenFunction · 0.92
CheckFunction · 0.92
GetReaderFunction · 0.92
WarningfMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…