Documentation
¶
Overview ¶
Package bug contains the bug data model and low-level related functions
Index ¶
- Constants
- Variables
- func ChangeLabels(b Interface, author identity.Interface, c *config.ConfigCache, unixTime int64, ...) ([]LabelChangeResult, *LabelChangeOperation, error)
- func ClearAllCcbApprovals(bug Interface, snapshot *Snapshot, next Status, author identity.Interface, ...) error
- func Create(author identity.Interface, unixTime int64, title, message string) (*Bug, *CreateOperation, error)
- func CreateWithFiles(author identity.Interface, unixTime int64, title, message string, ...) (*Bug, *CreateOperation, error)
- func FetchReviewInfo(id string, since review.PullRequest) (review.PullRequest, error)
- func ListLocalIds(repo repository.Repo) ([]entity.Id, error)
- func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeResult
- func NewErrMultipleMatchBug(matching []entity.Id) *entity.ErrMultipleMatch
- func NewErrMultipleMatchOp(matching []entity.Id) *entity.ErrMultipleMatch
- func PeekLocalBugEditTime(repo repository.ClockedRepo, id entity.Id) (time.Time, error)
- func ReadAllLocalBugs(repo repository.ClockedRepo) <-chan StreamedBug
- func ReadAllRemoteBugs(repo repository.ClockedRepo, remote string) <-chan StreamedBug
- func RemoveBug(repo repository.ClockedRepo, id entity.Id) error
- func ResetBug(repo repository.ClockedRepo, id entity.Id) error
- func StateFromString(str string) (config.ChecklistState, error)
- func ValidateAllCcb(snap *Snapshot, next Status) error
- func ValidateAssigneeSet(snap *Snapshot, next Status) error
- func ValidateCcb(snap *Snapshot, next Status) error
- func ValidateChecklistsCompleted(snap *Snapshot, next Status) error
- type ActionFunc
- type AddCommentOperation
- func AddComment(b Interface, author identity.Interface, unixTime int64, message string) (*AddCommentOperation, error)
- func AddCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, ...) (*AddCommentOperation, error)
- func NewAddCommentOp(author identity.Interface, unixTime int64, message string, ...) *AddCommentOperation
- func (op *AddCommentOperation) Apply(snapshot *Snapshot)
- func (op *AddCommentOperation) GetFiles() []repository.Hash
- func (op *AddCommentOperation) Id() entity.Id
- func (op *AddCommentOperation) IsAuthored()
- func (op *AddCommentOperation) IsOperation()
- func (op *AddCommentOperation) UnmarshalJSON(data []byte) error
- func (op *AddCommentOperation) Validate() error
- type AddCommentTimelineItem
- type Bug
- func (bug *Bug) Append(op Operation)
- func (bug *Bug) Commit(repo repository.ClockedRepo) error
- func (bug *Bug) CommitAsNeeded(repo repository.ClockedRepo) error
- func (bug *Bug) Compile() Snapshot
- func (bug *Bug) CreateLamportTime() lamport.Time
- func (bug *Bug) EditLamportTime() lamport.Time
- func (bug *Bug) EnsureIdentities(resolver identity.Resolver) error
- func (bug *Bug) FirstOp() Operation
- func (bug *Bug) Id() entity.Id
- func (bug *Bug) LastOp() Operation
- func (bug *Bug) Merge(repo repository.Repo, other Interface) (bool, error)
- func (bug *Bug) NeedCommit() bool
- func (bug *Bug) Validate() error
- type BugsByCreationTime
- type BugsByEditTime
- type CcbInfo
- type CcbInfoByStatus
- type CcbState
- type ChecklistSnapshot
- type Comment
- type CommentTimelineItem
- type CreateOperation
- func (op *CreateOperation) Apply(snapshot *Snapshot)
- func (op *CreateOperation) GetFiles() []repository.Hash
- func (op *CreateOperation) Id() entity.Id
- func (op *CreateOperation) IsAuthored()
- func (op *CreateOperation) IsOperation()
- func (op *CreateOperation) UnmarshalJSON(data []byte) error
- func (op *CreateOperation) Validate() error
- type CreateTimelineItem
- type EditCommentOperation
- func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, ...) (*EditCommentOperation, error)
- func EditCommentWithFiles(b Interface, author identity.Interface, unixTime int64, target entity.Id, ...) (*EditCommentOperation, error)
- func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error)
- func EditCreateCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, ...) (*EditCommentOperation, error)
- func NewEditCommentOp(author identity.Interface, unixTime int64, target entity.Id, message string, ...) *EditCommentOperation
- func (op *EditCommentOperation) Apply(snapshot *Snapshot)
- func (op *EditCommentOperation) GetFiles() []repository.Hash
- func (op *EditCommentOperation) Id() entity.Id
- func (op *EditCommentOperation) IsAuthored()
- func (op *EditCommentOperation) IsOperation()
- func (op *EditCommentOperation) UnmarshalJSON(data []byte) error
- func (op *EditCommentOperation) Validate() error
- type EditCommentTimelineItem
- type Interface
- type InvalidTransitionError
- type Label
- func (l Label) Color() LabelColor
- func (l Label) IsChecklist() bool
- func (l Label) IsImpact() bool
- func (l Label) IsMilestone() bool
- func (l Label) IsRepo() bool
- func (l Label) IsScope() bool
- func (l Label) IsWorkflow() bool
- func (l Label) String() string
- func (l Label) Validate() error
- func (l Label) WorkflowName() string
- type LabelChangeOperation
- func (op *LabelChangeOperation) Apply(snapshot *Snapshot)
- func (op *LabelChangeOperation) Id() entity.Id
- func (op *LabelChangeOperation) IsAuthored()
- func (op *LabelChangeOperation) IsOperation()
- func (op *LabelChangeOperation) UnmarshalJSON(data []byte) error
- func (op *LabelChangeOperation) Validate() error
- type LabelChangeResult
- type LabelChangeStatus
- type LabelChangeTimelineItem
- type LabelColor
- type NoOpOperation
- type OpBase
- func (op *OpBase) AllMetadata() map[string]string
- func (op *OpBase) GetAuthor() identity.Interface
- func (op *OpBase) GetFiles() []repository.Hash
- func (op *OpBase) GetMetadata(key string) (string, bool)
- func (op *OpBase) SetMetadata(key string, value string)
- func (op *OpBase) Time() time.Time
- func (op *OpBase) UnmarshalJSON(data []byte) error
- type Operation
- type OperationIterator
- type OperationPack
- func (opp *OperationPack) Append(op Operation)
- func (opp *OperationPack) Clone() OperationPack
- func (opp *OperationPack) IncludesStatusChange() bool
- func (opp *OperationPack) IsEmpty() bool
- func (opp *OperationPack) MarshalJSON() ([]byte, error)
- func (opp *OperationPack) UnmarshalJSON(data []byte) error
- func (opp *OperationPack) Validate() error
- func (opp *OperationPack) Write(repo repository.ClockedRepo) (repository.Hash, error)
- type OperationType
- type SetAssigneeOperation
- func (op *SetAssigneeOperation) Apply(snapshot *Snapshot)
- func (op *SetAssigneeOperation) Id() entity.Id
- func (op *SetAssigneeOperation) IsAuthored()
- func (op *SetAssigneeOperation) IsOperation()
- func (op *SetAssigneeOperation) UnmarshalJSON(data []byte) error
- func (op *SetAssigneeOperation) Validate() error
- type SetAssigneeTimelineItem
- type SetCcbOperation
- func ClearCcbApprovals(b Interface, author identity.Interface, unixTime int64, ...) (*SetCcbOperation, error)
- func NewSetCcbOp(author identity.Interface, unixTime int64, user identity.Interface, ...) *SetCcbOperation
- func SetCcb(b Interface, author identity.Interface, unixTime int64, ...) (*SetCcbOperation, error)
- type SetCcbTimelineItem
- type SetChecklistOperation
- func (op *SetChecklistOperation) Apply(snapshot *Snapshot)
- func (op *SetChecklistOperation) Id() entity.Id
- func (op *SetChecklistOperation) IsAuthored()
- func (op *SetChecklistOperation) IsOperation()
- func (op *SetChecklistOperation) UnmarshalJSON(data []byte) error
- func (op *SetChecklistOperation) Validate() error
- type SetChecklistTimelineItem
- type SetMetadataOperation
- func (op *SetMetadataOperation) Apply(snapshot *Snapshot)
- func (op *SetMetadataOperation) Id() entity.Id
- func (op *SetMetadataOperation) IsAuthored()
- func (op *SetMetadataOperation) IsOperation()
- func (op *SetMetadataOperation) UnmarshalJSON(data []byte) error
- func (op *SetMetadataOperation) Validate() error
- type SetReviewOperation
- func (op *SetReviewOperation) Apply(snapshot *Snapshot)
- func (op *SetReviewOperation) Id() entity.Id
- func (op *SetReviewOperation) IsAuthored()
- func (op *SetReviewOperation) IsOperation()
- func (op *SetReviewOperation) MarshalJSON() ([]byte, error)
- func (op *SetReviewOperation) UnmarshalJSON(data []byte) error
- func (op *SetReviewOperation) Validate() error
- type SetReviewTimelineItem
- type SetStatusOperation
- func Close(b Interface, author identity.Interface, unixTime int64) (*SetStatusOperation, error)
- func NewSetStatusOp(author identity.Interface, unixTime int64, status Status) *SetStatusOperation
- func Open(b Interface, author identity.Interface, unixTime int64) (*SetStatusOperation, error)
- func SetStatus(b Interface, author identity.Interface, unixTime int64, status Status) (*SetStatusOperation, error)
- type SetStatusTimelineItem
- type SetTitleOperation
- type SetTitleTimelineItem
- type Snapshot
- func (snap *Snapshot) EditTime() time.Time
- func (snap *Snapshot) GetCcbState(id entity.Id, status Status) CcbState
- func (snap *Snapshot) GetChecklistCompoundStates() map[Label]config.ChecklistState
- func (snap *Snapshot) GetComment(index int) (*Comment, error)
- func (snap *Snapshot) GetCreateMetadata(key string) (string, bool)
- func (snap *Snapshot) GetUserChecklists(c config.ChecklistConfig, reviewer entity.Id, blank bool) (map[Label]config.Checklist, error)
- func (snap *Snapshot) HasActor(id entity.Id) bool
- func (snap *Snapshot) HasAnyActor(ids ...entity.Id) bool
- func (snap *Snapshot) HasAnyParticipant(ids ...entity.Id) bool
- func (snap *Snapshot) HasParticipant(id entity.Id) bool
- func (snap *Snapshot) Id() entity.Id
- func (snap *Snapshot) IsAuthored()
- func (snap *Snapshot) NextStatuses() ([]Status, error)
- func (snap *Snapshot) SearchComment(id entity.Id) (*Comment, error)
- func (snap *Snapshot) ValidateTransitionAndApplyActions(b Interface, newStatus Status, author identity.Interface, unixTime int64) InvalidTransitionError
- type Status
- type StreamedBug
- type Term256
- type TimelineItem
- type Transition
- type ValidationFunc
- type WithSnapshot
- type Workflow
Examples ¶
Constants ¶
const ChecklistPrefix string = "checklist:"
const FirstStatus = ProposedStatus
const ImpactPrefix string = "impact:"
const LastStatus = RejectedStatus
const MilestonePrefix string = "milestone:"
const Namespace = "bugs"
const NumStatuses = LastStatus - FirstStatus + 1
const RepoPrefix string = "repo:"
const ScopePrefix string = "scope:"
const WorkflowPrefix string = "workflow:"
Variables ¶
var ClockLoader = repository.ClockLoader{ Clocks: []string{creationClockName, editClockName}, Witnesser: func(repo repository.ClockedRepo) error { for b := range ReadAllLocalBugs(repo) { if b.Err != nil { return b.Err } createClock, err := repo.GetOrCreateClock(creationClockName) if err != nil { return err } err = createClock.Witness(b.Bug.createTime) if err != nil { return err } editClock, err := repo.GetOrCreateClock(editClockName) if err != nil { return err } err = editClock.Witness(b.Bug.editTime) if err != nil { return err } } return nil }, }
ClockLoader is the repository.ClockLoader for the Bug entity
var ErrBugNotExist = errors.New("bug doesn't exist")
Functions ¶
func ChangeLabels ¶
func ChangeLabels(b Interface, author identity.Interface, c *config.ConfigCache, unixTime int64, add, remove []string, allowDeprecated bool) ([]LabelChangeResult, *LabelChangeOperation, error)
ChangeLabels is a convenience function to apply the operation
func ClearAllCcbApprovals ¶
func ClearAllCcbApprovals(bug Interface, snapshot *Snapshot, next Status, author identity.Interface, unixTime int64) error
Clears all CCB approvals, keeping the users that need to approve the ticket statuses, but removing their approval
func Create ¶
func Create(author identity.Interface, unixTime int64, title, message string) (*Bug, *CreateOperation, error)
Convenience function to apply the operation
func CreateWithFiles ¶
func CreateWithFiles(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) (*Bug, *CreateOperation, error)
func FetchReviewInfo ¶
func FetchReviewInfo(id string, since review.PullRequest) (review.PullRequest, error)
FetchReviewInfo exports review comments and status info from Phabricator or Gitea for the given differential ID and returns in a PullRequest struct. If a since review is specified then only updates since then are returned (only for Phabricator).
func ListLocalIds ¶
func ListLocalIds(repo repository.Repo) ([]entity.Id, error)
ListLocalIds list all the available local bug ids
func MergeAll ¶
func MergeAll(repo repository.ClockedRepo, remote string) <-chan entity.MergeResult
MergeAll will merge all the available remote bug:
- If the remote has new commit, the local bug is updated to match the same history (fast-forward update)
- if the local bug has new commits but the remote don't, nothing is changed
- if both local and remote bug have new commits (that is, we have a concurrent edition), new local commits are rewritten at the head of the remote history (that is, a rebase)
func NewErrMultipleMatchBug ¶
func NewErrMultipleMatchBug(matching []entity.Id) *entity.ErrMultipleMatch
func NewErrMultipleMatchOp ¶
func NewErrMultipleMatchOp(matching []entity.Id) *entity.ErrMultipleMatch
func PeekLocalBugEditTime ¶
func PeekLocalBugEditTime(repo repository.ClockedRepo, id entity.Id) (time.Time, error)
PeekLocalBugEditTime will read the latest edit time of a bug without loading it
func ReadAllLocalBugs ¶
func ReadAllLocalBugs(repo repository.ClockedRepo) <-chan StreamedBug
ReadAllLocalBugs read and parse all local bugs
func ReadAllRemoteBugs ¶
func ReadAllRemoteBugs(repo repository.ClockedRepo, remote string) <-chan StreamedBug
ReadAllRemoteBugs read and parse all remote bugs for a given remote
func RemoveBug ¶
func RemoveBug(repo repository.ClockedRepo, id entity.Id) error
RemoveBug will remove a local bug from its entity.Id
func ResetBug ¶
func ResetBug(repo repository.ClockedRepo, id entity.Id) error
ResetBug will reset a local bug from its entity.Id
func StateFromString ¶
func StateFromString(str string) (config.ChecklistState, error)
func ValidateAllCcb ¶
ValidateAllCcb returns an error if the snapshot does not have CCB set and approved for all CCB status (Except rejected)
func ValidateAssigneeSet ¶
ValidateAssigneeSet returns an error if the snapshot assignee is not set
func ValidateCcb ¶
ValidateCcb returns an error if the snapshot does not have CCB set and approved for the next status
func ValidateChecklistsCompleted ¶
ValidateChecklistsCompleted returns an error if at least one of the checklists attached to the snapshot has not been completed
Types ¶
type ActionFunc ¶
type ActionFunc func(b Interface, snapshot *Snapshot, next Status, author identity.Interface, unixTime int64) error
Invoked to update a ticket as a consequence of a workflow status transition.
type AddCommentOperation ¶
type AddCommentOperation struct { OpBase Message string `json:"message"` // TODO: change for a map[string]util.hash to store the filename ? Files []repository.Hash `json:"files"` }
AddCommentOperation will add a new comment in the bug
func AddComment ¶
func AddComment(b Interface, author identity.Interface, unixTime int64, message string) (*AddCommentOperation, error)
Convenience function to apply the operation
func AddCommentWithFiles ¶
func AddCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash) (*AddCommentOperation, error)
func NewAddCommentOp ¶
func NewAddCommentOp(author identity.Interface, unixTime int64, message string, files []repository.Hash) *AddCommentOperation
func (*AddCommentOperation) Apply ¶
func (op *AddCommentOperation) Apply(snapshot *Snapshot)
func (*AddCommentOperation) GetFiles ¶
func (op *AddCommentOperation) GetFiles() []repository.Hash
func (*AddCommentOperation) Id ¶
func (op *AddCommentOperation) Id() entity.Id
func (*AddCommentOperation) IsAuthored ¶
func (op *AddCommentOperation) IsAuthored()
Sign post method for gqlgen
func (*AddCommentOperation) IsOperation ¶
func (op *AddCommentOperation) IsOperation()
Sign-post method for gqlgen
func (*AddCommentOperation) UnmarshalJSON ¶
func (op *AddCommentOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshalling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*AddCommentOperation) Validate ¶
func (op *AddCommentOperation) Validate() error
type AddCommentTimelineItem ¶
type AddCommentTimelineItem struct {
CommentTimelineItem
}
CreateTimelineItem replace a AddComment operation in the Timeline and hold its edition history
func (*AddCommentTimelineItem) IsAuthored ¶
func (a *AddCommentTimelineItem) IsAuthored()
Sign post method for gqlgen
func (AddCommentTimelineItem) String ¶
func (a AddCommentTimelineItem) String() string
type Bug ¶
type Bug struct {
// contains filtered or unexported fields
}
Bug hold the data of a bug thread, organized in a way close to how it will be persisted inside Git. This is the data structure used to merge two different version of the same Bug.
func FindLocalBug ¶
func FindLocalBug(repo repository.ClockedRepo, prefix string) (*Bug, error)
FindLocalBug find an existing Bug matching a prefix
func ReadLocalBug ¶
func ReadLocalBug(repo repository.ClockedRepo, id entity.Id) (*Bug, error)
ReadLocalBug will read a local bug from its hash
func ReadRemoteBug ¶
func ReadRemoteBug(repo repository.ClockedRepo, remote string, id entity.Id) (*Bug, error)
ReadRemoteBug will read a remote bug from its hash
func (*Bug) Commit ¶
func (bug *Bug) Commit(repo repository.ClockedRepo) error
Commit write the staging area in Git and move the operations to the packs
func (*Bug) CommitAsNeeded ¶
func (bug *Bug) CommitAsNeeded(repo repository.ClockedRepo) error
func (*Bug) CreateLamportTime ¶
CreateLamportTime return the Lamport time of creation
func (*Bug) EditLamportTime ¶
EditLamportTime return the Lamport time of the last edit
func (*Bug) EnsureIdentities ¶
EnsureIdentities walk the graph of operations and make sure that all Identity are properly loaded. That is, it replace all the IdentityStub with the full Identity, loaded through a Resolver.
func (*Bug) FirstOp ¶
Lookup for the very first operation of the bug. For a valid Bug, this operation should be a CreateOp
func (*Bug) LastOp ¶
Lookup for the very last operation of the bug. For a valid Bug, should never be nil
func (*Bug) Merge ¶
Merge a different version of the same bug by rebasing operations of this bug that are not present in the other on top of the chain of operations of the other version.
func (*Bug) NeedCommit ¶
type BugsByCreationTime ¶
type BugsByCreationTime []*Bug
func (BugsByCreationTime) Len ¶
func (b BugsByCreationTime) Len() int
func (BugsByCreationTime) Less ¶
func (b BugsByCreationTime) Less(i, j int) bool
func (BugsByCreationTime) Swap ¶
func (b BugsByCreationTime) Swap(i, j int)
type BugsByEditTime ¶
type BugsByEditTime []*Bug
func (BugsByEditTime) Len ¶
func (b BugsByEditTime) Len() int
func (BugsByEditTime) Less ¶
func (b BugsByEditTime) Less(i, j int) bool
func (BugsByEditTime) Swap ¶
func (b BugsByEditTime) Swap(i, j int)
type CcbInfo ¶
type CcbInfo struct { User identity.Interface // The approver Status Status // The ticket status (e.g. vetted) that the approver is associated with State CcbState // The state of the approval }
CcbInfo is stored in a ticket history every time an approver is added or removed, or has approved or blocked the ticket
type CcbInfoByStatus ¶
type CcbInfoByStatus []CcbInfo
CcbInfoByStatus provides functions to fulfill the sort interface
func (CcbInfoByStatus) Len ¶
func (a CcbInfoByStatus) Len() int
func (CcbInfoByStatus) Less ¶
func (a CcbInfoByStatus) Less(i, j int) bool
func (CcbInfoByStatus) Swap ¶
func (a CcbInfoByStatus) Swap(i, j int)
type CcbState ¶
type CcbState int
CcbState represents the state of an approver with respect to a ticket status
const ( AddedCcbState CcbState // added to the ticket, but not set a state ApprovedCcbState // approved the ticket BlockedCcbState // blocked the ticket RemovedCcbState // removed from the ticket )
func (CcbState) ColorString ¶
Colored strings function for CcbState
type Comment ¶
type Comment struct { Author identity.Interface Message string Files []repository.Hash Edited bool // Creation time of the comment. // Should be used only for human display, never for ordering as we can't rely on it in a distributed system. UnixTime timestamp.Timestamp // contains filtered or unexported fields }
Comment represent a comment in a Bug
func (Comment) FormatTime ¶
func (Comment) FormatTimeRel ¶
FormatTimeRel format the UnixTime of the comment for human consumption
type CommentTimelineItem ¶
type CommentTimelineItem struct { Index int Author identity.Interface Message string Files []repository.Hash CreatedAt timestamp.Timestamp // contains filtered or unexported fields }
CommentTimelineItem is a TimelineItem that holds a Comment and its edition history
func NewCommentTimelineItem ¶
func NewCommentTimelineItem(ID entity.Id, index int, comment Comment) CommentTimelineItem
func (*CommentTimelineItem) Id ¶
func (c *CommentTimelineItem) Id() entity.Id
func (CommentTimelineItem) String ¶
func (c CommentTimelineItem) String() string
func (CommentTimelineItem) When ¶
func (c CommentTimelineItem) When() timestamp.Timestamp
type CreateOperation ¶
type CreateOperation struct { OpBase Title string `json:"title"` Message string `json:"message"` Files []repository.Hash `json:"files"` }
CreateOperation define the initial creation of a bug
func NewCreateOp ¶
func NewCreateOp(author identity.Interface, unixTime int64, title, message string, files []repository.Hash) *CreateOperation
func (*CreateOperation) Apply ¶
func (op *CreateOperation) Apply(snapshot *Snapshot)
func (*CreateOperation) GetFiles ¶
func (op *CreateOperation) GetFiles() []repository.Hash
func (*CreateOperation) Id ¶
func (op *CreateOperation) Id() entity.Id
func (*CreateOperation) IsAuthored ¶
func (op *CreateOperation) IsAuthored()
Sign post method for gqlgen
func (*CreateOperation) IsOperation ¶
func (op *CreateOperation) IsOperation()
Sign-post method for gqlgen
func (*CreateOperation) UnmarshalJSON ¶
func (op *CreateOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*CreateOperation) Validate ¶
func (op *CreateOperation) Validate() error
type CreateTimelineItem ¶
type CreateTimelineItem struct {
CommentTimelineItem
}
CreateTimelineItem replace a Create operation in the Timeline and hold its edition history
func (*CreateTimelineItem) IsAuthored ¶
func (c *CreateTimelineItem) IsAuthored()
Sign post method for gqlgen
func (CreateTimelineItem) String ¶
func (c CreateTimelineItem) String() string
type EditCommentOperation ¶
type EditCommentOperation struct { OpBase Target entity.Id `json:"target"` Message string `json:"message"` Files []repository.Hash `json:"files"` }
EditCommentOperation will change a comment in the bug
func EditComment ¶
func EditComment(b Interface, author identity.Interface, unixTime int64, target entity.Id, message string) (*EditCommentOperation, error)
Convenience function to apply the operation
func EditCommentWithFiles ¶
func EditCreateComment ¶
func EditCreateComment(b Interface, author identity.Interface, unixTime int64, message string) (*EditCommentOperation, error)
Convenience function to edit the body of a bug (the first comment)
func EditCreateCommentWithFiles ¶
func EditCreateCommentWithFiles(b Interface, author identity.Interface, unixTime int64, message string, files []repository.Hash) (*EditCommentOperation, error)
Convenience function to edit the body of a bug (the first comment)
func NewEditCommentOp ¶
func NewEditCommentOp(author identity.Interface, unixTime int64, target entity.Id, message string, files []repository.Hash) *EditCommentOperation
func (*EditCommentOperation) Apply ¶
func (op *EditCommentOperation) Apply(snapshot *Snapshot)
func (*EditCommentOperation) GetFiles ¶
func (op *EditCommentOperation) GetFiles() []repository.Hash
func (*EditCommentOperation) Id ¶
func (op *EditCommentOperation) Id() entity.Id
func (*EditCommentOperation) IsAuthored ¶
func (op *EditCommentOperation) IsAuthored()
Sign post method for gqlgen
func (*EditCommentOperation) IsOperation ¶
func (op *EditCommentOperation) IsOperation()
Sign-post method for gqlgen
func (*EditCommentOperation) UnmarshalJSON ¶
func (op *EditCommentOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*EditCommentOperation) Validate ¶
func (op *EditCommentOperation) Validate() error
type EditCommentTimelineItem ¶
type EditCommentTimelineItem struct {
CommentTimelineItem
}
CreateTimelineItem replace a AddComment operation in the Timeline and hold its edition history
func (*EditCommentTimelineItem) IsAuthored ¶
func (a *EditCommentTimelineItem) IsAuthored()
Sign post method for gqlgen
func (EditCommentTimelineItem) String ¶
func (a EditCommentTimelineItem) String() string
type Interface ¶
type Interface interface { // Id return the Bug identifier Id() entity.Id // Validate check if the Bug data is valid Validate() error // Append an operation into the staging area, to be committed later Append(op Operation) // Indicate that the in-memory state changed and need to be commit in the repository NeedCommit() bool // Commit write the staging area in Git and move the operations to the packs Commit(repo repository.ClockedRepo) error // Merge a different version of the same bug by rebasing operations of this bug // that are not present in the other on top of the chain of operations of the // other version. Merge(repo repository.Repo, other Interface) (bool, error) // Lookup for the very first operation of the bug. // For a valid Bug, this operation should be a CreateOp FirstOp() Operation // Lookup for the very last operation of the bug. // For a valid Bug, should never be nil LastOp() Operation // Compile a bug in a easily usable snapshot Compile() Snapshot // CreateLamportTime return the Lamport time of creation CreateLamportTime() lamport.Time // EditLamportTime return the Lamport time of the last edit EditLamportTime() lamport.Time }
type InvalidTransitionError ¶
type InvalidTransitionError error
type Label ¶
type Label string
func GetWorkflowLabels ¶
func GetWorkflowLabels() []Label
GetWorkflowLabels returns a slice of all the available workflow labels
func (Label) Color ¶
func (l Label) Color() LabelColor
RGBA from a Label computed in a deterministic way
func (Label) IsChecklist ¶
func (Label) IsMilestone ¶
func (Label) IsWorkflow ¶
func (Label) WorkflowName ¶
type LabelChangeOperation ¶
type LabelChangeOperation struct { OpBase Added []Label `json:"added"` Removed []Label `json:"removed"` }
LabelChangeOperation define a Bug operation to add or remove labels
func ForceChangeLabels ¶
func ForceChangeLabels(b Interface, author identity.Interface, unixTime int64, add, remove []string) (*LabelChangeOperation, error)
ForceChangeLabels is a convenience function to apply the operation The difference with ChangeLabels is that no checks of deduplications are done. You are entirely responsible of what you are doing. In the general case, you want to use ChangeLabels instead. The intended use of this function is to allow importers to create legal but unexpected label changes, like removing a label with no information of when it was added before.
func NewLabelChangeOperation ¶
func NewLabelChangeOperation(author identity.Interface, unixTime int64, added, removed []Label) *LabelChangeOperation
func (*LabelChangeOperation) Apply ¶
func (op *LabelChangeOperation) Apply(snapshot *Snapshot)
Apply apply the operation
func (*LabelChangeOperation) Id ¶
func (op *LabelChangeOperation) Id() entity.Id
func (*LabelChangeOperation) IsAuthored ¶
func (op *LabelChangeOperation) IsAuthored()
Sign post method for gqlgen
func (*LabelChangeOperation) IsOperation ¶
func (op *LabelChangeOperation) IsOperation()
Sign-post method for gqlgen
func (*LabelChangeOperation) UnmarshalJSON ¶
func (op *LabelChangeOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*LabelChangeOperation) Validate ¶
func (op *LabelChangeOperation) Validate() error
type LabelChangeResult ¶
type LabelChangeResult struct { Label Label Status LabelChangeStatus AdditionalInfo string }
func (LabelChangeResult) String ¶
func (l LabelChangeResult) String() string
type LabelChangeStatus ¶
type LabelChangeStatus int
const ( LabelChangeAdded LabelChangeStatus LabelChangeRemoved LabelChangeDuplicateInOp LabelChangeAlreadySet LabelChangeDoesntExist LabelChangeInvalidWorkflow LabelChangeInvalidChecklist LabelChangeUnknownLabel LabelChangeDeprecatedLabel )
type LabelChangeTimelineItem ¶
type LabelChangeTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Added []Label Removed []Label // contains filtered or unexported fields }
func (LabelChangeTimelineItem) Id ¶
func (l LabelChangeTimelineItem) Id() entity.Id
func (*LabelChangeTimelineItem) IsAuthored ¶
func (l *LabelChangeTimelineItem) IsAuthored()
Sign post method for gqlgen
func (LabelChangeTimelineItem) String ¶
func (l LabelChangeTimelineItem) String() string
func (LabelChangeTimelineItem) When ¶
func (l LabelChangeTimelineItem) When() timestamp.Timestamp
type LabelColor ¶
func (LabelColor) RGBA ¶
func (lc LabelColor) RGBA() color.RGBA
func (LabelColor) Term256 ¶
func (lc LabelColor) Term256() Term256
type NoOpOperation ¶
type NoOpOperation struct {
OpBase
}
NoOpOperation is an operation that does not change the bug state. It can however be used to store arbitrary metadata in the bug history, for example to support a bridge feature.
func NoOp ¶
func NoOp(b Interface, author identity.Interface, unixTime int64, metadata map[string]string) (*NoOpOperation, error)
Convenience function to apply the operation
func (*NoOpOperation) Apply ¶
func (op *NoOpOperation) Apply(snapshot *Snapshot)
func (*NoOpOperation) Id ¶
func (op *NoOpOperation) Id() entity.Id
func (*NoOpOperation) IsAuthored ¶
func (op *NoOpOperation) IsAuthored()
Sign post method for gqlgen
func (*NoOpOperation) IsOperation ¶
func (op *NoOpOperation) IsOperation()
Sign-post method for gqlgen
func (*NoOpOperation) UnmarshalJSON ¶
func (op *NoOpOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*NoOpOperation) Validate ¶
func (op *NoOpOperation) Validate() error
type OpBase ¶
type OpBase struct { OperationType OperationType `json:"type"` Author identity.Interface `json:"author"` // TODO: part of the data model upgrade, this should eventually be a timestamp + lamport UnixTime int64 `json:"timestamp"` Metadata map[string]string `json:"metadata,omitempty"` // contains filtered or unexported fields }
OpBase implement the common code for all operations
func (*OpBase) AllMetadata ¶
AllMetadata return all metadata for this operation
func (*OpBase) GetFiles ¶
func (op *OpBase) GetFiles() []repository.Hash
GetFiles return the files needed by this operation
func (*OpBase) GetMetadata ¶
GetMetadata retrieve arbitrary metadata about the operation
func (*OpBase) SetMetadata ¶
SetMetadata store arbitrary metadata about the operation
func (*OpBase) UnmarshalJSON ¶
type Operation ¶
type Operation interface { // Id return the identifier of the operation, to be used for back references Id() entity.Id // Time return the time when the operation was added Time() time.Time // GetFiles return the files needed by this operation GetFiles() []repository.Hash // Apply the operation to a Snapshot to create the final state Apply(snapshot *Snapshot) // Validate check if the operation is valid (ex: a title is a single line) Validate() error // SetMetadata store arbitrary metadata about the operation SetMetadata(key string, value string) // GetMetadata retrieve arbitrary metadata about the operation GetMetadata(key string) (string, bool) // AllMetadata return all metadata for this operation AllMetadata() map[string]string // GetAuthor return the author identity GetAuthor() identity.Interface // sign-post method for gqlgen IsOperation() // contains filtered or unexported methods }
Operation define the interface to fulfill for an edit operation of a Bug
type OperationIterator ¶
type OperationIterator struct {
// contains filtered or unexported fields
}
Example ¶
b := NewBug() // add operations it := NewOperationIterator(b) for it.Next() { // do something with each operations _ = it.Value() }
Output:
func NewOperationIterator ¶
func NewOperationIterator(bug Interface) *OperationIterator
func (*OperationIterator) Next ¶
func (it *OperationIterator) Next() bool
func (*OperationIterator) Value ¶
func (it *OperationIterator) Value() Operation
type OperationPack ¶
type OperationPack struct { Operations []Operation // contains filtered or unexported fields }
OperationPack represent an ordered set of operation to apply to a Bug. These operations are stored in a single Git commit.
These commits will be linked together in a linear chain of commits inside Git to form the complete ordered chain of operation to apply to get the final state of the Bug
func (*OperationPack) Append ¶
func (opp *OperationPack) Append(op Operation)
Append a new operation to the pack
func (*OperationPack) IncludesStatusChange ¶
func (opp *OperationPack) IncludesStatusChange() bool
IncludesStatusChange returns true of one of the operations in the pack has the type SetStatusOp
func (*OperationPack) IsEmpty ¶
func (opp *OperationPack) IsEmpty() bool
IsEmpty tell if the OperationPack is empty
func (*OperationPack) MarshalJSON ¶
func (opp *OperationPack) MarshalJSON() ([]byte, error)
func (*OperationPack) UnmarshalJSON ¶
func (opp *OperationPack) UnmarshalJSON(data []byte) error
func (*OperationPack) Validate ¶
func (opp *OperationPack) Validate() error
IsValid tell if the OperationPack is considered valid
func (*OperationPack) Write ¶
func (opp *OperationPack) Write(repo repository.ClockedRepo) (repository.Hash, error)
Write will serialize and store the OperationPack as a git blob and return its hash
type OperationType ¶
type OperationType int
OperationType is an operation type identifier
const ( CreateOp OperationType SetTitleOp AddCommentOp SetStatusOp LabelChangeOp EditCommentOp NoOpOp SetMetadataOp SetChecklistOp SetAssigneeOp SetReviewOp SetCcbOp )
type SetAssigneeOperation ¶
SetAssigneeOperation will change the Assignee of a bug
func NewSetAssigneeOp ¶
func SetAssignee ¶
func SetAssignee(b Interface, author identity.Interface, unixTime int64, assignee identity.Interface) (*SetAssigneeOperation, error)
Convenience function to apply the operation
func (*SetAssigneeOperation) Apply ¶
func (op *SetAssigneeOperation) Apply(snapshot *Snapshot)
func (*SetAssigneeOperation) Id ¶
func (op *SetAssigneeOperation) Id() entity.Id
func (*SetAssigneeOperation) IsAuthored ¶
func (op *SetAssigneeOperation) IsAuthored()
Sign post method for gqlgen
func (*SetAssigneeOperation) IsOperation ¶
func (op *SetAssigneeOperation) IsOperation()
Sign-post method for gqlgen
func (*SetAssigneeOperation) UnmarshalJSON ¶
func (op *SetAssigneeOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetAssigneeOperation) Validate ¶
func (op *SetAssigneeOperation) Validate() error
type SetAssigneeTimelineItem ¶
type SetAssigneeTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Assignee identity.Interface // contains filtered or unexported fields }
func (SetAssigneeTimelineItem) Id ¶
func (s SetAssigneeTimelineItem) Id() entity.Id
func (*SetAssigneeTimelineItem) IsAuthored ¶
func (s *SetAssigneeTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetAssigneeTimelineItem) String ¶
func (s SetAssigneeTimelineItem) String() string
func (SetAssigneeTimelineItem) When ¶
func (s SetAssigneeTimelineItem) When() timestamp.Timestamp
type SetCcbOperation ¶
SetCcbOperation will change the CCB status of a bug
func ClearCcbApprovals ¶
func ClearCcbApprovals(b Interface, author identity.Interface, unixTime int64, user identity.Interface, status Status) (*SetCcbOperation, error)
Clear CCB approvals of the given user and status
func NewSetCcbOp ¶
func SetCcb ¶
func SetCcb(b Interface, author identity.Interface, unixTime int64, user identity.Interface, status Status, state CcbState) (*SetCcbOperation, error)
Convenience function to apply the operation
func (*SetCcbOperation) Apply ¶
func (op *SetCcbOperation) Apply(snapshot *Snapshot)
func (*SetCcbOperation) Id ¶
func (op *SetCcbOperation) Id() entity.Id
func (*SetCcbOperation) IsAuthored ¶
func (op *SetCcbOperation) IsAuthored()
Sign post method for gqlgen
func (*SetCcbOperation) IsOperation ¶
func (op *SetCcbOperation) IsOperation()
Sign-post method for gqlgen
func (*SetCcbOperation) UnmarshalJSON ¶
func (op *SetCcbOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetCcbOperation) Validate ¶
func (op *SetCcbOperation) Validate() error
type SetCcbTimelineItem ¶
type SetCcbTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Ccb CcbInfo // contains filtered or unexported fields }
func (SetCcbTimelineItem) Id ¶
func (s SetCcbTimelineItem) Id() entity.Id
func (*SetCcbTimelineItem) IsAuthored ¶
func (s *SetCcbTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetCcbTimelineItem) String ¶
func (s SetCcbTimelineItem) String() string
func (SetCcbTimelineItem) When ¶
func (s SetCcbTimelineItem) When() timestamp.Timestamp
type SetChecklistOperation ¶
SetChecklistOperation will update the checklist associated with a ticket
func NewSetChecklistOp ¶
func SetChecklist ¶
func SetChecklist(b Interface, author identity.Interface, unixTime int64, cl config.Checklist) (*SetChecklistOperation, error)
Convenience function to apply the operation
func (*SetChecklistOperation) Apply ¶
func (op *SetChecklistOperation) Apply(snapshot *Snapshot)
func (*SetChecklistOperation) Id ¶
func (op *SetChecklistOperation) Id() entity.Id
func (*SetChecklistOperation) IsAuthored ¶
func (op *SetChecklistOperation) IsAuthored()
Sign post method for gqlgen
func (*SetChecklistOperation) IsOperation ¶
func (op *SetChecklistOperation) IsOperation()
Sign-post method for gqlgen
func (*SetChecklistOperation) UnmarshalJSON ¶
func (op *SetChecklistOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetChecklistOperation) Validate ¶
func (op *SetChecklistOperation) Validate() error
type SetChecklistTimelineItem ¶
type SetChecklistTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Checklist config.Checklist // contains filtered or unexported fields }
func (SetChecklistTimelineItem) Id ¶
func (s SetChecklistTimelineItem) Id() entity.Id
func (*SetChecklistTimelineItem) IsAuthored ¶
func (s *SetChecklistTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetChecklistTimelineItem) String ¶
func (s SetChecklistTimelineItem) String() string
func (SetChecklistTimelineItem) When ¶
func (s SetChecklistTimelineItem) When() timestamp.Timestamp
type SetMetadataOperation ¶
type SetMetadataOperation struct { OpBase Target entity.Id `json:"target"` NewMetadata map[string]string `json:"new_metadata"` }
func NewSetMetadataOp ¶
func SetMetadata ¶
func SetMetadata(b Interface, author identity.Interface, unixTime int64, target entity.Id, newMetadata map[string]string) (*SetMetadataOperation, error)
Convenience function to apply the operation
func (*SetMetadataOperation) Apply ¶
func (op *SetMetadataOperation) Apply(snapshot *Snapshot)
func (*SetMetadataOperation) Id ¶
func (op *SetMetadataOperation) Id() entity.Id
func (*SetMetadataOperation) IsAuthored ¶
func (op *SetMetadataOperation) IsAuthored()
Sign post method for gqlgen
func (*SetMetadataOperation) IsOperation ¶
func (op *SetMetadataOperation) IsOperation()
Sign-post method for gqlgen
func (*SetMetadataOperation) UnmarshalJSON ¶
func (op *SetMetadataOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetMetadataOperation) Validate ¶
func (op *SetMetadataOperation) Validate() error
type SetReviewOperation ¶
type SetReviewOperation struct { OpBase Review review.PullRequest `json:"review"` }
SetReviewOperation will update the review associated with a ticket
func NewSetReviewOp ¶
func NewSetReviewOp(author identity.Interface, unixTime int64, review review.PullRequest) *SetReviewOperation
func SetReview ¶
func SetReview(b Interface, author identity.Interface, unixTime int64, review review.PullRequest) (*SetReviewOperation, error)
Convenience function to apply the operation
func (*SetReviewOperation) Apply ¶
func (op *SetReviewOperation) Apply(snapshot *Snapshot)
func (*SetReviewOperation) Id ¶
func (op *SetReviewOperation) Id() entity.Id
func (*SetReviewOperation) IsAuthored ¶
func (op *SetReviewOperation) IsAuthored()
Sign post method for gqlgen
func (*SetReviewOperation) IsOperation ¶
func (op *SetReviewOperation) IsOperation()
Sign-post method for gqlgen
func (*SetReviewOperation) MarshalJSON ¶
func (op *SetReviewOperation) MarshalJSON() ([]byte, error)
MarshalJSON serializes to json preserving type information
func (*SetReviewOperation) UnmarshalJSON ¶
func (op *SetReviewOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetReviewOperation) Validate ¶
func (op *SetReviewOperation) Validate() error
type SetReviewTimelineItem ¶
type SetReviewTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Review review.PullRequest Event review.TimelineEvent // contains filtered or unexported fields }
func (SetReviewTimelineItem) Id ¶
func (s SetReviewTimelineItem) Id() entity.Id
func (*SetReviewTimelineItem) IsAuthored ¶
func (s *SetReviewTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetReviewTimelineItem) String ¶
func (s SetReviewTimelineItem) String() string
func (SetReviewTimelineItem) When ¶
func (s SetReviewTimelineItem) When() timestamp.Timestamp
type SetStatusOperation ¶
SetStatusOperation will change the status of a bug
func NewSetStatusOp ¶
func NewSetStatusOp(author identity.Interface, unixTime int64, status Status) *SetStatusOperation
func SetStatus ¶
func SetStatus(b Interface, author identity.Interface, unixTime int64, status Status) (*SetStatusOperation, error)
Convenience function to apply the operation
func (*SetStatusOperation) Apply ¶
func (op *SetStatusOperation) Apply(snapshot *Snapshot)
func (*SetStatusOperation) Id ¶
func (op *SetStatusOperation) Id() entity.Id
func (*SetStatusOperation) IsAuthored ¶
func (op *SetStatusOperation) IsAuthored()
Sign post method for gqlgen
func (*SetStatusOperation) IsOperation ¶
func (op *SetStatusOperation) IsOperation()
Sign-post method for gqlgen
func (*SetStatusOperation) UnmarshalJSON ¶
func (op *SetStatusOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetStatusOperation) Validate ¶
func (op *SetStatusOperation) Validate() error
type SetStatusTimelineItem ¶
type SetStatusTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Status Status // contains filtered or unexported fields }
func (SetStatusTimelineItem) Id ¶
func (s SetStatusTimelineItem) Id() entity.Id
func (*SetStatusTimelineItem) IsAuthored ¶
func (s *SetStatusTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetStatusTimelineItem) String ¶
func (s SetStatusTimelineItem) String() string
func (SetStatusTimelineItem) When ¶
func (s SetStatusTimelineItem) When() timestamp.Timestamp
type SetTitleOperation ¶
SetTitleOperation will change the title of a bug
func NewSetTitleOp ¶
func SetTitle ¶
func SetTitle(b Interface, author identity.Interface, unixTime int64, title string) (*SetTitleOperation, error)
Convenience function to apply the operation
func (*SetTitleOperation) Apply ¶
func (op *SetTitleOperation) Apply(snapshot *Snapshot)
func (*SetTitleOperation) Id ¶
func (op *SetTitleOperation) Id() entity.Id
func (*SetTitleOperation) IsAuthored ¶
func (op *SetTitleOperation) IsAuthored()
Sign post method for gqlgen
func (*SetTitleOperation) IsOperation ¶
func (op *SetTitleOperation) IsOperation()
Sign-post method for gqlgen
func (*SetTitleOperation) UnmarshalJSON ¶
func (op *SetTitleOperation) UnmarshalJSON(data []byte) error
UnmarshalJSON is a two step JSON unmarshaling This workaround is necessary to avoid the inner OpBase.MarshalJSON overriding the outer op's MarshalJSON
func (*SetTitleOperation) Validate ¶
func (op *SetTitleOperation) Validate() error
type SetTitleTimelineItem ¶
type SetTitleTimelineItem struct { Author identity.Interface UnixTime timestamp.Timestamp Title string Was string // contains filtered or unexported fields }
func (SetTitleTimelineItem) Id ¶
func (s SetTitleTimelineItem) Id() entity.Id
func (*SetTitleTimelineItem) IsAuthored ¶
func (s *SetTitleTimelineItem) IsAuthored()
Sign post method for gqlgen
func (SetTitleTimelineItem) String ¶
func (s SetTitleTimelineItem) String() string
func (SetTitleTimelineItem) When ¶
func (s SetTitleTimelineItem) When() timestamp.Timestamp
type Snapshot ¶
type Snapshot struct { Status Status Title string Comments []Comment Labels []Label Checklists map[Label]map[entity.Id]ChecklistSnapshot // label and reviewer id Reviews map[string]review.PullRequest // Pull request ID Author identity.Interface Assignee identity.Interface Actors []identity.Interface Participants []identity.Interface Ccb []CcbInfo CreateTime time.Time Timeline []TimelineItem Operations []Operation // contains filtered or unexported fields }
Snapshot is a compiled form of the Bug data structure used for storage and merge
func (*Snapshot) GetCcbState ¶
GetCcbState returns the state assocated with the id in the ticket CCB group
func (*Snapshot) GetChecklistCompoundStates ¶
func (snap *Snapshot) GetChecklistCompoundStates() map[Label]config.ChecklistState
GetChecklistCompoundStates returns a map of checklist states mapped to label, associated with this snapshot
func (*Snapshot) GetComment ¶
GetComment will return the comment for a given index
func (*Snapshot) GetCreateMetadata ¶
GetCreateMetadata return the creation metadata
func (*Snapshot) GetUserChecklists ¶
func (snap *Snapshot) GetUserChecklists(c config.ChecklistConfig, reviewer entity.Id, blank bool) (map[Label]config.Checklist, error)
GetUserChecklists returns a map of checklists associated with this snapshot for the given reviewer id, if the blank flag is set then always return a clean set of checklists
func (*Snapshot) HasAnyActor ¶
HasAnyActor return true if one of the ids is a actor
func (*Snapshot) HasAnyParticipant ¶
HasAnyParticipant return true if one of the ids is a participant
func (*Snapshot) HasParticipant ¶
HasParticipant return true if the id is a participant
func (*Snapshot) NextStatuses ¶
NextStatuses returns a slice of next possible statuses for the assigned workflow
func (*Snapshot) SearchComment ¶
SearchComment will search for a comment matching the given hash
func (*Snapshot) ValidateTransitionAndApplyActions ¶
func (snap *Snapshot) ValidateTransitionAndApplyActions(b Interface, newStatus Status, author identity.Interface, unixTime int64) InvalidTransitionError
ValidateTransitionAndApplyActions returns an `InvalidTransitionError` if the supplied state is an invalid destination from the current state for the assigned workflow. If the destination status is not invalid, then it applies the entry actions defined in the workflow
type Status ¶
type Status int
const ( ProposedStatus Status VettedStatus InProgressStatus InReviewStatus ReviewedStatus AcceptedStatus MergedStatus DoneStatus RejectedStatus )
func ActiveStatuses ¶
func ActiveStatuses() []Status
func AllStatuses ¶
func AllStatuses() []Status
func StatusFromString ¶
type StreamedBug ¶
type TimelineItem ¶
type Transition ¶
type Transition struct {
// contains filtered or unexported fields
}
type ValidationFunc ¶
Invoked to validate if a workflow transition can be taken. Returns an error if the transition is invalid.
type WithSnapshot ¶
type WithSnapshot struct { *Bug // contains filtered or unexported fields }
WithSnapshot encapsulate a Bug and maintain the corresponding Snapshot efficiently
func (*WithSnapshot) Append ¶
func (b *WithSnapshot) Append(op Operation)
Append intercept Bug.Append() to update the snapshot efficiently
func (*WithSnapshot) Commit ¶
func (b *WithSnapshot) Commit(repo repository.ClockedRepo) error
Commit intercept Bug.Commit() to update the snapshot efficiently
func (*WithSnapshot) Merge ¶
func (b *WithSnapshot) Merge(repo repository.Repo, other Interface) (bool, error)
Merge intercept Bug.Merge() and clear the snapshot
func (*WithSnapshot) Snapshot ¶
func (b *WithSnapshot) Snapshot() *Snapshot
Snapshot return the current snapshot
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
func FindWorkflow ¶
FindWorkflow searches a list of labels and attempts to match them to a workflow, returning the first found
func (*Workflow) AllStatuses ¶
AllStatuses returns a slice of all possible statuses in the workflow for the given one
func (*Workflow) ApplyTransitionActions ¶
func (w *Workflow) ApplyTransitionActions(b Interface, snap *Snapshot, to Status, author identity.Interface, unixTime int64) error
ApplyTransitionActions invokes the actionHooks of the transition that was taken
func (*Workflow) NextStatuses ¶
NextStatuses returns a slice of next possible statuses in the workflow for the given one
Source Files
¶
- bug.go
- bug_actions.go
- ccb.go
- checklists.go
- clocks.go
- comment.go
- identity.go
- interface.go
- label.go
- op_add_comment.go
- op_create.go
- op_edit_comment.go
- op_label_change.go
- op_noop.go
- op_set_assignee.go
- op_set_ccb.go
- op_set_checklist.go
- op_set_metadata.go
- op_set_review.go
- op_set_status.go
- op_set_title.go
- operation.go
- operation_iterator.go
- operation_pack.go
- reviews.go
- snapshot.go
- sorting.go
- status.go
- timeline.go
- with_snapshot.go
- workflow.go