server

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package server answers the contract in proto/gitd/v1 over ConnectRPC, on a Unix socket.

Connect speaks gRPC, gRPC-Web and its own HTTP protocol with the same handlers, so the client calls it with a generated client and a person can call it with `buf curl`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Tokens    *endpoint.Tokens
	Sandboxes *endpoint.Sandboxes
	URL       string
	// Limits, when set, refuse a new sandbox repository once a tenant's disk is full, and
	// MaxSandboxes, when more than zero, once it has that many.
	Limits       interface{ WithinDisk() error }
	MaxSandboxes int
}

Endpoint is what the endpoint's calls need: its tokens and sandbox repositories, and the address sandboxes reach it at, e.g. `https://gitd.internal:9420`.

type Gateway

type Gateway struct {
	Version        string
	Socket         string
	MetricsAddress string
	Metrics        *metrics.Metrics
	Network        *Network
	Implicit       *Tenant
	Tenants        []*Tenant
}

Gateway is where gitd answers: its Unix socket, its network address, and its metrics. Every call reaches one part of gitd only. Without tenants that is the implicit part, which the socket answers as before and the network only with its key. With tenants, a call's key names its tenant — on the socket too — and a call without a valid key is refused; an endpoint token belongs to one tenant.

func (*Gateway) Serve

func (gateway *Gateway) Serve(ctx context.Context) error

Serve answers until ctx ends.

type Network

type Network struct {
	Listen      string
	TLSCertFile string
	TLSKeyFile  string
}

Network is gitd's address on the network, off unless Listen is set, served over TLS when a certificate is given; a renewed certificate is read without a restart.

type Server

type Server struct {
	Version     string
	Workspaces  *workspace.Workspaces
	Pools       *pool.Pools
	Runner      *git.Runner
	Metrics     *metrics.Metrics
	Operation   time.Duration
	Totals      func() (int, int64)
	RetirePools func(context.Context, time.Duration) (int, int64)
	// Strategy is how new workspaces are made here, and StrategyReason why, as detected at
	// start; TemplateTotals how many templates there are and the disk they take.
	Strategy       gitdv1.Strategy
	StrategyReason string
	TemplateTotals func() (int, int64)
	// AuditLog is every publish, done or refused, and every change to connections and
	// publishing settings.
	AuditLog *audit.Log
	// Connections are the credentials kept through the API, and FileConnections those the
	// configuration file declares, as the API shows them.
	Connections     *connections.Store
	FileConnections []*gitdv1.Connection
	// Publishing is the publishing settings, the file's and those set through the API.
	Publishing *publishing.Store
	// Events carry what happens to workspaces to Watch.
	Events *events.Bus
	// Endpoint is the git endpoint's tokens and sandbox repositories, when one is served.
	Endpoint *Endpoint
}

Server is the handlers of every service in the contract. Operation is how long a call may take when its caller set no deadline, and Totals says how many pools there are and the disk they take.

func (*Server) Adopt

func (*Server) Audit

func (*Server) Changes

func (*Server) Checkout

func (*Server) Compare

func (*Server) Conflicts

func (*Server) Describe

func (*Server) Diff

func (*Server) Info

func (*Server) ListWarm

ListWarm lists the warm layers of a repository.

func (*Server) Prepare

func (*Server) Probe

func (*Server) Publish

func (*Server) Remove

func (*Server) Retire

func (*Server) Routes

func (server *Server) Routes() http.Handler

Routes are the handlers of every service this part of gitd answers, one tenant's or the implicit one's.

func (*Server) Seal

Seal makes an overlay workspace's own layer a warm layer of its repository.

func (*Server) SyncSubmodules

func (*Server) Update

func (*Server) Watch

Watch streams what happens to the workspaces asked for, or to every one, until the caller goes or falls too far behind.

type Tenant

type Tenant struct {
	Name string
	Key  *apikeys.File
	API  http.Handler
	Git  *endpoint.Handler
}

Tenant is one part of gitd behind the gateway: a tenant's, or the implicit one when there are none. Key is what its callers bring; API its services; Git its endpoint, if any.

Jump to

Keyboard shortcuts

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