Documentation
¶
Overview ¶
Package controller provides HTTP handlers for Git Smart HTTP protocol operations.
Package controller provides HTTP handlers for repository management operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DebugController ¶
DebugController handles debug endpoints for monitoring server health and memory usage.
func (*DebugController) ForceGC ¶
func (dc *DebugController) ForceGC(ctx *fiber.Ctx) error
ForceGC handles POST requests to /debug/gc endpoint. Forces garbage collection and returns memory usage before and after GC.
Response: JSON object with GC results
func (*DebugController) GoroutineStats ¶
func (dc *DebugController) GoroutineStats(ctx *fiber.Ctx) error
GoroutineStats handles GET requests to /debug/goroutines/stats endpoint. Returns summary statistics about goroutines without full stack traces.
Response: JSON object with goroutine statistics
func (*DebugController) Goroutines ¶
func (dc *DebugController) Goroutines(ctx *fiber.Ctx) error
Goroutines handles GET requests to /debug/goroutines endpoint. Returns a stack trace of all active goroutines for debugging leaks.
Response: Plain text stack traces of all goroutines
func (*DebugController) MemStats ¶
func (dc *DebugController) MemStats(ctx *fiber.Ctx) error
MemStats handles GET requests to /debug/memory endpoint. Returns detailed memory statistics including heap usage, GC activity, and goroutine counts.
Response: JSON object with memory statistics
type GitController ¶
type GitController struct { Logger zerolog.Logger // Logger for request logging and error reporting Storage storage.GitRepositoryStorage // Storage backend for Git repository operations }
GitController handles Git Smart HTTP protocol requests. It implements the server-side of the Git Smart HTTP transport protocol, supporting both upload-pack (clone/fetch) and receive-pack (push) operations.
func (*GitController) HandleReceivePack ¶
func (gc *GitController) HandleReceivePack(c *fiber.Ctx) error
HandleReceivePack handles POST requests to /{repo}/git-receive-pack endpoint. This handles the actual data transfer for push operations. It processes the client's reference updates and pack data, then sends back a status report.
Request body: Git pack protocol request with reference updates and pack data (binary) Response: Git pack protocol status report indicating success/failure of each reference update
func (*GitController) HandleUploadPack ¶
func (gc *GitController) HandleUploadPack(c *fiber.Ctx) error
HandleUploadPack handles POST requests to /{repo}/git-upload-pack endpoint. This handles the actual data transfer for clone and fetch operations. It processes the client's wants/haves and sends back the requested pack data.
Request body: Git pack protocol request (binary) Response: Git pack protocol response with requested objects
func (*GitController) InfoRefs ¶
func (gc *GitController) InfoRefs(ctx *fiber.Ctx) error
InfoRefs handles GET requests to /{repo}/info/refs endpoint. This is the initial request in Git Smart HTTP protocol that advertises repository references (branches, tags) to the client.
Query parameters:
- service: either "git-upload-pack" (for clone/fetch) or "git-receive-pack" (for push)
Response: Git protocol formatted reference advertisement
type RepoController ¶
type RepoController struct { Logger zerolog.Logger // Logger for request logging and error reporting Storage storage.GitRepositoryStorage // Storage backend for repository operations }
RepoController handles HTTP requests for repository management operations. It provides endpoints for creating and listing Git repositories through the configured storage backend.
func (*RepoController) CreateRepo ¶
func (c *RepoController) CreateRepo(ctx *fiber.Ctx) error
CreateRepo handles POST requests to create a new Git repository. It expects a JSON payload with a "name" field and creates a bare repository in the configured storage backend.
Request body: {"name": "repository-name"} Response: 201 Created with "repository created" message on success
func (*RepoController) ListRepos ¶
func (c *RepoController) ListRepos(ctx *fiber.Ctx) error
ListRepos handles GET requests to retrieve a list of all repositories. Returns a JSON array containing the names of all repositories in the storage backend.
Response: 200 OK with JSON array of repository names