Documentation
¶
Overview ¶
Package bugreport owns the instance-wide, private defect report store.
Index ¶
- Constants
- Variables
- func ActorName(ctx context.Context, id string) string
- func Redact(s string) string
- func Validate(in Input) error
- func WithActorName(ctx context.Context, resolve func(string) string) context.Context
- func WithStore(ctx context.Context, store *Store) context.Context
- type Actor
- type ChangeSession
- type ClientDiagnostics
- type Deletion
- type DiagnosticEvent
- type Filter
- type Input
- type ProjectPolicy
- type RateLimitError
- type Report
- type Reporter
- type StatusChange
- type Store
- func (s *Store) Close() error
- func (s *Store) Create(in Input, reporter Reporter, version string) (Report, error)
- func (s *Store) Delete(actor, id, expectedVersion string) (Deletion, error)
- func (s *Store) DeleteProject(project, generation string) error
- func (s *Store) DeletionFor(actor, id string) (Deletion, error)
- func (s *Store) Get(id string) (Report, error)
- func (s *Store) GetFor(actor, id, bucket string) (Report, error)
- func (s *Store) GetProject(actor, project, generation, id string) (Report, error)
- func (s *Store) IsUnavailable() bool
- func (s *Store) List(filter Filter, page int) ([]Report, int, error)
- func (s *Store) ListFor(actor string, filter Filter, page int) ([]Report, int, error)
- func (s *Store) ListProject(actor, project, generation, state, severity string, page int) ([]Report, int, error)
- func (s *Store) SetProjectFilter(exists func(string) bool)
- func (s *Store) SetProjectPolicy(policy ProjectPolicy)
- func (s *Store) SetResolution(id, state, note string, actor Actor, expectedVersion string) (Report, bool, error)
- func (s *Store) SetStatus(id, status, actorUserID string) error
- func (s *Store) SetStatusVersion(id, status, actor, expectedVersion string) (Report, bool, error)
Constants ¶
const MaxBytes = 32 * 1024
const MaxRecordBytes = 64 * 1024
const MaxReports = 2000
const PageSize = 50
const Retention = 180 * 24 * time.Hour
Variables ¶
var ErrConflict = errors.New("bug report version conflict")
var ErrDeleteIncomplete = errors.New("report deleted, but its deletion record was not saved as complete")
var ErrForbidden = errors.New("bug report access denied")
var ErrInvalid = errors.New("invalid bug report")
var ErrNotFound = errors.New("bug report not found")
var ErrRateLimited = errors.New("rate-limited")
Functions ¶
func WithActorName ¶
Types ¶
type Actor ¶
type Actor struct {
UserID string
Source string
Session *ChangeSession
Project, ProjectGenerationID string
}
Actor is server-owned authentication evidence, never caller input.
type ChangeSession ¶
type ClientDiagnostics ¶
type ClientDiagnostics = clientdiag.ClientDiagnostics
type Deletion ¶
type Deletion struct {
Version int `json:"v"`
ReportID string `json:"reportId"`
Phase string `json:"phase"`
DeletedAt time.Time `json:"deletedAt"`
Actor string `json:"actor"`
Source string `json:"source"`
ProjectGenerationID string `json:"projectGenerationId"`
ReceivedAt time.Time `json:"receivedAt"`
Severity string `json:"severity"`
State string `json:"state"`
}
type DiagnosticEvent ¶
type DiagnosticEvent = clientdiag.DiagnosticEvent
type Input ¶
type Input struct {
Title string `json:"title"`
Summary string `json:"summary"`
Steps string `json:"steps,omitempty"`
Expected string `json:"expected,omitempty"`
Actual string `json:"actual,omitempty"`
Severity string `json:"severity,omitempty"`
Tool string `json:"tool,omitempty"`
Client *ClientDiagnostics `json:"client,omitempty"`
}
type ProjectPolicy ¶
ProjectPolicy acquires the control read lock BEFORE the report lock, returning a stable current-generation snapshot and its release. Empty actor is only for internal current-only operations. A non-empty actor must be an active admin.
type RateLimitError ¶
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
func (*RateLimitError) Unwrap ¶
func (e *RateLimitError) Unwrap() error
type Report ¶
type Report struct {
Input
ID string `json:"id"`
Reporter Reporter `json:"reporter"`
ReceivedAt time.Time `json:"receivedAt"`
ServerVersion string `json:"serverVersion"`
Status string `json:"status"`
Resolution string `json:"resolution,omitempty"`
Note string `json:"note,omitempty"`
StatusChanges []StatusChange `json:"statusChanges,omitempty"`
HistoryTruncated bool `json:"historyTruncated,omitempty"`
ExpectedVersion string `json:"-"`
StatusChangedAt time.Time `json:"statusChangedAt,omitempty"`
StatusChangedBy string `json:"statusChangedBy,omitempty"`
}
type StatusChange ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func FromContext ¶
func Unavailable ¶
func Unavailable() *Store
Unavailable keeps the fixed API error without opening or mutating the corrupt database. A fresh Open on a later process start is the only recovery attempt.
func (*Store) Delete ¶
Delete holds the admin policy lease and report mutation lock through both journals. A requested record never proves that an administrator actually deleted a report.
func (*Store) DeleteProject ¶
func (*Store) GetProject ¶
Project reads hold the same admin/current-generation policy lease as writes.
func (*Store) IsUnavailable ¶
func (*Store) ListProject ¶
func (*Store) SetProjectFilter ¶
SetProjectFilter is an additional display-name filter for standalone stores. Managed runtimes use SetProjectPolicy instead. This callback must not acquire control-store locks or call back into the report store.
func (*Store) SetProjectPolicy ¶
func (s *Store) SetProjectPolicy(policy ProjectPolicy)
SetProjectPolicy is configured before serving. It may not call this store.
func (*Store) SetResolution ¶
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clientdiag defines the wire diagnostics shared by clients and the server.
|
Package clientdiag defines the wire diagnostics shared by clients and the server. |