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

Method LiveLoad

dgraphtest/load.go:234–280  ·  view source on GitHub ↗

LiveLoad runs the live loader with provided options

(opts LiveOpts)

Source from the content-addressed store, hash-verified

232
233// LiveLoad runs the live loader with provided options
234func (c *LocalCluster) LiveLoad(opts LiveOpts) error {
235 log.Printf("[INFO] updating DQL schema from [%v]", strings.Join(opts.SchemaFiles, " "))
236 if err := setDQLSchema(c, opts.SchemaFiles); err != nil {
237 return err
238 }
239 log.Printf("[INFO] updating GraphQL schema from [%v]", strings.Join(opts.GqlSchemaFiles, " "))
240 if err := setGraphQLSchema(c, opts.GqlSchemaFiles); err != nil {
241 return err
242 }
243
244 var alphaURLs []string
245 for i, aa := range c.alphas {
246 url, err := aa.alphaURL(c)
247 if err != nil {
248 return errors.Wrapf(err, "error finding URL for alpha #%v", i)
249 }
250 alphaURLs = append(alphaURLs, url)
251 }
252 zeroURL, err := c.zeros[0].zeroURL(c)
253 if err != nil {
254 return errors.Wrap(err, "error finding URL of first zero")
255 }
256
257 args := []string{
258 "live",
259 "--files", strings.Join(opts.DataFiles, ","),
260 "--alpha", strings.Join(alphaURLs, ","),
261 "--zero", zeroURL,
262 }
263 if c.conf.acl {
264 args = append(args, fmt.Sprintf("--creds=user=%s;password=%s;namespace=%d",
265 dgraphapi.DefaultUser, dgraphapi.DefaultPassword, x.RootNamespace))
266 }
267 if c.conf.encryption {
268 args = append(args, fmt.Sprintf("--encryption=key-file=%v", c.encKeyPath))
269 }
270
271 log.Printf("[INFO] running live loader with args: [%v]", strings.Join(args, " "))
272 cmd := exec.Command(c.HostDgraphBinaryPath(), args...)
273 if out, err := cmd.CombinedOutput(); err != nil {
274 return errors.Wrapf(err, "error running live loader: %v", string(out))
275 } else {
276 log.Printf("[INFO] ==== output for live loader ====")
277 log.Println(string(out))
278 }
279 return nil
280}
281
282// findGrootAndGuardians returns the UIDs of groot user and guardians group
283func findGrootAndGuardians(c *LocalCluster) (string, string, error) {

Callers 2

TestShortestPathFunction · 0.95
LiveLoadFromExportMethod · 0.95

Calls 5

HostDgraphBinaryPathMethod · 0.95
setDQLSchemaFunction · 0.85
setGraphQLSchemaFunction · 0.85
alphaURLMethod · 0.65
zeroURLMethod · 0.65

Tested by 1

TestShortestPathFunction · 0.76