core: plug logtree into NodeDebugService

This introduces a new Proto API for accessing debug logs. Currently this
is implemented to be used by the debug service. However, these proto
definitions will likely be reused for production cluster APIs.

The implementation mostly consists of adding the proto, implementing
to/from conversion methods, and altering the debug service to use the
new API.

We also move all of the debug service implementation into a separate file,
to slightly clean up main.go. This produces an unfortunately colorful
diff, but it's just moving code around.

Test Plan: Manually tested using the dbg tool. We currently don't properly test the debug service. I suppose we should do that for the production cluster APIs, and just keep on going for now.

X-Origin-Diff: phab/D649
GitOrigin-RevId: ac454681e4b72b2876e313b3aeababa179eb1fa3
diff --git a/core/pkg/logtree/journal.go b/core/pkg/logtree/journal.go
index 893eff0..78c55a1 100644
--- a/core/pkg/logtree/journal.go
+++ b/core/pkg/logtree/journal.go
@@ -17,7 +17,7 @@
 package logtree
 
 import (
-	"fmt"
+	"errors"
 	"strings"
 	"sync"
 )
@@ -27,6 +27,10 @@
 // the root node of the tree.
 type DN string
 
+var (
+	ErrInvalidDN = errors.New("invalid DN")
+)
+
 // Path return the parts of a DN, ie. all the elements of the dot-delimited DN path. For the root node, an empty list
 // will be returned. An error will be returned if the DN is invalid (contains empty parts, eg. `foo..bar`, `.foo` or
 // `foo.`.
@@ -37,7 +41,7 @@
 	parts := strings.Split(string(d), ".")
 	for _, p := range parts {
 		if p == "" {
-			return nil, fmt.Errorf("invalid DN")
+			return nil, ErrInvalidDN
 		}
 	}
 	return parts, nil