Skip to content

Commit

Permalink
removing unused code from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Nov 15, 2023
1 parent 2315cf5 commit 280b3fe
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions src/main/scala/scorex/core/utils/utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,6 @@ import scala.util.{Failure, Success, Try}

package object utils {

@deprecated("Use scorex.util.ScorexLogging instead.", "scorex-util 0.1.0")
type ScorexLogging = scorex.util.ScorexLogging

/**
* @param block - function to profile
* @return - execution time in seconds and function result
*/
def profile[R](block: => R): (Float, R) = {
val t0 = System.nanoTime()
val result = block // call-by-name
val t1 = System.nanoTime()
((t1 - t0).toFloat / 1000000000, result)
}

def toTry(b: Boolean, msg: String): Try[Unit] = b match {
case true => Success(Unit)
case false => Failure(new Exception(msg))
}

@tailrec
final def untilTimeout[T](timeout: FiniteDuration,
delay: FiniteDuration = 100.milliseconds)(fn: => T): T = {
Expand Down Expand Up @@ -58,22 +39,6 @@ package object utils {
result
}

def concatFixLengthBytes(seq: Traversable[Array[Byte]]): Array[Byte] = seq.headOption match {
case None => Array[Byte]()
case Some(head) => concatFixLengthBytes(seq, head.length)
}


def concatFixLengthBytes(seq: Traversable[Array[Byte]], length: Int): Array[Byte] = {
val result: Array[Byte] = new Array[Byte](seq.toSeq.length * length)
var index = 0
seq.foreach { s =>
Array.copy(s, 0, result, index, length)
index += length
}
result
}

implicit class MapPimp[K, V](underlying: Map[K, V]) {
/**
* One liner for updating a Map with the possibility to handle case of missing Key
Expand Down

0 comments on commit 280b3fe

Please sign in to comment.