MCPcopy
hub / github.com/cayleygraph/cayley / DecompressAndLoad

Function DecompressAndLoad

internal/load.go:123–138  ·  view source on GitHub ↗

DecompressAndLoad will load or fetch a graph from the given path, decompress it, and then call the given load function to process the decompressed graph. If no loadFn is provided, db.Load is called.

(qw quad.WriteCloser, batch int, path, typ string)

Source from the content-addressed store, hash-verified

121// it, and then call the given load function to process the decompressed graph.
122// If no loadFn is provided, db.Load is called.
123func DecompressAndLoad(qw quad.WriteCloser, batch int, path, typ string) error {
124 if path == "" {
125 return nil
126 }
127 qr, err := QuadReaderFor(path, typ)
128 if err != nil {
129 return err
130 }
131 defer qr.Close()
132
133 _, err = quad.CopyBatch(&batchLogger{w: qw}, qr, batch)
134 if err != nil {
135 return fmt.Errorf("db: failed to load data: %v", err)
136 }
137 return qw.Close()
138}
139
140type batchLogger struct {
141 cnt int

Callers 1

LoadFunction · 0.85

Calls 3

QuadReaderForFunction · 0.85
CloseMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected