Files
zeekay f5aaeb712e Hanzo Graph — the engine, on zapdb, ZAP-native
Derived from Dgraph (github.com/dgraph-io/dgraph) at commit 64804bd2, Apache-2.0.
See NOTICE.

WHAT THIS IS. The graph engine as a Go library: posting lists, the DQL parser,
the type and tokenizer system, the index and schema layers, and the wire types.
39,170 lines of the upstream's 166,337.

THE STORE is github.com/luxfi/zapdb, a Badger fork that kept the package name,
the subpackages (options, pb, y) and the API — Open, OpenManaged, DB, Options —
so the 74 import sites are aliased rather than rewritten.

THE CODEC is ZAP. zapdb serializes with ZAP, not protobuf: its pb package builds
the ZAP types by default and the protobuf ones only under `-tags grpc`, a path
that does not compile (table/builder.go calls pb.Marshal, which that tag
removes). One call site in posting needed converting; every other type here is
Hanzo's own protobuf and is untouched.

NO TRANSPORT. An embedded engine dials nothing, so nothing here imports
google.golang.org/grpc. Removed: 20 transport functions in x, the generated
service stubs for Raft, Zero and Worker (1,657 lines), and the JWT helper —
identity belongs to IAM. The core called none of them.

NOT KEPT: worker, conn, raftwal, the cluster commands, the GraphQL layer and the
test harnesses. `query`, the DQL execution engine, went with them because it
depends on worker; parsing DQL is available here, executing it is not.

The history of the upstream project lives at github.com/dgraph-io/dgraph. This
repository begins at the derivation because three quarters of that history
describes code this fork does not carry.
2026-08-20 21:26:27 -07:00

57 lines
1.9 KiB
Go

/*
* SPDX-FileCopyrightText: © 2017-2026 Istari Digital, Inc.
* SPDX-License-Identifier: Apache-2.0
*/
package x
import (
"github.com/spf13/pflag"
"github.com/dgraph-io/ristretto/v2/z"
)
const (
TraceDefaults = `ratio=0.01; jaeger=; datadog=; service=;`
TelemetryDefaults = `reports=true;sentry=false;`
)
// FillCommonFlags stores flags common to Alpha and Zero.
func FillCommonFlags(flag *pflag.FlagSet) {
flag.String("my", "",
"addr:port of this server, so other Dgraph servers can talk to this.")
// OpenCensus flags.
//
// datadog: See https://github.com/DataDog/opencensus-go-exporter-datadog/issues/34
// about the status of supporting annotation logs through the datadog exporter
flag.String("trace", TraceDefaults, z.NewSuperFlagHelp(TraceDefaults).
Head("Trace options").
Flag("ratio",
"The ratio of queries to trace.").
Flag("jaeger",
"URL of Jaeger/opentelemetry-collector to send OpenTelemetry traces.").
Flag("datadog",
"URL of Datadog to send OpenCensus traces. As of now, the trace exporter does not "+
"support annotation logs and discards them.").
Flag("service",
"Custom service name for tracing. If set, overrides the default (dgraph.alpha/dgraph.zero).").
String())
flag.String("survive", "process",
`Choose between "process" or "filesystem".`+"\n "+
`If set to "process", there would be no data loss in case of process crash, but `+
`the behavior would be indeterministic in case of filesystem crash.`+"\n "+
`If set to "filesystem", blocking sync would be called after every write, hence `+
`guaranteeing no data loss in case of hard reboot.`+"\n "+
`Most users should be OK with choosing "process".`)
flag.String("telemetry", TelemetryDefaults, z.NewSuperFlagHelp(TelemetryDefaults).
Head("Telemetry (diagnostic) options").
Flag("reports",
"Send anonymous telemetry data to Dgraph devs.").
Flag("sentry",
"(Deprecated) Send crash events to Sentry.").
String())
}