gerrit

package
v0.0.0-...-5fb48e9 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT 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 CL

type CL struct {
	Project         string `json:"project"`
	ChangeID        string `json:"change_id"`
	Number          int64  `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"`
}

CL represents a merged CL that we send to the subscriber of the poller.

func (cl *CL) Link() string

Link returns the golang.org CL link for this CL, in the form of https://golang.org/cl/<Number>/

func (*CL) Message

func (cl *CL) Message() string

Message returns a string suitable as a subject line in a message about the CL.

type DefaultStore

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

DefaultStore is a default implementation of the Store interface.

func NewStore

func NewStore(rc *redis.Client) (*DefaultStore, error)

NewStore returns a new DefaultStore.

func (*DefaultStore) Get

func (s *DefaultStore) Get(ctx context.Context) (int64, bool, error)

Get satisfies Store.

func (*DefaultStore) Put

func (s *DefaultStore) Put(ctx context.Context, id int64) error

Put satisfies Store.

type Gerrit

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

Gerrit tracks merged CLs.

func New

func New(s Store, http *http.Client, logger zerolog.Logger, notify NotifyFunc) (*Gerrit, error)

New creates an initializes an instance of Gerrit.

func (*Gerrit) Poll

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

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

type NotifyFunc

type NotifyFunc func(context.Context, CL) error

NotifyFunc represents the function signature the poller notifies on a new item. If error is not nil, the item will be retried at some point in the future.

type Store

type Store interface {
	Get(ctx context.Context) (id int64, notFound bool, err error)
	Put(ctx context.Context, lastID int64) error
}

Store represents the shape of the storage system.

Jump to

Keyboard shortcuts

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