-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1049 from Cryptonomic/fix-build-indexing
Range indexing and project build fixes
- Loading branch information
Showing
9 changed files
with
113 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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 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
33 changes: 33 additions & 0 deletions
33
conseil-lorre/src/main/scala/tech/cryptonomic/conseil/indexer/config/ConfigUtil.scala
This file contains 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,33 @@ | ||
package tech.cryptonomic.conseil.indexer.config | ||
|
||
import com.github.ghik.silencer.silent | ||
import pureconfig.generic.EnumCoproductHint | ||
import scopt.Read | ||
|
||
import scala.util.Try | ||
|
||
private[config] object ConfigUtil { | ||
|
||
object Depth { | ||
implicit class DepthOps(val value: String) { | ||
def toDepth = value match { | ||
case "-1" | "all" | "everything" => Some(Everything) | ||
case "0" | "new" | "newest" => Some(Newest) | ||
case Natural(n) => Some(Custom(n)) | ||
case _ => None | ||
} | ||
} | ||
|
||
/* used by scopt to parse the depth object */ | ||
@silent("private val depthRead in object ConfigUtil is never used") | ||
implicit val depthRead: Read[Option[Depth]] = Read.reads(_.toDepth) | ||
@silent("local val depthHint in object ConfigUtil is never used") | ||
implicit val depthHint: EnumCoproductHint[Depth] = new EnumCoproductHint[Depth] | ||
} | ||
|
||
/** Used to pattern match on natural numbers */ | ||
object Natural { | ||
def unapply(s: String): Option[Int] = Try(s.toInt).filter(_ > 0).toOption | ||
} | ||
|
||
} |
This file contains 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 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 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 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 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 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