Documentation ¶
Overview ¶
Package cache contains a caching layer on top of the low-level bug and identity functions to provide efficient querying, filtering, sorting.
Index ¶
- Variables
- type BugCache
- func (c *BugCache) AddComment(message string) (*bug.AddCommentOperation, error)
- func (c *BugCache) AddCommentRaw(author *IdentityCache, unixTime int64, message string, files []repository.Hash, ...) (*bug.AddCommentOperation, error)
- func (c *BugCache) AddCommentWithFiles(message string, files []repository.Hash) (*bug.AddCommentOperation, error)
- func (c *BugCache) CcbAdd(user *IdentityCache, status bug.Status) (*bug.SetCcbOperation, error)
- func (c *BugCache) CcbApprove(status bug.Status) (*bug.SetCcbOperation, error)
- func (c *BugCache) CcbBlock(status bug.Status) (*bug.SetCcbOperation, error)
- func (c *BugCache) CcbRm(user *IdentityCache, status bug.Status) (*bug.SetCcbOperation, error)
- func (c *BugCache) ChangeLabels(added []string, removed []string) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error)
- func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, ...) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error)
- func (c *BugCache) Close() (*bug.SetStatusOperation, error)
- func (c *BugCache) CloseRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error)
- func (c *BugCache) Commit() error
- func (c *BugCache) CommitAsNeeded() error
- func (c *BugCache) EditComment(target entity.Id, message string) (*bug.EditCommentOperation, error)
- func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target entity.Id, message string, ...) (*bug.EditCommentOperation, error)
- func (c *BugCache) EditCreateComment(body string) (*bug.EditCommentOperation, error)
- func (c *BugCache) EditCreateCommentRaw(author *IdentityCache, unixTime int64, body string, metadata map[string]string) (*bug.EditCommentOperation, error)
- func (c *BugCache) ForceChangeLabels(added []string, removed []string) (*bug.LabelChangeOperation, error)
- func (c *BugCache) ForceChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, ...) (*bug.LabelChangeOperation, error)
- func (c *BugCache) Id() entity.Id
- func (c *BugCache) NeedCommit() bool
- func (c *BugCache) Open() (*bug.SetStatusOperation, error)
- func (c *BugCache) OpenRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error)
- func (c *BugCache) ResolveOperationWithMetadata(key string, value string) (entity.Id, error)
- func (c *BugCache) RmReview(id string) (*bug.SetReviewOperation, error)
- func (c *BugCache) SetAssignee(assignee *IdentityCache) (*bug.SetAssigneeOperation, error)
- func (c *BugCache) SetAssigneeRaw(author *IdentityCache, unixTime int64, metadata map[string]string, ...) (*bug.SetAssigneeOperation, error)
- func (c *BugCache) SetCcbRaw(author *IdentityCache, unixTime int64, metadata map[string]string, ...) (*bug.SetCcbOperation, error)
- func (c *BugCache) SetChecklist(cl bug.Checklist) (*bug.SetChecklistOperation, error)
- func (c *BugCache) SetChecklistRaw(author *IdentityCache, unixTime int64, cl bug.Checklist, ...) (*bug.SetChecklistOperation, error)
- func (c *BugCache) SetMetadata(target entity.Id, newMetadata map[string]string) (*bug.SetMetadataOperation, error)
- func (c *BugCache) SetMetadataRaw(author *IdentityCache, unixTime int64, target entity.Id, ...) (*bug.SetMetadataOperation, error)
- func (c *BugCache) SetReview(review review2.PullRequest) (*bug.SetReviewOperation, error)
- func (c *BugCache) SetReviewRaw(author *IdentityCache, unixTime int64, metadata map[string]string, ...) (*bug.SetReviewOperation, error)
- func (c *BugCache) SetStatus(status bug.Status) (*bug.SetStatusOperation, error)
- func (c *BugCache) SetStatusRaw(author *IdentityCache, unixTime int64, metadata map[string]string, ...) (*bug.SetStatusOperation, error)
- func (c *BugCache) SetTitle(title string) (*bug.SetTitleOperation, error)
- func (c *BugCache) SetTitleRaw(author *IdentityCache, unixTime int64, title string, ...) (*bug.SetTitleOperation, error)
- func (c *BugCache) Snapshot() *bug.Snapshot
- type BugExcerpt
- type BugsByCreationTime
- type BugsByEditTime
- type BugsById
- type CcbInfoExcerpt
- type Filter
- func ActorFilter(query string) Filter
- func AssigneeFilter(query string) Filter
- func AuthorFilter(query string) Filter
- func CcbFilter(query string) Filter
- func CcbPendingFilter(query string) Filter
- func CreateAfterFilter(filterTime time.Time) Filter
- func CreateBeforeFilter(filterTime time.Time) Filter
- func EditAfterFilter(filterTime time.Time) Filter
- func EditBeforeFilter(filterTime time.Time) Filter
- func LabelFilter(label string) Filter
- func NoLabelFilter() Filter
- func ParticipantFilter(query string) Filter
- func StatusFilter(status bug.Status) Filter
- func TitleFilter(query string) Filter
- type GiteaIdError
- type GiteaIdErrorType
- type IdentityById
- type IdentityCache
- type IdentityExcerpt
- type LRUIdCache
- func (c *LRUIdCache) Add(id entity.Id) bool
- func (c *LRUIdCache) Contains(id entity.Id) bool
- func (c *LRUIdCache) Get(id entity.Id) bool
- func (c *LRUIdCache) GetOldest() (entity.Id, bool)
- func (c *LRUIdCache) GetOldestToNewest() (ids []entity.Id)
- func (c *LRUIdCache) Len() int
- func (c *LRUIdCache) Remove(id entity.Id) bool
- type LegacyAuthorExcerpt
- type Matcher
- type MultiRepoCache
- func (c *MultiRepoCache) Close() error
- func (c *MultiRepoCache) DefaultRepo() (*RepoCache, error)
- func (c *MultiRepoCache) RegisterDefaultRepository(repo repository.ClockedRepo) (*RepoCache, error)
- func (c *MultiRepoCache) RegisterRepository(ref string, repo repository.ClockedRepo) (*RepoCache, error)
- func (c *MultiRepoCache) ResolveRepo(ref string) (*RepoCache, error)
- type RefreshResult
- type RepoCache
- func (c *RepoCache) AllBugsIds() []entity.Id
- func (c *RepoCache) AllIdentityIds() []entity.Id
- func (c *RepoCache) Close() error
- func (c *RepoCache) Fetch(remote string) (string, error)
- func (c *RepoCache) GetConfig(name string) ([]byte, error)
- func (c *RepoCache) GetCoreEditor() (string, error)
- func (c *RepoCache) GetPath() string
- func (c *RepoCache) GetRemotes() (map[string]string, error)
- func (c *RepoCache) GetUserEmail() (string, error)
- func (c *RepoCache) GetUserIdentity() (*IdentityCache, error)
- func (c *RepoCache) GetUserIdentityExcerpt() (*IdentityExcerpt, error)
- func (c *RepoCache) GetUserName() (string, error)
- func (c *RepoCache) GlobalConfig() repository.Config
- func (c *RepoCache) IsUserIdentitySet() (bool, error)
- func (c *RepoCache) ListConfigs() ([]string, error)
- func (c *RepoCache) LocalConfig() repository.Config
- func (c *RepoCache) MergeAll(remote string) <-chan entity.MergeResult
- func (c *RepoCache) Name() string
- func (c *RepoCache) NewBug(title, message, workflow string) (*BugCache, *bug.CreateOperation, error)
- func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title, message, workflow string, ...) (*BugCache, *bug.CreateOperation, error)
- func (c *RepoCache) NewBugWithFiles(title, message, workflow string, files []repository.Hash) (*BugCache, *bug.CreateOperation, error)
- func (c *RepoCache) NewIdentity(name string, email string, skipPhabId, skipGiteaId bool, giteaUserName string) (*IdentityCache, error)
- func (c *RepoCache) NewIdentityFromGitUser() (*IdentityCache, error)
- func (c *RepoCache) NewIdentityFromGitUserRaw(metadata map[string]string) (*IdentityCache, error)
- func (c *RepoCache) NewIdentityFull(name string, email string, login string, avatarUrl string, ...) (*IdentityCache, error)
- func (c *RepoCache) NewIdentityRaw(name string, email string, login string, avatarUrl string, ...) (*IdentityCache, error)
- func (c *RepoCache) NewIdentityWithKeyRaw(name string, email string, login string, avatarUrl string, ...) (*IdentityCache, error)
- func (c *RepoCache) Pull(remote string, out io.Writer) error
- func (c *RepoCache) Push(remote string, out io.Writer) error
- func (c *RepoCache) PushTicket(remote string, ref string, out io.Writer) error
- func (c *RepoCache) QueryBugs(q *query.Query) []entity.Id
- func (c *RepoCache) ReadData(hash repository.Hash) ([]byte, error)
- func (c *RepoCache) RefreshCache() ([]RefreshResult, error)
- func (c *RepoCache) RemoveBug(prefix string) error
- func (c *RepoCache) ResetBug(prefix string) error
- func (c *RepoCache) ResolveBug(id entity.Id) (*BugCache, error)
- func (c *RepoCache) ResolveBugCreateMetadata(key string, value string) (*BugCache, error)
- func (c *RepoCache) ResolveBugExcerpt(id entity.Id) (*BugExcerpt, error)
- func (c *RepoCache) ResolveBugExcerptMatcher(f func(*BugExcerpt) bool) (*BugExcerpt, error)
- func (c *RepoCache) ResolveBugExcerptPrefix(prefix string) (*BugExcerpt, error)
- func (c *RepoCache) ResolveBugMatcher(f func(*BugExcerpt) bool) (*BugCache, error)
- func (c *RepoCache) ResolveBugPrefix(prefix string) (*BugCache, error)
- func (c *RepoCache) ResolveCommit(hash repository.Hash) (*object.Commit, error)
- func (c *RepoCache) ResolveIdentity(id entity.Id) (*IdentityCache, error)
- func (c *RepoCache) ResolveIdentityExcerpt(id entity.Id) (*IdentityExcerpt, error)
- func (c *RepoCache) ResolveIdentityExcerptMatcher(f func(*IdentityExcerpt) bool) (*IdentityExcerpt, error)
- func (c *RepoCache) ResolveIdentityExcerptPrefix(prefix string) (*IdentityExcerpt, error)
- func (c *RepoCache) ResolveIdentityGiteaID(giteaID int64) (identity.Interface, error)
- func (c *RepoCache) ResolveIdentityImmutableMetadata(key string, value string) (*IdentityCache, error)
- func (c *RepoCache) ResolveIdentityMatcher(f func(*IdentityExcerpt) bool) (*IdentityCache, error)
- func (c *RepoCache) ResolveIdentityPhabID(phabID string) (identity.Interface, error)
- func (c *RepoCache) ResolveIdentityPrefix(prefix string) (*IdentityCache, error)
- func (c *RepoCache) ResolveRef(ref string) (repository.Hash, error)
- func (c *RepoCache) SetConfig(name string, configData []byte) error
- func (c *RepoCache) SetUserIdentity(i *IdentityCache) error
- func (c *RepoCache) StoreData(data []byte) (repository.Hash, error)
- func (c *RepoCache) UpdateConfigs(remote string) (string, error)
- func (c *RepoCache) UpdateIdentity(i *IdentityCache, name string, email string, login string, avatarUrl string, ...) error
- func (c *RepoCache) UpdateIdentityWithGiteaId(i *IdentityCache, name string, email string, login string, avatarUrl string, ...) error
- func (c *RepoCache) ValidLabels() []bug.Label
Constants ¶
This section is empty.
Variables ¶
var ErrNoMatchingOp = fmt.Errorf("no matching operation found")
Functions ¶
This section is empty.
Types ¶
type BugCache ¶
type BugCache struct {
// contains filtered or unexported fields
}
BugCache is a wrapper around a Bug. It provide multiple functions:
1. Provide a higher level API to use than the raw API from Bug. 2. Maintain an up to date Snapshot available. 3. Deal with concurrency.
func (*BugCache) AddComment ¶
func (c *BugCache) AddComment(message string) (*bug.AddCommentOperation, error)
func (*BugCache) AddCommentRaw ¶
func (c *BugCache) AddCommentRaw(author *IdentityCache, unixTime int64, message string, files []repository.Hash, metadata map[string]string) (*bug.AddCommentOperation, error)
func (*BugCache) AddCommentWithFiles ¶
func (c *BugCache) AddCommentWithFiles(message string, files []repository.Hash) (*bug.AddCommentOperation, error)
func (*BugCache) CcbAdd ¶
func (c *BugCache) CcbAdd(user *IdentityCache, status bug.Status) (*bug.SetCcbOperation, error)
func (*BugCache) CcbApprove ¶
func (*BugCache) CcbRm ¶
func (c *BugCache) CcbRm(user *IdentityCache, status bug.Status) (*bug.SetCcbOperation, error)
func (*BugCache) ChangeLabels ¶
func (c *BugCache) ChangeLabels(added []string, removed []string) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error)
func (*BugCache) ChangeLabelsRaw ¶
func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, metadata map[string]string) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error)
func (*BugCache) CloseRaw ¶
func (c *BugCache) CloseRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error)
func (*BugCache) CommitAsNeeded ¶
func (*BugCache) EditComment ¶
func (*BugCache) EditCommentRaw ¶
func (*BugCache) EditCreateComment ¶
func (c *BugCache) EditCreateComment(body string) (*bug.EditCommentOperation, error)
func (*BugCache) EditCreateCommentRaw ¶
func (c *BugCache) EditCreateCommentRaw(author *IdentityCache, unixTime int64, body string, metadata map[string]string) (*bug.EditCommentOperation, error)
func (*BugCache) ForceChangeLabels ¶
func (*BugCache) ForceChangeLabelsRaw ¶
func (c *BugCache) ForceChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, metadata map[string]string) (*bug.LabelChangeOperation, error)
func (*BugCache) NeedCommit ¶
func (*BugCache) OpenRaw ¶
func (c *BugCache) OpenRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error)
func (*BugCache) ResolveOperationWithMetadata ¶
ResolveOperationWithMetadata will find an operation that has the matching metadata
func (*BugCache) SetAssignee ¶
func (c *BugCache) SetAssignee(assignee *IdentityCache) (*bug.SetAssigneeOperation, error)
func (*BugCache) SetAssigneeRaw ¶
func (c *BugCache) SetAssigneeRaw(author *IdentityCache, unixTime int64, metadata map[string]string, assignee *IdentityCache) (*bug.SetAssigneeOperation, error)
func (*BugCache) SetCcbRaw ¶
func (c *BugCache) SetCcbRaw(author *IdentityCache, unixTime int64, metadata map[string]string, user *IdentityCache, status bug.Status, state bug.CcbState) (*bug.SetCcbOperation, error)
func (*BugCache) SetChecklist ¶
func (*BugCache) SetChecklistRaw ¶
func (c *BugCache) SetChecklistRaw(author *IdentityCache, unixTime int64, cl bug.Checklist, metadata map[string]string) (*bug.SetChecklistOperation, error)
func (*BugCache) SetMetadata ¶
func (*BugCache) SetMetadataRaw ¶
func (c *BugCache) SetMetadataRaw(author *IdentityCache, unixTime int64, target entity.Id, newMetadata map[string]string) (*bug.SetMetadataOperation, error)
func (*BugCache) SetReview ¶
func (c *BugCache) SetReview(review review2.PullRequest) (*bug.SetReviewOperation, error)
func (*BugCache) SetReviewRaw ¶
func (c *BugCache) SetReviewRaw(author *IdentityCache, unixTime int64, metadata map[string]string, review review2.PullRequest) (*bug.SetReviewOperation, error)
func (*BugCache) SetStatusRaw ¶
func (c *BugCache) SetStatusRaw(author *IdentityCache, unixTime int64, metadata map[string]string, status bug.Status) (*bug.SetStatusOperation, error)
func (*BugCache) SetTitle ¶
func (c *BugCache) SetTitle(title string) (*bug.SetTitleOperation, error)
func (*BugCache) SetTitleRaw ¶
func (c *BugCache) SetTitleRaw(author *IdentityCache, unixTime int64, title string, metadata map[string]string) (*bug.SetTitleOperation, error)
type BugExcerpt ¶
type BugExcerpt struct { Id entity.Id CreateLamportTime lamport.Time EditLamportTime lamport.Time CreateUnixTime int64 EditUnixTime int64 Status bug.Status Labels []bug.Label Title string LenComments int AssigneeId entity.Id Actors []entity.Id Participants []entity.Id Ccb []CcbInfoExcerpt // If author is identity.Bare, LegacyAuthor is set // If author is identity.Identity, AuthorId is set and data is deported // in a IdentityExcerpt LegacyAuthor LegacyAuthorExcerpt AuthorId entity.Id CreateMetadata map[string]string }
BugExcerpt hold a subset of the bug values to be able to sort and filter bugs efficiently without having to read and compile each raw bugs.
func NewBugExcerpt ¶
func NewBugExcerpt(b bug.Interface, snap *bug.Snapshot) *BugExcerpt
func (*BugExcerpt) CreateTime ¶
func (b *BugExcerpt) CreateTime() time.Time
func (*BugExcerpt) EditTime ¶
func (b *BugExcerpt) EditTime() time.Time
type BugsByCreationTime ¶
type BugsByCreationTime []*BugExcerpt
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 []*BugExcerpt
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 BugsById ¶
type BugsById []*BugExcerpt
type CcbInfoExcerpt ¶
type Filter ¶
type Filter func(excerpt *BugExcerpt, resolver resolver) bool
Filter is a predicate that match a subset of bugs
func ActorFilter ¶
ActorFilter return a Filter that match a bug actor
func AssigneeFilter ¶
AssigneeFilter return a Filter that match a bug assignee
func AuthorFilter ¶
AuthorFilter return a Filter that match a bug author
func CcbPendingFilter ¶
CcbPendingFilter return a Filter that matches a ticket with pending ccb approval
func CreateAfterFilter ¶
CreateAfterFilter returns a Filter that match create time being after the provided time
func CreateBeforeFilter ¶
CreateBeforeFilter returns a Filter that match create time being before the provided time
func EditAfterFilter ¶
EditAfterFilter returns a Filter that match edit time being after the provided time
func EditBeforeFilter ¶
EditBeforeFilter returns a Filter that match edit time being before the provided time
func LabelFilter ¶
LabelFilter return a Filter that match a label
func NoLabelFilter ¶
func NoLabelFilter() Filter
NoLabelFilter return a Filter that match the absence of labels
func ParticipantFilter ¶
ParticipantFilter return a Filter that match a bug participant
func StatusFilter ¶
StatusFilter return a Filter that match a bug status
func TitleFilter ¶
TitleFilter return a Filter that match if the title contains the given query
type GiteaIdError ¶
type GiteaIdError struct { GiteaIdErrorType GiteaIdErrorType // contains filtered or unexported fields }
type GiteaIdErrorType ¶
type GiteaIdErrorType uint
const ( GiteaIdNotFound GiteaIdErrorType = iota GiteaIdMultipleMatches )
type IdentityById ¶
type IdentityById []*IdentityExcerpt
func (IdentityById) Len ¶
func (b IdentityById) Len() int
func (IdentityById) Less ¶
func (b IdentityById) Less(i, j int) bool
func (IdentityById) Swap ¶
func (b IdentityById) Swap(i, j int)
type IdentityCache ¶
IdentityCache is a wrapper around an Identity for caching.
func NewIdentityCache ¶
func NewIdentityCache(repoCache *RepoCache, id *identity.Identity) *IdentityCache
func (*IdentityCache) Commit ¶
func (i *IdentityCache) Commit() error
func (*IdentityCache) CommitAsNeeded ¶
func (i *IdentityCache) CommitAsNeeded() error
type IdentityExcerpt ¶
type IdentityExcerpt struct { Id entity.Id Name string Login string PhabID string GiteaID int64 ImmutableMetadata map[string]string }
IdentityExcerpt hold a subset of the identity values to be able to sort and filter identities efficiently without having to read and compile each raw identity.
func NewIdentityExcerpt ¶
func NewIdentityExcerpt(i *identity.Identity) *IdentityExcerpt
func (*IdentityExcerpt) DisplayName ¶
func (i *IdentityExcerpt) DisplayName() string
DisplayName return a non-empty string to display, representing the identity, based on the non-empty values.
func (*IdentityExcerpt) Match ¶
func (i *IdentityExcerpt) Match(query string) bool
Match matches a query with the identity name, login and ID prefixes
type LRUIdCache ¶
type LRUIdCache struct {
// contains filtered or unexported fields
}
func NewLRUIdCache ¶
func NewLRUIdCache() *LRUIdCache
func (*LRUIdCache) GetOldestToNewest ¶
func (c *LRUIdCache) GetOldestToNewest() (ids []entity.Id)
func (*LRUIdCache) Len ¶
func (c *LRUIdCache) Len() int
type LegacyAuthorExcerpt ¶
identity.Bare data are directly embedded in the bug excerpt
func (LegacyAuthorExcerpt) DisplayName ¶
func (l LegacyAuthorExcerpt) DisplayName() string
type Matcher ¶
type Matcher struct { Status []Filter Author []Filter Assignee []Filter Ccb []Filter CcbPending []Filter Actor []Filter Participant []Filter Label []Filter Title []Filter NoFilters []Filter TimeFilters []Filter }
Matcher is a collection of Filter that implement a complex filter
func (*Matcher) Match ¶
func (f *Matcher) Match(excerpt *BugExcerpt, resolver resolver) bool
Match check if a bug match the set of filters
type MultiRepoCache ¶
type MultiRepoCache struct {
// contains filtered or unexported fields
}
MultiRepoCache is the root cache, holding multiple RepoCache.
func NewMultiRepoCache ¶
func NewMultiRepoCache() *MultiRepoCache
func (*MultiRepoCache) Close ¶
func (c *MultiRepoCache) Close() error
Close will do anything that is needed to close the cache properly
func (*MultiRepoCache) DefaultRepo ¶
func (c *MultiRepoCache) DefaultRepo() (*RepoCache, error)
DefaultRepo retrieve the default repository
func (*MultiRepoCache) RegisterDefaultRepository ¶
func (c *MultiRepoCache) RegisterDefaultRepository(repo repository.ClockedRepo) (*RepoCache, error)
RegisterDefaultRepository register a unnamed repository. Use this for mono-repo setup
func (*MultiRepoCache) RegisterRepository ¶
func (c *MultiRepoCache) RegisterRepository(ref string, repo repository.ClockedRepo) (*RepoCache, error)
RegisterRepository register a named repository. Use this for multi-repo setup
func (*MultiRepoCache) ResolveRepo ¶
func (c *MultiRepoCache) ResolveRepo(ref string) (*RepoCache, error)
ResolveRepo retrieve a repository with a reference
type RefreshResult ¶
RefreshResult holds the state of a bug that is new or has been updated
type RepoCache ¶
type RepoCache struct {
// contains filtered or unexported fields
}
RepoCache is a cache for a Repository. This cache has multiple functions:
- After being loaded, a Bug is kept in memory in the cache, allowing for fast access later.
- The cache maintain in memory and on disk a pre-digested excerpt for each bug, allowing for fast querying the whole set of bugs without having to load them individually.
- The cache guarantee that a single instance of a Bug is loaded at once, avoiding loss of data that we could have with multiple copies in the same process.
- The same way, the cache maintain in memory a single copy of the loaded identities.
The cache also protect the on-disk data by locking the git repository for its own usage, by writing a lock file. Of course, normal git operations are not affected, only git-bug related one.
func NewNamedRepoCache ¶
func NewNamedRepoCache(r repository.ClockedRepo, rebuild bool, name string) (*RepoCache, error)
func NewRepoCache ¶
func NewRepoCache(r repository.ClockedRepo, rebuild bool) (*RepoCache, error)
func (*RepoCache) AllBugsIds ¶
AllBugsIds return all known bug ids
func (*RepoCache) AllIdentityIds ¶
AllIdentityIds return all known identity ids
func (*RepoCache) Fetch ¶
Fetch retrieve updates from a remote This does not change the local bugs or identities state
func (*RepoCache) GetCoreEditor ¶
GetCoreEditor returns the name of the editor that the user has used to configure git.
func (*RepoCache) GetRemotes ¶
GetRemotes returns the configured remotes repositories.
func (*RepoCache) GetUserEmail ¶
GetUserEmail returns the email address that the user has used to configure git.
func (*RepoCache) GetUserIdentity ¶
func (c *RepoCache) GetUserIdentity() (*IdentityCache, error)
func (*RepoCache) GetUserIdentityExcerpt ¶
func (c *RepoCache) GetUserIdentityExcerpt() (*IdentityExcerpt, error)
func (*RepoCache) GetUserName ¶
GetUserName returns the name the the user has used to configure git
func (*RepoCache) GlobalConfig ¶
func (c *RepoCache) GlobalConfig() repository.Config
GlobalConfig give access to the git global configuration
func (*RepoCache) IsUserIdentitySet ¶
func (*RepoCache) ListConfigs ¶
List configurations stored in git
func (*RepoCache) LocalConfig ¶
func (c *RepoCache) LocalConfig() repository.Config
LocalConfig give access to the repository scoped configuration
func (*RepoCache) MergeAll ¶
func (c *RepoCache) MergeAll(remote string) <-chan entity.MergeResult
MergeAll will merge all the available remote bug and identities
func (*RepoCache) NewBug ¶
func (c *RepoCache) NewBug(title, message, workflow string) (*BugCache, *bug.CreateOperation, error)
NewBug create a new bug The new bug is written in the repository (commit)
func (*RepoCache) NewBugRaw ¶
func (c *RepoCache) NewBugRaw(author *IdentityCache, unixTime int64, title, message, workflow string, files []repository.Hash, metadata map[string]string) (*BugCache, *bug.CreateOperation, error)
NewBugWithFilesMeta create a new bug with attached files for the message, as well as metadata for the Create operation. The new bug is written in the repository (commit)
func (*RepoCache) NewBugWithFiles ¶
func (c *RepoCache) NewBugWithFiles(title, message, workflow string, files []repository.Hash) (*BugCache, *bug.CreateOperation, error)
NewBugWithFiles create a new bug with attached files for the message The new bug is written in the repository (commit)
func (*RepoCache) NewIdentity ¶
func (c *RepoCache) NewIdentity(name string, email string, skipPhabId, skipGiteaId bool, giteaUserName string) (*IdentityCache, error)
NewIdentity create a new identity The new identity is written in the repository (commit)
func (*RepoCache) NewIdentityFromGitUser ¶
func (c *RepoCache) NewIdentityFromGitUser() (*IdentityCache, error)
func (*RepoCache) NewIdentityFromGitUserRaw ¶
func (c *RepoCache) NewIdentityFromGitUserRaw(metadata map[string]string) (*IdentityCache, error)
func (*RepoCache) NewIdentityFull ¶
func (c *RepoCache) NewIdentityFull(name string, email string, login string, avatarUrl string, skipPhabId, skipGiteaId bool, giteaUserName string) (*IdentityCache, error)
NewIdentityFull create a new identity The new identity is written in the repository (commit)
func (*RepoCache) NewIdentityRaw ¶
func (*RepoCache) NewIdentityWithKeyRaw ¶
func (*RepoCache) Pull ¶
Pull will do a Fetch + MergeAll This function will return an error if a merge fail
func (*RepoCache) PushTicket ¶
PushTicket update a remote with the local changes to a single ticket
func (*RepoCache) ReadData ¶
func (c *RepoCache) ReadData(hash repository.Hash) ([]byte, error)
ReadData will attempt to read arbitrary data from the given hash
func (*RepoCache) RefreshCache ¶
func (c *RepoCache) RefreshCache() ([]RefreshResult, error)
RefreshCache synchronizes the local cache with the bugs and identity commits
func (*RepoCache) ResetBug ¶
ResetBug resets a bug to the remote state in the cache and repo given a bug id prefix
func (*RepoCache) ResolveBug ¶
ResolveBug retrieve a bug matching the exact given id
func (*RepoCache) ResolveBugCreateMetadata ¶
ResolveBugCreateMetadata retrieve a bug that has the exact given metadata on its Create operation, that is, the first operation. It fails if multiple bugs match.
func (*RepoCache) ResolveBugExcerpt ¶
func (c *RepoCache) ResolveBugExcerpt(id entity.Id) (*BugExcerpt, error)
ResolveBugExcerpt retrieve a BugExcerpt matching the exact given id
func (*RepoCache) ResolveBugExcerptMatcher ¶
func (c *RepoCache) ResolveBugExcerptMatcher(f func(*BugExcerpt) bool) (*BugExcerpt, error)
func (*RepoCache) ResolveBugExcerptPrefix ¶
func (c *RepoCache) ResolveBugExcerptPrefix(prefix string) (*BugExcerpt, error)
ResolveBugExcerptPrefix retrieve a BugExcerpt matching an id prefix. It fails if multiple bugs match.
func (*RepoCache) ResolveBugMatcher ¶
func (c *RepoCache) ResolveBugMatcher(f func(*BugExcerpt) bool) (*BugCache, error)
func (*RepoCache) ResolveBugPrefix ¶
ResolveBugPrefix retrieve a bug matching an id prefix. It fails if multiple bugs match.
func (*RepoCache) ResolveCommit ¶
func (*RepoCache) ResolveIdentity ¶
func (c *RepoCache) ResolveIdentity(id entity.Id) (*IdentityCache, error)
ResolveIdentity retrieve an identity matching the exact given id
func (*RepoCache) ResolveIdentityExcerpt ¶
func (c *RepoCache) ResolveIdentityExcerpt(id entity.Id) (*IdentityExcerpt, error)
ResolveIdentityExcerpt retrieve a IdentityExcerpt matching the exact given id
func (*RepoCache) ResolveIdentityExcerptMatcher ¶
func (c *RepoCache) ResolveIdentityExcerptMatcher(f func(*IdentityExcerpt) bool) (*IdentityExcerpt, error)
func (*RepoCache) ResolveIdentityExcerptPrefix ¶
func (c *RepoCache) ResolveIdentityExcerptPrefix(prefix string) (*IdentityExcerpt, error)
ResolveIdentityExcerptPrefix retrieve a IdentityExcerpt matching an id prefix. It fails if multiple identities match.
func (*RepoCache) ResolveIdentityGiteaID ¶
ResolveIdentityGiteaID retrieve an Identity matching a Gitea ID. It fails if multiple identities match.
func (*RepoCache) ResolveIdentityImmutableMetadata ¶
func (c *RepoCache) ResolveIdentityImmutableMetadata(key string, value string) (*IdentityCache, error)
ResolveIdentityImmutableMetadata retrieve an Identity that has the exact given metadata on one of it's version. If multiple version have the same key, the first defined take precedence.
func (*RepoCache) ResolveIdentityMatcher ¶
func (c *RepoCache) ResolveIdentityMatcher(f func(*IdentityExcerpt) bool) (*IdentityCache, error)
func (*RepoCache) ResolveIdentityPhabID ¶
ResolveIdentityPhabID retrieve an Identity matching a Phabricator ID. It fails if multiple identities match.
func (*RepoCache) ResolveIdentityPrefix ¶
func (c *RepoCache) ResolveIdentityPrefix(prefix string) (*IdentityCache, error)
ResolveIdentityPrefix retrieve an Identity matching an id prefix. It fails if multiple identities match.
func (*RepoCache) ResolveRef ¶
func (c *RepoCache) ResolveRef(ref string) (repository.Hash, error)
func (*RepoCache) SetUserIdentity ¶
func (c *RepoCache) SetUserIdentity(i *IdentityCache) error
func (*RepoCache) StoreData ¶
func (c *RepoCache) StoreData(data []byte) (repository.Hash, error)
StoreData will store arbitrary data and return the corresponding hash
func (*RepoCache) UpdateConfigs ¶
UpdateConfigs will update all the configs from the remote
func (*RepoCache) UpdateIdentity ¶
func (c *RepoCache) UpdateIdentity(i *IdentityCache, name string, email string, login string, avatarUrl string, skipPhabId, skipGiteaId bool, giteaUserName string) error
UpdateIdentity updates an existing identity in the repository and cache
func (*RepoCache) UpdateIdentityWithGiteaId ¶
func (c *RepoCache) UpdateIdentityWithGiteaId(i *IdentityCache, name string, email string, login string, avatarUrl string, skipPhabId bool, giteaID int64) error
UpdateIdentityWithGiteaId updates an existing identity in the repository and cache using the provided giteaID
func (*RepoCache) ValidLabels ¶
ValidLabels list valid labels
Note: in the future, a proper label policy could be implemented where valid labels are defined in a configuration file. Until that, the default behavior is to return the list of labels already used, plus all defined checklists and workflows.