issuestore

package
v0.0.0-...-03d6fc4 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Bucket names in boltdb. 'INDEX' in the name indicates an index.
	ISSUES_DB    = "issues"
	DIGEST_INDEX = "digest"
	TRACE_INDEX  = "trace"
	IGNORE_INDEX = "ignore"
	TEST_INDEX   = "test"
)
View Source
const IDX_SEPARATOR = "|"

Separator used to separate child and parent id in indices.

Variables

This section is empty.

Functions

This section is empty.

Types

type Annotation

type Annotation struct {
	IssueID   string   // id of the issue in Monorail
	Digests   []string // Image digests connected to this issue
	Traces    []string // Trace ids connected to this issues.
	Ignores   []string // Ignore ids connected to this issue.
	TestNames []string // Test names connected to this issue.
}

Annotation captures annotations for the issue identified by IssueID.

func (*Annotation) Add

func (r *Annotation) Add(deltaRec *Annotation) bool

Adds the digests, traces, ignores and tests in delta to the current annotation. and deduplicates in the process.

func (*Annotation) IndexValues

func (a *Annotation) IndexValues() map[string][]string

IndexValues see boltutil.Record interface.

func (*Annotation) IsEmpty

func (r *Annotation) IsEmpty() bool

IsEmpty returns true if all all annotations are empty.

func (*Annotation) Key

func (a *Annotation) Key() string

Key see boltutil.Record interface.

func (*Annotation) Subtract

func (r *Annotation) Subtract(deltaRec *Annotation) bool

Subtract removes the digests, traces, ignores and tests in delta from the current annotation.

type IssueStore

type IssueStore interface {
	// ByDigest returns the ids of all issue associated with the given digest.
	ByDigest(digest string) ([]string, error) // list of issues

	// ByDigest returns the ids of all issue associated with the given digest.
	ByIgnore(ignoreID string) ([]string, error) // list of issues

	// ByDigest returns the ids of all issue associated with the given digest.
	ByTrace(traceID string) ([]string, error) // list of issues

	// ByDigest returns the ids of all issue associated with the given digest.
	ByTest(testName string) ([]string, error) // list of issues

	// Add allows to create an issue annotation or add to an existing annotation.
	// If the issue identified by delta.IssueID exists, delta will be merged into
	// the existing annotation.
	Add(delta *Annotation) error

	// Subtract removes from an existing issue annotation. The values in
	// delta are subtracted from an existing annotation.
	Subtract(delta *Annotation) error

	// Get returns the annotations for the given list of issue ids.
	Get(issueIDs []string) ([]*Annotation, error)

	// List returns a list of all issues that are currently annotated with
	// support of paging. The first 'offset' annotations will be skipped and
	// the returned array has at most 'size'. If 'size' <= 0 there is no limit
	// on the number of annotations returned.
	List(offset int, size int) ([]*Annotation, int, error)

	// Delete the given issue annotations.
	Delete(issueIDs []string) error
}

IssueStore captures the functions necessary to persist the connection between Monorail issues and digests, traces, tests and ignores.

func New

func New(baseDir string) (IssueStore, error)

New returns a new instance of IssueStore that is stored in the given directory.

Jump to

Keyboard shortcuts

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