Init initializes this package.
(ps *badger.DB)
| 46 | |
| 47 | // Init initializes this package. |
| 48 | func 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. |
| 67 | type grpcWorker struct { |