MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / readGzFile

Function readGzFile

dgraphtest/load.go:83–99  ·  view source on GitHub ↗

readGzFile reads the given file from disk completely and returns the content.

(sf string, encryption bool, encKeyPath string)

Source from the content-addressed store, hash-verified

81
82// readGzFile reads the given file from disk completely and returns the content.
83func readGzFile(sf string, encryption bool, encKeyPath string) ([]byte, error) {
84 fd, err := os.Open(sf)
85 if err != nil {
86 return nil, errors.Wrapf(err, "error opening file [%v]", sf)
87 }
88 defer func() {
89 if err := fd.Close(); err != nil {
90 log.Printf("[WARNING] error closing file [%v]: %v", sf, err)
91 }
92 }()
93
94 data, err := readGzData(fd, encryption, encKeyPath)
95 if err != nil {
96 return nil, errors.Wrapf(err, "error reading data from file [%v]", sf)
97 }
98 return data, nil
99}
100
101func readGzData(r io.Reader, encryption bool, encKeyPath string) ([]byte, error) {
102 if encryption {

Callers 2

setDQLSchemaFunction · 0.85
setGraphQLSchemaFunction · 0.85

Calls 3

readGzDataFunction · 0.85
OpenMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected