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

Function Init

worker/worker.go:48–64  ·  view source on GitHub ↗

Init initializes this package.

(ps *badger.DB)

Source from the content-addressed store, hash-verified

46
47// Init initializes this package.
48func Init(ps *badger.DB) {
49 pstore = ps
50 // needs to be initialized after group config
51 limiter = rateLimiter{c: sync.NewCond(&sync.Mutex{}), max: int(x.WorkerConfig.Raft.GetInt64("pending-proposals"))}
52 go limiter.bleed()
53
54 grpcOpts := []grpc.ServerOption{
55 grpc.MaxRecvMsgSize(x.GrpcMaxSize),
56 grpc.MaxSendMsgSize(x.GrpcMaxSize),
57 grpc.MaxConcurrentStreams(math.MaxInt32),
58 grpc.StatsHandler(otelgrpc.NewServerHandler()),
59 }
60 if x.WorkerConfig.TLSServerConfig != nil {
61 grpcOpts = append(grpcOpts, grpc.Creds(credentials.NewTLS(x.WorkerConfig.TLSServerConfig)))
62 }
63 workerServer = grpc.NewServer(grpcOpts...)
64}
65
66// grpcWorker struct implements the gRPC server interface.
67type grpcWorker struct {

Callers 15

runFunction · 0.92
TestEmptyTypeSchemaFunction · 0.70
TestGetScalarListFunction · 0.70
TestMultipleTxnListCountFunction · 0.70
TestScalarPredicateCountFunction · 0.70
TestSingleUidReplacementFunction · 0.70
TestSingleStringFunction · 0.70
TestLangExactFunction · 0.70

Calls 1

bleedMethod · 0.80

Tested by 14

TestEmptyTypeSchemaFunction · 0.56
TestGetScalarListFunction · 0.56
TestMultipleTxnListCountFunction · 0.56
TestScalarPredicateCountFunction · 0.56
TestSingleUidReplacementFunction · 0.56
TestSingleStringFunction · 0.56
TestLangExactFunction · 0.56
TestReverseEdgeFunction · 0.56