claim

package
v0.173.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package claim is a desk's claim of an issue as GitHub carries it: one marker comment per issue and desk, which every desk working the same repository reads, whatever its configuration, board or machine.

The comment's first line is the marker, an HTML comment GitHub does not render; a sentence for people follows it:

<!-- beekeeper:claim desk=platform-desk session=0b5c… at=2026-11-01T00:12:00Z seen=2026-11-01T06:12:00Z -->
Claimed by beekeeper desk platform-desk for session "0b5c…" since 2026-11-01 00:12 UTC.

A desk refreshes seen while its claim holds and adds released=<time> when the claim ends; it edits its one comment in place, never adding another.

Index

Constants

This section is empty.

Variables

View Source
var ErrGone = errors.New("the claim's comment is gone")

ErrGone is the answer to an edit of a comment GitHub no longer has.

Functions

This section is empty.

Types

type Client

type Client struct {
	GH    github.GH
	Cache string
}

Client reads and writes the marker comments of issues through GitHub's REST API, acting on each issue's repository (github.ActingOn). A read sends the ETag of the last answer for the issue (Cache, a JSON file; none when empty): an unchanged thread costs no rate limit.

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, issue string, id int64) error

Delete removes comment id on issue; ErrGone when GitHub has no such comment.

func (*Client) Edit

func (c *Client) Edit(ctx context.Context, issue string, id int64, m Marker) error

Edit replaces comment id on issue with m; ErrGone when GitHub has no such comment.

func (*Client) Post

func (c *Client) Post(ctx context.Context, issue string, m Marker) (int64, error)

Post adds m as a new comment on issue and returns its id.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, issue string) (bool, error)

Pull says whether issue is a pull request, which carries no claim.

func (*Client) Read

func (c *Client) Read(ctx context.Context, issue string) ([]Comment, error)

Read is the marker comments on issue ref (owner/repo#n), oldest first.

type Comment

type Comment struct {
	ID int64 `json:"id"`
	Marker
}

Comment is a marker comment as GitHub keeps it: its id and its marker.

func Desk

func Desk(cs []Comment, desk string) *Comment

Desk is the comment of desk among cs, the oldest when there are several; nil when it has none.

func Others

func Others(cs []Comment, desk string, now time.Time, staleAfter time.Duration) (live, stale []Comment)

Others are the open claims of desks other than desk among cs, oldest first: live ones, which hold, and stale ones (Stale), which do not.

type Marker

type Marker struct {
	Desk     string
	Session  string
	At       time.Time
	Seen     time.Time
	Released time.Time
}

Marker is one desk's claim of an issue: the desk's configured name, the session holding it, since when, when the desk last refreshed it and, once it ended, when.

func Parse

func Parse(body string) (m Marker, ok bool)

Parse reads the marker a comment's body opens with; ok is false for any other comment, or a marker without a desk or a valid time.

func (Marker) Body

func (m Marker) Body() string

Body is the comment's text: the marker line and the sentence for people.

func (Marker) Open

func (m Marker) Open() bool

Open says whether the claim holds: not released.

func (Marker) Says

func (m Marker) Says(now time.Time, staleAfter time.Duration) string

Says is how a line names a claim: "desk lab (session "BK 1813") since 00:12 UTC", with "stale, " ahead of a stale one's.

func (Marker) Stale

func (m Marker) Stale(now time.Time, after time.Duration) bool

Stale says whether an open claim went unrefreshed for longer than after at now: shown, not honoured.

Directories

Path Synopsis
Package claimtest is a fake of the GitHub issue comments the claims live in, for the tests of the claim package and its callers.
Package claimtest is a fake of the GitHub issue comments the claims live in, for the tests of the claim package and its callers.

Jump to

Keyboard shortcuts

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