Move SeenMap to the utils dir

This commit is contained in:
Haiyan Meng
2020-01-15 12:04:22 -08:00
parent aaaba99389
commit cf8d53a195
10 changed files with 85 additions and 40 deletions

View File

@@ -9,6 +9,8 @@ import (
"os"
"time"
"sigs.k8s.io/kustomize/api/internal/crawl/utils"
"sigs.k8s.io/kustomize/api/internal/crawl/crawler"
"sigs.k8s.io/kustomize/api/internal/crawl/crawler/github"
"sigs.k8s.io/kustomize/api/internal/crawl/doc"
@@ -26,6 +28,7 @@ const (
)
type CrawlMode int
const (
CrawlUnknown CrawlMode = iota
// Crawl all the kustomization files in all the repositories of a Github user
@@ -125,13 +128,13 @@ func main() {
// seen tracks the IDs of all the documents in the index.
// This helps avoid indexing a given document multiple times.
seen := crawler.NewSeenMap()
seen := utils.NewSeenMap()
mode := NewCrawlMode(*modePtr)
ghCrawlerConstructor := func(user, repo string) crawler.Crawler {
if user != "" {
return github.NewCrawler(githubToken, retryCount, clientCache,
return github.NewCrawler(githubToken, retryCount, clientCache,
github.QueryWith(
github.Filename("kustomization.yaml"),
github.Filename("kustomization.yml"),

View File

@@ -7,7 +7,6 @@ import (
"log"
"net/http"
"os"
"sigs.k8s.io/kustomize/api/internal/crawl/crawler"
"sort"
"time"
@@ -51,10 +50,10 @@ func GeneratorAndTransformerStats(ctx context.Context,
generatorDocs []*doc.Document, transformerDocs []*doc.Document,
idx *index.KustomizeIndex) {
// allGenerators includes all the documents referred in the generators field
allGenerators := crawler.NewUniqueDocuments()
allGenerators := doc.NewUniqueDocuments()
// allTransformers includes all the documents referred in the transformers field
allTransformers := crawler.NewUniqueDocuments()
allTransformers := doc.NewUniqueDocuments()
// docUsingGeneratorCount counts the number of the kustomization files using generators
docUsingGeneratorCount := 0