route

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSSA

func BuildSSA(c *gin.Context)

BuildSSA serves the code send by user and builds its SSA IR into html. TODO: speedup for request response, e.g. as async rest api.

func Pong

func Pong(c *gin.Context)

Pong response for health check

func Register

func Register() *gin.Engine

Register routers for the ssa service.

Types

type BuildSSAInput

type BuildSSAInput struct {
	FuncName string `json:"funcname"`
	GcFlags  string `json:"gcflags"`
	Code     string `json:"code"`
}

BuildSSAInput ...

type BuildSSAOutput

type BuildSSAOutput struct {
	BuildID string `json:"build_id"`
	Msg     string `json:"msg"`
}

BuildSSAOutput ...

type PingInput

type PingInput struct {
}

PingInput is a a reserved structure

type PingOutput

type PingOutput struct {
	Message   string `json:"message"`
	GoVersion string `json:"go_version"`
}

PingOutput is used for service health

type Router

type Router struct {
	Engine *gin.Engine
}

Router is a router engine.

func (*Router) SetupAPI

func (r *Router) SetupAPI()

SetupAPI serves the API endpoints of the gossa service.

func (*Router) SetupApp

func (r *Router) SetupApp()

SetupApp serves the static website of Go SSA Playground.

func (*Router) SetupProfile

func (r *Router) SetupProfile()

SetupProfile the standard HandlerFuncs from the net/http/pprof package with the provided gin.Engine. prefixOptions is a optional. If not prefixOptions, the default path prefix is used, otherwise first prefixOptions will be path prefix.

Basic Usage:

  • use the pprof tool to look at the heap profile: go tool pprof localhost:8080/midgard/api/v1/debug/pprof/heap
  • look at a 30-second CPU profile: go tool pprof localhost:8080/midgard/api/v1/debug/pprof/profile
  • look at the goroutine blocking profile, after calling runtime.SetBlockProfileRate: go tool pprof localhost:8080/midgard/api/v1/debug/pprof/block
  • collect a 5-second execution trace: go tool pprof localhost:8080/midgard/api/v1/debug/pprof/trace?seconds=5

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL