Skip to content

Commit

Permalink
added some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
renaynay committed Jun 22, 2020
1 parent d631bf1 commit a1f3e33
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type Node struct {

lifecycles map[reflect.Type]Lifecycle // All registered backends, services, and auxiliary services that have a lifecycle

HTTPServers *HTTPServers // TODO document
HTTPServers *HTTPServers // HTTPServers stores information about the node's rpc, ws, and graphQL http servers.

rpcAPIs []rpc.API // List of APIs currently provided by the node
inprocHandler *rpc.Server // In-process RPC request handler to process the API requests
Expand Down
4 changes: 2 additions & 2 deletions node/rpcstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ func isWebsocket(r *http.Request) bool {
strings.ToLower(r.Header.Get("Connection")) == "upgrade"
}

// TODO document
// NewGQLUpgradeHandler wraps the given handler, h, in the given graphQL handler.
func NewGQLUpgradeHandler(h http.Handler, gql http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if isGQL(r) {
Expand All @@ -254,7 +254,7 @@ func NewGQLUpgradeHandler(h http.Handler, gql http.Handler) http.Handler {
})
}

// TODO document
// isGQL checks if the given request is a graphQL request.
func isGQL(r *http.Request) bool {
return r.URL.Path == "/graphql" || r.URL.Path == "/graphql/"
}
5 changes: 4 additions & 1 deletion node/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ func (ctx *ServiceContext) ExtRPCEnabled() bool {
return ctx.Config.ExtRPCEnabled()
}

// TODO document
// Lifecycle encompasses the behavior of services that can be started and stopped
// on the node. Lifecycle management is delegated to the node, but it is the
// responsibility of the service-specific package to configure and register the
// service on the node using the `RegisterLifecycle` method.
type Lifecycle interface {
// Start is called after all services have been constructed and the networking
// layer was also initialized to spawn any goroutines required by the service.
Expand Down

0 comments on commit a1f3e33

Please sign in to comment.