This repository was archived by the owner on Dec 11, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
[#250] Full refactoring (Draft) #271
Draft
kamilongus
wants to merge
7
commits into
develop
Choose a base branch
from
250-many-clients-already
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f338ae6
Store repository index in database instead of file system
kamilongus 1d5c496
some refactoring
kamilongus 797fc8b
+ some changes
kamilongus 3d2bff0
+ some changes
kamilongus 398191d
+ some changes
kamilongus a3733c0
+ added SearchProvider trait
kamilongus 8f886b9
exclude tests dirs via regexp
kamilongus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,27 +19,35 @@ db { | |
|
|
||
| languagesConfig { | ||
| haskell { | ||
| repository = "hackage" | ||
| repoIndexUrl = "http://hackage.haskell.org/packages/index.tar.gz" | ||
| packageUrl = "https://hackage.haskell.org/package/%1$s-%2$s/%1$s-%2$s.tar.gz" | ||
| repoArchivePath = "./data/meta/haskell/index.tar.gz" | ||
| repoPath = "./data/meta/haskell/" | ||
| concurrentTasksCount = 30 | ||
| } | ||
| rust { | ||
| repository = "crates" | ||
| repoIndexUrl = "https://github.com/rust-lang/crates.io-index/archive/master.zip" | ||
| packageUrl = "https://crates.io/api/v1/crates/%s/%s/download" | ||
| repoArchivePath = "./data/meta/rust/archive.zip" | ||
| repoPath = "./data/meta/rust/" | ||
| concurrentTasksCount = 30 | ||
| ignoreFiles = ["test-max-version-example-crate", "version-length-checking-is-overrated", "config.json", "archive.zip", ".git"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is config.json excluded? (Not saying it shouldn't be, just asking why)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @neongreen I can't answer why is so =( but it was originally. I will remove it, thanks. |
||
| } | ||
| ruby { | ||
| repository = "gem" | ||
| repoIndexUrl = "http://rubygems.org/latest_specs.4.8.gz" | ||
| packageUrl = "https://rubygems.org/downloads/%s-%s.gem" | ||
| repoArchivePath = "./data/meta/ruby/ruby_index.gz" | ||
| repoJsonPath = "./data/meta/ruby/ruby_index.json" | ||
| scriptPath = "./scripts/update_index.rb" | ||
| concurrentTasksCount = 30 | ||
| } | ||
| javascript { | ||
| repository = "npm" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a tab? Please no tabs |
||
| repoIndexUrl = "https://replicate.npmjs.com/_all_docs?include_docs=true" | ||
| repoJsonPath = "./data/meta/npm/npm_packages_index.json" | ||
| packageUrl = "https://registry.npmjs.org/%1$s/-/%1$s-%2$s.tgz" | ||
| concurrentTasksCount = 30 | ||
| } | ||
| } | ||
|
|
||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
core/src/main/scala/codesearch/core/config/CindexConfig.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package codesearch.core.config | ||
|
|
||
| case class CindexConfig( | ||
| indexDir: String, | ||
| tempIndexDir: String, | ||
| packagesToIndexFile: String | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
core/src/main/scala/codesearch/core/config/SourcesFilesConfig.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package codesearch.core.config | ||
|
|
||
| case class SourcesFilesConfig( | ||
| testDirsNames: Set[String], | ||
| allowedFileNames: Set[String], | ||
| filesExtensions: FilesExtensionsConfig | ||
| ) | ||
|
|
||
| case class FilesExtensionsConfig( | ||
| commonExtensions: Set[String], | ||
| sourceExtensions: Set[String], | ||
| ) { def extensions: Set[String] = commonExtensions ++ sourceExtensions } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
core/src/main/scala/codesearch/core/db/FlywayMigration.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| package codesearch.core.db | ||
|
|
||
| import cats.effect.Sync | ||
| import codesearch.core.config.DatabaseConfig | ||
| import org.flywaydb.core.Flyway | ||
|
|
||
| object FlywayMigration { | ||
| def migrate[F[_]: Sync](config: DatabaseConfig): F[Unit] = Sync[F].delay { | ||
| Flyway | ||
| .configure() | ||
| .dataSource( | ||
| config.properties.url, | ||
| config.user, | ||
| config.password | ||
| ) | ||
| .load() | ||
| .migrate() | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package codesearch.core.db | ||
|
|
||
| import cats.effect.{Async, ContextShift, Resource} | ||
| import codesearch.core.config.DatabaseConfig | ||
| import doobie.hikari.HikariTransactor | ||
| import doobie.util.ExecutionContexts | ||
|
|
||
| object Transactor { | ||
| def create[F[_]: Async: ContextShift](config: DatabaseConfig): Resource[F, HikariTransactor[F]] = { | ||
| import config._ | ||
| for { | ||
| connectEC <- ExecutionContexts.fixedThreadPool[F](32) | ||
| transactionEC <- ExecutionContexts.cachedThreadPool[F] | ||
| xa <- HikariTransactor.newHikariTransactor( | ||
| properties.driver, | ||
| properties.url, | ||
| user, | ||
| password, | ||
| connectEC, | ||
| transactionEC | ||
| ) | ||
| } yield xa | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to https?