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 ¶
- type Endpoint
- type Gateway
- type Network
- type Server
- func (server *Server) Adopt(ctx context.Context, request *connect.Request[gitdv1.AdoptRequest], ...) error
- func (server *Server) Audit(_ context.Context, request *connect.Request[gitdv1.AuditRequest]) (*connect.Response[gitdv1.AuditResponse], error)
- func (server *Server) Changes(ctx context.Context, request *connect.Request[gitdv1.ChangesRequest]) (*connect.Response[gitdv1.ChangesResponse], error)
- func (server *Server) Checkout(ctx context.Context, request *connect.Request[gitdv1.CheckoutRequest], ...) error
- func (server *Server) Compare(ctx context.Context, request *connect.Request[gitdv1.CompareRequest]) (*connect.Response[gitdv1.CompareResponse], error)
- func (server *Server) Conflicts(ctx context.Context, request *connect.Request[gitdv1.ConflictsRequest]) (*connect.Response[gitdv1.ConflictsResponse], error)
- func (server *Server) Describe(ctx context.Context, request *connect.Request[gitdv1.DescribeRequest]) (*connect.Response[gitdv1.DescribeResponse], error)
- func (server *Server) Diff(ctx context.Context, request *connect.Request[gitdv1.DiffRequest]) (*connect.Response[gitdv1.DiffResponse], error)
- func (server *Server) Info(ctx context.Context, _ *connect.Request[gitdv1.InfoRequest]) (*connect.Response[gitdv1.InfoResponse], error)
- func (server *Server) List(ctx context.Context, _ *connect.Request[gitdv1.ListRequest]) (*connect.Response[gitdv1.ListResponse], error)
- func (server *Server) ListWarm(_ context.Context, request *connect.Request[gitdv1.ListWarmRequest]) (*connect.Response[gitdv1.ListWarmResponse], error)
- func (server *Server) Prepare(ctx context.Context, request *connect.Request[gitdv1.PrepareRequest], ...) error
- func (server *Server) Probe(ctx context.Context, request *connect.Request[gitdv1.ProbeRequest]) (*connect.Response[gitdv1.ProbeResponse], error)
- func (server *Server) Publish(ctx context.Context, request *connect.Request[gitdv1.PublishRequest]) (*connect.Response[gitdv1.PublishResponse], error)
- func (server *Server) Remove(ctx context.Context, request *connect.Request[gitdv1.RemoveRequest]) (*connect.Response[gitdv1.RemoveResponse], error)
- func (server *Server) Retire(ctx context.Context, request *connect.Request[gitdv1.RetireRequest]) (*connect.Response[gitdv1.RetireResponse], error)
- func (server *Server) Routes() http.Handler
- func (server *Server) Seal(ctx context.Context, request *connect.Request[gitdv1.SealRequest]) (*connect.Response[gitdv1.SealResponse], error)
- func (server *Server) SyncSubmodules(ctx context.Context, request *connect.Request[gitdv1.SyncSubmodulesRequest], ...) error
- func (server *Server) Update(ctx context.Context, request *connect.Request[gitdv1.UpdateRequest], ...) error
- func (server *Server) Watch(ctx context.Context, request *connect.Request[gitdv1.WatchRequest], ...) error
- type Tenant
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.
type Network ¶
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 *Server) Adopt( ctx context.Context, request *connect.Request[gitdv1.AdoptRequest], stream *connect.ServerStream[gitdv1.AdoptResponse], ) error
func (*Server) Checkout ¶
func (server *Server) Checkout( ctx context.Context, request *connect.Request[gitdv1.CheckoutRequest], stream *connect.ServerStream[gitdv1.CheckoutResponse], ) error
func (*Server) ListWarm ¶
func (server *Server) ListWarm( _ context.Context, request *connect.Request[gitdv1.ListWarmRequest], ) (*connect.Response[gitdv1.ListWarmResponse], error)
ListWarm lists the warm layers of a repository.
func (*Server) Prepare ¶
func (server *Server) Prepare( ctx context.Context, request *connect.Request[gitdv1.PrepareRequest], stream *connect.ServerStream[gitdv1.PrepareResponse], ) error
func (*Server) Routes ¶
Routes are the handlers of every service this part of gitd answers, one tenant's or the implicit one's.
func (*Server) Seal ¶
func (server *Server) Seal( ctx context.Context, request *connect.Request[gitdv1.SealRequest], ) (*connect.Response[gitdv1.SealResponse], error)
Seal makes an overlay workspace's own layer a warm layer of its repository.
func (*Server) SyncSubmodules ¶
func (server *Server) SyncSubmodules( ctx context.Context, request *connect.Request[gitdv1.SyncSubmodulesRequest], stream *connect.ServerStream[gitdv1.SyncSubmodulesResponse], ) error
func (*Server) Update ¶
func (server *Server) Update( ctx context.Context, request *connect.Request[gitdv1.UpdateRequest], stream *connect.ServerStream[gitdv1.UpdateResponse], ) error
func (*Server) Watch ¶
func (server *Server) Watch( ctx context.Context, request *connect.Request[gitdv1.WatchRequest], stream *connect.ServerStream[gitdv1.WatchResponse], ) error
Watch streams what happens to the workspaces asked for, or to every one, until the caller goes or falls too far behind.