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

Function run

dgraph/cmd/debug/run.go:942–1042  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

940}
941
942func run() {
943 go func() {
944 for i := 8080; i < 9080; i++ {
945 fmt.Printf("Listening for /debug HTTP requests at port: %d\n", i)
946 if err := http.ListenAndServe(fmt.Sprintf("localhost:%d", i), x.SanitizedDefaultServeMux()); err != nil {
947 fmt.Println("Port busy. Trying another one...")
948 continue
949 }
950 }
951 }()
952
953 if opt.parseKey != "" {
954 k, err := hex.DecodeString(opt.parseKey)
955 if err != nil {
956 log.Fatalf("error while decoding hex key: %v\n", err)
957 }
958 pk, err := x.Parse(k)
959 if err != nil {
960 log.Fatalf("error while parsing key: %v\n", err)
961 }
962 if pk.IsData() {
963 fmt.Printf("{d}")
964 }
965 if pk.IsIndex() {
966 fmt.Printf("{i}")
967 }
968 if pk.IsCountOrCountRev() {
969 fmt.Printf("{c}")
970 }
971 if pk.IsSchema() {
972 fmt.Printf("{s}")
973 }
974 if pk.IsReverse() {
975 fmt.Printf("{r}")
976 }
977 fmt.Printf(" Key: %+v\n", pk)
978 return
979 }
980
981 var err error
982 dir := opt.pdir
983 isWal := false
984 if len(dir) == 0 {
985 dir = opt.wdir
986 isWal = true
987 }
988 keys, err := x.GetEncAclKeys(Debug.Conf)
989 x.Check(err)
990 opt.key = keys.EncKey
991
992 if isWal {
993 store, err := raftwal.InitEncrypted(dir, opt.key)
994 x.Check(err)
995 defer func() { x.Check(store.Close()) }()
996 if err := handleWal(store); err != nil {
997 fmt.Printf("\nGot error while handling WAL: %v\n", err)
998 }
999 return

Callers 1

initFunction · 0.70

Calls 15

SanitizedDefaultServeMuxFunction · 0.92
ParseFunction · 0.92
GetEncAclKeysFunction · 0.92
CheckFunction · 0.92
InitEncryptedFunction · 0.92
AssertTruefFunction · 0.92
InitFunction · 0.92
handleWalFunction · 0.85
printSummaryFunction · 0.85
rollupKeyFunction · 0.85
lookupFunction · 0.85
jepsenFunction · 0.85

Tested by

no test coverage detected