ulreq

package
v4.0.0-rc2+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ulreq implements encoding and decoding upload-request messages from a git-upload-pack command.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

A Decoder reads and decodes AdvRef values from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder returns a new decoder that reads from r.

Will not read more data from r than necessary.

func (*Decoder) Decode

func (d *Decoder) Decode(v *UlReq) error

Decode reads the next upload-request form its input and stores it in the value pointed to by v.

Example
Output:

capabilities = ofs-delta sysref=HEAD:/refs/heads/master
wants = [1111111111111111111111111111111111111111 2222222222222222222222222222222222222222 3333333333333333333333333333333333333333]
shallows = [aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb]
depth = 2015-01-02 03:04:05 +0000 UTC

type Depth

type Depth interface {
	// contains filtered or unexported methods
}

Depth values stores the desired depth of the requested packfile: see DepthCommit, DepthSince and DepthReference.

type DepthCommits

type DepthCommits int

DepthCommits values stores the maximum number of requested commits in the packfile. Zero means infinite. A negative value will have undefined consecuences.

type DepthReference

type DepthReference string

DepthReference requests only commits not to found in the specified reference.

type DepthSince

type DepthSince time.Time

DepthSince values requests only commits newer than the specified time.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

An Encoder writes UlReq values to an output stream.

func NewEncoder

func NewEncoder(w io.Writer) *Encoder

NewEncoder returns a new encoder that writes to w.

func (*Encoder) Encode

func (e *Encoder) Encode(v *UlReq) error

Encode writes the UlReq encoding of v to the stream.

All the payloads will end with a newline character. Wants and shallows are sorted alphabetically. A depth of 0 means no depth request is sent.

Example
Output:

005bwant 1111111111111111111111111111111111111111 ofs-delta sysref=HEAD:/refs/heads/master
0032want 2222222222222222222222222222222222222222
0032want 3333333333333333333333333333333333333333
0035shallow aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
0035shallow bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
001cdeepen-since 1420167845
0000

type UlReq

type UlReq struct {
	Capabilities *packp.Capabilities
	Wants        []core.Hash
	Shallows     []core.Hash
	Depth        Depth
}

UlReq values represent the information transmitted on a upload-request message. Values from this type are not zero-value safe, use the New function instead.

func New

func New() *UlReq

New returns a pointer to a new UlReq value, ready to be used. It has no capabilities, wants or shallows and an infinite depth. Please note that to encode an upload-request it has to have at least one wanted hash.

Jump to

Keyboard shortcuts

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