aboutsummaryrefslogtreecommitdiffstats
path: root/modules/indexer/code/bleve.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-12-10 21:29:40 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-12-10 14:29:40 +0100
commit50da9f7daed4fe3e8f0c76f23eeb987e97de4962 (patch)
treeab524323c8fe0973cb831f930641d241f6d3b1ff /modules/indexer/code/bleve.go
parent2c83dac5d47195b7589a9e879598d00c00f1b302 (diff)
downloadgitea-50da9f7daed4fe3e8f0c76f23eeb987e97de4962.tar.gz
gitea-50da9f7daed4fe3e8f0c76f23eeb987e97de4962.zip
Move modules/indexer to modules/indexer/code (#9301)
Diffstat (limited to 'modules/indexer/code/bleve.go')
-rw-r--r--modules/indexer/code/bleve.go23
1 files changed, 11 insertions, 12 deletions
diff --git a/modules/indexer/code/bleve.go b/modules/indexer/code/bleve.go
index 4e7eaa21b7..c2d1ed902f 100644
--- a/modules/indexer/code/bleve.go
+++ b/modules/indexer/code/bleve.go
@@ -15,7 +15,6 @@ import (
"code.gitea.io/gitea/modules/charset"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/graceful"
- "code.gitea.io/gitea/modules/indexer"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"github.com/ethantkoenig/rupture"
@@ -39,7 +38,7 @@ func InitRepoIndexer() {
go func() {
start := time.Now()
log.Info("Initializing Repository Indexer")
- indexer.InitRepoIndexer(populateRepoIndexerAsynchronously)
+ initRepoIndexer(populateRepoIndexerAsynchronously)
go processRepoIndexerOperationQueue()
waitChannel <- time.Since(start)
}()
@@ -130,7 +129,7 @@ func updateRepoIndexer(repoID int64) error {
return nil
}
- batch := indexer.RepoIndexerBatch()
+ batch := RepoIndexerBatch()
for _, update := range changes.Updates {
if err := addUpdate(update, repo, batch); err != nil {
return err
@@ -198,10 +197,10 @@ func addUpdate(update fileUpdate, repo *models.Repository, batch rupture.Flushin
// FIXME: UTF-16 files will probably fail here
return nil
}
- indexerUpdate := indexer.RepoIndexerUpdate{
+ indexerUpdate := RepoIndexerUpdate{
Filepath: update.Filename,
- Op: indexer.RepoIndexerOpUpdate,
- Data: &indexer.RepoIndexerData{
+ Op: RepoIndexerOpUpdate,
+ Data: &RepoIndexerData{
RepoID: repo.ID,
Content: string(charset.ToUTF8DropErrors(fileContents)),
},
@@ -210,10 +209,10 @@ func addUpdate(update fileUpdate, repo *models.Repository, batch rupture.Flushin
}
func addDelete(filename string, repo *models.Repository, batch rupture.FlushingBatch) error {
- indexerUpdate := indexer.RepoIndexerUpdate{
+ indexerUpdate := RepoIndexerUpdate{
Filepath: filename,
- Op: indexer.RepoIndexerOpDelete,
- Data: &indexer.RepoIndexerData{
+ Op: RepoIndexerOpDelete,
+ Data: &RepoIndexerData{
RepoID: repo.ID,
},
}
@@ -279,7 +278,7 @@ func nonGenesisChanges(repo *models.Repository, revision string) (*repoChanges,
// previous commit sha may have been removed by a force push, so
// try rebuilding from scratch
log.Warn("git diff: %v", err)
- if err = indexer.DeleteRepoFromIndexer(repo.ID); err != nil {
+ if err = deleteRepoFromIndexer(repo.ID); err != nil {
return nil, err
}
return genesisChanges(repo, revision)
@@ -326,8 +325,8 @@ func processRepoIndexerOperationQueue() {
op := <-repoIndexerOperationQueue
var err error
if op.deleted {
- if err = indexer.DeleteRepoFromIndexer(op.repoID); err != nil {
- log.Error("DeleteRepoFromIndexer: %v", err)
+ if err = deleteRepoFromIndexer(op.repoID); err != nil {
+ log.Error("deleteRepoFromIndexer: %v", err)
}
} else {
if err = updateRepoIndexer(op.repoID); err != nil {