Skip to content

Commit

Permalink
Modifier code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gvonness authored Aug 6, 2023
1 parent 693f149 commit ad93cc4
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ align.tokens = [{code = "="}, {code = "<-"}, {code = ":="}, {code = "->"}, {code
continuationIndent.callSite = 2
continuationIndent.defnSite = 2
optIn.breakChainOnFirstMethodDot = true
rewrite.rules = [SortModifiers]
rewrite.sortModifiers.order = [
"implicit", "final", "sealed", "abstract",
"override", "private", "protected", "lazy"
]

spaces {
inImportCurlyBraces = true
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ThisBuild / baseVersion := "0.9.3"
ThisBuild / baseVersion := "0.9.4"

ThisBuild / organization := "ai.entrolution"
ThisBuild / organizationName := "Greg von Nessi"
Expand Down
8 changes: 3 additions & 5 deletions src/main/scala/bengal/stm/STM.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package bengal.stm
import bengal.stm.api.internal.TxnApiContext
import bengal.stm.model._
import bengal.stm.model.runtime._
import bengal.stm.runtime.{TxnCompilerContext, TxnLogContext, TxnRuntimeContext}
import bengal.stm.runtime.{ TxnCompilerContext, TxnLogContext, TxnRuntimeContext }

import cats.effect.Ref
import cats.effect.kernel.Async
Expand Down Expand Up @@ -103,16 +103,14 @@ object STM {

val txnRuntime: TxnRuntime = new TxnRuntime {
override val scheduler: TxnScheduler =
TxnScheduler(graphBuilderSemaphore = graphBuilderSemaphore,
retrySemaphore = retrySemaphore
)
TxnScheduler(graphBuilderSemaphore = graphBuilderSemaphore, retrySemaphore = retrySemaphore)
}

override def allocateTxnVar[V](value: V): F[TxnVar[F, V]] =
TxnVar.of(value)(this, this.asyncF)

override def allocateTxnVarMap[K, V](
valueMap: Map[K, V]
valueMap: Map[K, V]
): F[TxnVarMap[F, K, V]] =
TxnVarMap.of(valueMap)(this, this.asyncF)

Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/bengal/stm/model/AsyncImplicits.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ package bengal.stm.model

import cats.effect.kernel.Async

private[stm] abstract class AsyncImplicits[F[_]](
protected implicit val asyncF: Async[F]
abstract private[stm] class AsyncImplicits[F[_]](implicit
protected val asyncF: Async[F]
)
2 changes: 1 addition & 1 deletion src/main/scala/bengal/stm/model/TxnErratum.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package ai.entrolution
package bengal.stm.model

private[stm] sealed trait TxnErratum
sealed private[stm] trait TxnErratum

object TxnErratum {
private[stm] case object TxnRetry extends TxnErratum
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/bengal/stm/model/TxnStateEntity.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private[stm] trait TxnStateEntity[F[_], V] {
// Note: We run this through a deterministic UUID mapping
// to mitigate the chance of increment-based IDs colliding
// with bare hash codes
private[stm] final lazy val runtimeId: TxnVarRuntimeId =
final private[stm] lazy val runtimeId: TxnVarRuntimeId =
TxnVarRuntimeId(UUID.nameUUIDFromBytes(id.toString.getBytes).hashCode())
protected def value: Ref[F, V]
private[stm] def commitLock: Semaphore[F]
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/bengal/stm/runtime/TxnLogContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import scala.annotation.nowarn
private[stm] trait TxnLogContext[F[_]] {
this: AsyncImplicits[F] =>

private[stm] sealed trait TxnLogEntry[V] {
sealed private[stm] trait TxnLogEntry[V] {
private[stm] def get: V
private[stm] def set(value: V): TxnLogEntry[V]
private[stm] def commit: F[Unit]
Expand Down Expand Up @@ -287,7 +287,7 @@ private[stm] trait TxnLogContext[F[_]] {
}
}

private[stm] sealed trait TxnLog { self =>
sealed private[stm] trait TxnLog { self =>

private[stm] def getVar[V](txnVar: TxnVar[F, V]): F[(TxnLog, V)]

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/bengal/stm/runtime/TxnRuntimeContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ private[stm] trait TxnRuntimeContext[F[_]] {
private[stm] val txnIdGen: Ref[F, TxnId]
private[stm] val txnVarIdGen: Ref[F, TxnVarId]

private[stm] sealed trait TxnResult
sealed private[stm] trait TxnResult
private[stm] case class TxnResultSuccess[V](result: V) extends TxnResult

private[stm] case object TxnResultRetry extends TxnResult
Expand Down

0 comments on commit ad93cc4

Please sign in to comment.