GitHub - lprakashv/scala-utils: Utilities for Scala (original) (raw)

GitHub Test Badge Coverage Badge

scala-utils

My personal collection of Scala utilities and rewrite of an existing data structure or a pattern.

Packages and their descriptions:

collections [todo: take out as library in another module]

resiliency [todo: take out as library in another module]

Usage:

val myCircuit = new Circuit[Int]( "sample-circuit", 5, 5.seconds, 1, -1 )

def doThingAndReturnInt: Int = ??? //method to wrap

def doThingAndReturnIntF: Future[Int] = ??? //async method to wrap

myCircuit.execute(doThingAndReturnInt)

myCircuit.executeAsync(doThingAndReturnIntF)

myCircuit.execute { val x = 23 //.. do something here ??? val y = getAndIntRandomly() x / y }

//others methods like

implict val circuit: Circuit[T] = ???

(f: => R).execute

(ff: => Future[R]).executeAsync

//another circuit to be applied on similar blocks val circuit2: Circuit[T] = ???

(f: => R)(circuit2).execute

(ff: => Future[R])(circuit2).executeAsync

commons

files

strings

TODOs: