gerrit

package
v0.0.0-...-382b95a Latest Latest
Warning

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

Go to latest
Published: May 31, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("CL not found")

ErrNotFound should be returned by Store implementations when CL number doesn't exist.

Functions

This section is empty.

Types

type GCPStore

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

GCPStore implements Store and tracks state in a Google Cloud Platform Datastore.

func NewGCPStore

func NewGCPStore(ds *datastore.Client) *GCPStore

NewGCPStore construct a new *GCPStore.

func (*GCPStore) Exists

func (s *GCPStore) Exists(ctx context.Context, number int) (bool, error)

func (*GCPStore) LatestNumber

func (s *GCPStore) LatestNumber(ctx context.Context) (int, error)

func (*GCPStore) Put

func (s *GCPStore) Put(ctx context.Context, number int, cl storedCL) error

type Gerrit

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

Gerrit tracks merged CLs.

func New

func New(ctx context.Context, s Store, http *http.Client, logf func(message string, args ...interface{}), notify func(GerritCL) bool) (*Gerrit, error)

New creates an initializes an instance of Gerrit.

func (*Gerrit) Poll

func (g *Gerrit) Poll(ctx context.Context)

Poll checks for new merged CLs and calls notify for each CL.

type GerritCL

type GerritCL struct {
	Project         string `json:"project"`
	ChangeID        string `json:"change_id"`
	Number          int    `json:"_number"`
	Subject         string `json:"subject"`
	Branch          string `json:"branch"`
	CurrentRevision string `json:"current_revision"`
	Revisions       map[string]struct {
		Commit struct {
			Subject string `json:"subject"`
			Message string `json:"message"`
		} `json:"commit"`
	} `json:"revisions"`
}
func (cl *GerritCL) Link() string

func (*GerritCL) Message

func (cl *GerritCL) Message() string

type Store

type Store interface {
	LatestNumber(context.Context) (int, error)
	Put(_ context.Context, number int, _ storedCL) error
	Exists(_ context.Context, number int) (bool, error)
}

Store persists information about CLs that have been handled.

Jump to

Keyboard shortcuts

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