Documentation
¶
Index ¶
- Variables
- type Decoder
- type Encoder
- type GitOperation
- type GitRequestHandler
- func (h *GitRequestHandler) NegotiatePullPackfile(revisions []git.Revision) (int, error)
- func (h *GitRequestHandler) ReceiveHandshake() (GitOperation, error)
- func (h *GitRequestHandler) ReceivePullWants() ([]string, error)
- func (h *GitRequestHandler) ReceivePushRefs() ([]RefUpdate, error)
- func (h *GitRequestHandler) SendPackfile(r io.Reader) error
- func (h *GitRequestHandler) SendRefs(refs map[string]string, op GitOperation) error
- func (h *GitRequestHandler) ServeRequest() error
- type RefUpdate
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorInvalidHandshake occurs if the client presents an invalid handshake ErrorInvalidHandshake = errors.New("invalid handshake from client") // ErrorInvalidWantLine occurs if the client sends an invalid want line ErrorInvalidWantLine = errors.New("invalid `want` line sent by client") // ErrorInvalidHaveLine occurs if the client sends an invalid have line ErrorInvalidHaveLine = errors.New("invalid `have` line sent by client") // ErrorInvalidPushRefsLine occurs if the client sends an invalid line during ref update ErrorInvalidPushRefsLine = errors.New("invalid line sent by client during ref update") // ErrorNoHead occurs if a repo has no HEAD ErrorNoHead = errors.New("no HEAD in repo") )
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
type Decoder interface {
Decode(*[]byte) error
// Read bypasses the pkt-line decoding, used when receiving packfiles
Read(p []byte) (n int, err error)
}
Decoder is used to decode data using pkt-line ACKs are decoded as `nil`.
type GitOperation ¶
type GitOperation int
A GitOperation can either be a pull or push
const ( // GitPull is a pull GitPull GitOperation = iota + 1 // GitPush is a push GitPush )
type GitRequestHandler ¶
type GitRequestHandler struct {
// contains filtered or unexported fields
}
GitRequestHandler handles the git protocol
func NewGitRequestHandler ¶
func NewGitRequestHandler(out Encoder, in Decoder, repo git.Repo) *GitRequestHandler
NewGitRequestHandler makes a handler for the git protocol
func (*GitRequestHandler) NegotiatePullPackfile ¶
func (h *GitRequestHandler) NegotiatePullPackfile(revisions []git.Revision) (int, error)
NegotiatePullPackfile receives the client's haves and uses the repo to calculate the deltas that should be sent to the client
func (*GitRequestHandler) ReceiveHandshake ¶
func (h *GitRequestHandler) ReceiveHandshake() (GitOperation, error)
ReceiveHandshake reads repo and host info from the client
func (*GitRequestHandler) ReceivePullWants ¶
func (h *GitRequestHandler) ReceivePullWants() ([]string, error)
ReceivePullWants receives the requested refs from the client
func (*GitRequestHandler) ReceivePushRefs ¶
func (h *GitRequestHandler) ReceivePushRefs() ([]RefUpdate, error)
ReceivePushRefs receives the references to be updates in a push from the client
func (*GitRequestHandler) SendPackfile ¶
func (h *GitRequestHandler) SendPackfile(r io.Reader) error
SendPackfile sends a packfile using the side-band-64k encoding
func (*GitRequestHandler) SendRefs ¶
func (h *GitRequestHandler) SendRefs(refs map[string]string, op GitOperation) error
SendRefs sends the given references to the client
func (*GitRequestHandler) ServeRequest ¶
func (h *GitRequestHandler) ServeRequest() error
ServeRequest handles a single git request