maintner

package
v0.0.0-...-8927fdd Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2017 License: BSD-3-Clause Imports: 32 Imported by: 0

Documentation

Overview

Package maintner mirrors, searches, syncs, and serves Git, Github, and Gerrit metadata.

Maintner is short for "Maintainer". This package is intended for use by many tools. The name of the daemon that serves the maintner data to other tools is "maintnerd".

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Corpus

type Corpus struct {
	MutationLogger MutationLogger
	Verbose        bool
	// contains filtered or unexported fields
}

Corpus holds all of a project's metadata.

There are two main phases to the Corpus: the catch-up phase, when the Corpus is populated from a MutationSource (disk, database), and the polling phase, when the Corpus polls for new events and stores/writes them to disk. Call StartLogging between the catch-up phase and the polling phase.

func NewCorpus

func NewCorpus(logger MutationLogger) *Corpus

func (*Corpus) AddGithub

func (c *Corpus) AddGithub(owner, repo, tokenFile string)

func (*Corpus) AddGoGitRepo

func (c *Corpus) AddGoGitRepo(goRepo, dir string)

AddGoGitRepo registers a git directory to have its metadata slurped into the corpus. The goRepo is a name like "go" or "net". The dir is a path on disk.

TODO(bradfitz): this whole interface is temporary. Make this support any git repo and make this (optionally?) use the gitmirror service later instead of a separate copy on disk.

func (*Corpus) Initialize

func (c *Corpus) Initialize(ctx context.Context, src MutationSource) error

Initialize populates the Corpus using the data from the MutationSource.

func (*Corpus) Poll

func (c *Corpus) Poll(ctx context.Context) error

Poll checks for new changes on all repositories being tracked by the Corpus.

func (*Corpus) PollGitCommits

func (c *Corpus) PollGitCommits(ctx context.Context, conf polledGitCommits) error

PollGitCommits polls for git commits in a directory.

func (*Corpus) PopulateFromAPIs

func (c *Corpus) PopulateFromAPIs(ctx context.Context) error

PopulateFromAPIs populates the corpus using API calls to the upstream Git, Github, and/or Gerrit servers.

func (*Corpus) PopulateFromDisk

func (c *Corpus) PopulateFromDisk(ctx context.Context, dir string) error

PopulateFromDisk populates the corpus from a set of mutation logs in a local directory.

func (*Corpus) PopulateFromServer

func (c *Corpus) PopulateFromServer(ctx context.Context, serverURL string) error

PopulateFromServer populates the corpus from a maintnerd server.

func (*Corpus) QueryFrequentlyModifiedFiles

func (c *Corpus) QueryFrequentlyModifiedFiles(topN int) []FileCount

queryFrequentlyModifiedFiles is an example query just for fun. It is not currently used by anything.

func (*Corpus) SetDebug

func (c *Corpus) SetDebug()

func (*Corpus) StartLogging

func (c *Corpus) StartLogging()

StartLogging indicates that further changes should be written to the log.

type DiskMutationLogger

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

DiskMutationLogger logs mutations to disk.

func NewDiskMutationLogger

func NewDiskMutationLogger(directory string) *DiskMutationLogger

NewDiskMutationLogger creates a new DiskMutationLogger, which will create mutations in the given directory.

func (*DiskMutationLogger) GetMutations

func (d *DiskMutationLogger) GetMutations(ctx context.Context) <-chan *maintpb.Mutation

func (*DiskMutationLogger) Log

Log will write m to disk. If a mutation file does not exist for the current day, it will be created.

type FileCount

type FileCount struct {
	File  string
	Count int
}

type MutationLogger

type MutationLogger interface {
	Log(*maintpb.Mutation) error
}

A MutationLogger logs mutations.

type MutationSource

type MutationSource interface {
	// GetMutations returns a channel of mutations.
	// The channel should be closed at the end.
	// All sends on the returned channel should select
	// on the provided context.
	GetMutations(context.Context) <-chan *maintpb.Mutation
}

A MutationSource yields a log of mutations that will catch a corpus back up to the present.

Directories

Path Synopsis
The maintnerd command serves project maintainer data from Git, Github, and/or Gerrit.
The maintnerd command serves project maintainer data from Git, Github, and/or Gerrit.
Package maintpb is a generated protocol buffer package.
Package maintpb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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