server

package
v4.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2018 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server implements the git server protocol. For most use cases, the transport-specific implementations should be used.

Index

Constants

This section is empty.

Variables

View Source
var DefaultLoader = NewFilesystemLoader(osfs.New(""))

DefaultLoader is a filesystem loader ignoring host and resolving paths to /.

View Source
var DefaultServer = NewServer(DefaultLoader)
View Source
var (
	ErrUpdateReference = errors.New("failed to update ref")
)

Functions

func NewClient

func NewClient(loader Loader) transport.Transport

NewClient returns a transport.Transport implementing a client with an embedded server.

func NewServer

func NewServer(loader Loader) transport.Transport

NewServer returns a transport.Transport implementing a git server, independent of transport. Each transport must wrap this.

Types

type Loader

type Loader interface {
	// Load loads a storer.Storer given a transport.Endpoint.
	// Returns transport.ErrRepositoryNotFound if the repository does not
	// exist.
	Load(ep *transport.Endpoint) (storer.Storer, error)
}

Loader loads repository's storer.Storer based on an optional host and a path.

func NewFilesystemLoader

func NewFilesystemLoader(base billy.Filesystem) Loader

NewFilesystemLoader creates a Loader that ignores host and resolves paths with a given base filesystem.

type MapLoader

type MapLoader map[string]storer.Storer

MapLoader is a Loader that uses a lookup map of storer.Storer by transport.Endpoint.

func (MapLoader) Load

func (l MapLoader) Load(ep *transport.Endpoint) (storer.Storer, error)

Load returns a storer.Storer for given a transport.Endpoint by looking it up in the map. Returns transport.ErrRepositoryNotFound if the endpoint does not exist.

Jump to

Keyboard shortcuts

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