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

Function init

dgraph/cmd/live/run.go:110–172  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108)
109
110func init() {
111 Live.Cmd = &cobra.Command{
112 Use: "live",
113 Short: "Run Dgraph Live Loader",
114 Run: func(cmd *cobra.Command, args []string) {
115 defer x.StartProfile(Live.Conf).Stop()
116 if err := run(); err != nil {
117 x.Check2(fmt.Fprintf(os.Stderr, "%s", err.Error()))
118 os.Exit(1)
119 }
120 },
121 Annotations: map[string]string{"group": "data-load"},
122 }
123 Live.EnvPrefix = "DGRAPH_LIVE"
124 Live.Cmd.SetHelpTemplate(x.NonRootTemplate)
125
126 flag := Live.Cmd.Flags()
127 // --vault SuperFlag and encryption flags
128 x.RegisterEncFlag(flag)
129 // --tls SuperFlag
130 x.RegisterClientTLSFlags(flag)
131
132 flag.StringP("files", "f", "", "Location of *.rdf(.gz) or *.json(.gz) file(s) to load")
133 flag.StringP("schema", "s", "", "Location of schema file")
134 flag.String("format", "", "Specify file format (rdf or json) instead of getting it "+
135 "from filename")
136 flag.StringP("alpha", "a", "127.0.0.1:9080",
137 "Comma-separated list of Dgraph alpha gRPC server addresses")
138 flag.StringP("zero", "z", "", "(deprecated) Dgraph zero gRPC server address")
139 flag.IntP("conc", "c", 10,
140 "Number of concurrent requests to make to Dgraph")
141 flag.IntP("batch", "b", 1000,
142 "Number of N-Quads to send as part of a mutation.")
143 flag.StringP("xidmap", "x", "", "Directory to store xid to uid mapping")
144 flag.StringP("auth_token", "t", "",
145 "The auth token passed to the server for Alter operation of the schema file. "+
146 "If used with --slash_grpc_endpoint, then this should be set to the API token issued"+
147 "by Slash GraphQL")
148 flag.String("slash_grpc_endpoint", "", "Path to Slash GraphQL GRPC endpoint. "+
149 "If --slash_grpc_endpoint is set, all other TLS options and connection options will be"+
150 "ignored")
151 flag.BoolP("use_compression", "C", false,
152 "Enable compression on connection to alpha server")
153 flag.Bool("new_uids", false,
154 "Ignore UIDs in load files and assign new ones.")
155 flag.String("http", "localhost:6060", "Address to serve http (pprof).")
156 flag.Bool("verbose", false, "Run the live loader in verbose mode")
157
158 flag.String("creds", "",
159 `Various login credentials if login is required.
160 user defines the username to login.
161 password defines the password of the user.
162 namespace defines the namespace to log into.
163 Sample flag could look like --creds user=username;password=mypass;namespace=2`)
164
165 flag.StringP("bufferSize", "m", "100", "Buffer for each thread")
166 flag.StringP("upsertPredicate", "U", "", "run in upsertPredicate mode. the value would "+
167 "be used to store blank nodes as an xid")

Callers

nothing calls this directly

Calls 8

StartProfileFunction · 0.92
Check2Function · 0.92
RegisterEncFlagFunction · 0.92
RegisterClientTLSFlagsFunction · 0.92
runFunction · 0.70
StopMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected