gitsync

package
v0.0.0-...-e2f08a5 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2017 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package gitsync provides the tools to syncronise git repositories between peers.

Index

Constants

This section is empty.

Variables

View Source
var (
	Port             = 9999 // mDNS/Bonjour uses 5353
	IP4MulticastAddr = &net.UDPAddr{
		IP:   net.ParseIP("224.0.0.251"),
		Port: Port,
	}

	IP6MulticastAddr = &net.UDPAddr{
		IP:   net.ParseIP("ff02::fb"),
		Port: Port,
	}
)

Functions

func NetIO

func NetIO(l log.Logger, repo Repo, addr *net.UDPAddr, fromNet, toNet chan GitChange)

NetIO shares GitChanges on toNet with the network via a multicast group. It will pass on GitChanges from the network via fromNet. It uniques the daemon instance by changing the .Name member to be name@<host IP>/<original .Name)

func NewCliRepo

func NewCliRepo(userName string, repoAbsPath string) (repo *cliReader, err error)

func PollDirectory

func PollDirectory(l log.Logger, dirName string, repo Repo, changes chan GitChange, period time.Duration)

PollDirectory will poll a git repo. It will look for changes to branches and tags including creation and deletion.

Types

type GitChange

type GitChange struct {
	User          string // username at host
	HostIp        string // IP address of host
	RepoName      string // name of repo directory
	RefName       string // name of reference
	Prev, Current string // previous and current reference for branch
	RootCommit    string // ref hash of the first commit (assuming there is only one)
	CheckedOut    bool
}

func (GitChange) FromRepo

func (change GitChange) FromRepo(repo Repo) bool

type Repo

type Repo interface {
	fmt.Stringer

	Name() string
	Path() string
	User() string
	Branches() (branches []*GitChange, err error)
	RootCommit() (rootCommit string, err error)
}

Repo represents a git repository. It provides the basic interrogation abilities.

Jump to

Keyboard shortcuts

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