text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>y for cases * where fine-grained control over fiber scheduling is required. */ case object CooperativeYielding extends RuntimeFlag { final val index = 7 final val mask = 1 << index final val notMask = ~mask } /** * The work stealing flag determines whether threads running ...
fim
zio/zio
scala
/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_suffix|>ond(second00) val end = endOfSecond(second00) val interval = Interval(start, end) ZIO.succeed(((end, n + 1), n, Decision.Continue(interval))) } } /** * Cron-like schedule that recurs every specified `minute` of each hour. It * triggers at zero second...
fim
zio/zio
scala
/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_suffix|>tKey: Long, finalizers: LongMap[Finalizer]) extends State } /** * A `ReleaseMap` represents the finalizers associated with a scope. * * The design of `ReleaseMap` is inspired by ResourceT, written by Michael * Snoyman @snoyberg. * (https://github.com/snoyberg/conduit/blob/master/resour...
fim
zio/zio
scala
<|fim_suffix|>latMap { case (scope, _) => scope.close(Exit.unit) } final def get(implicit trace: Trace): UIO[A] = ref.get.map(_._2) final def set[R, E](acquire: ZIO[R with Scope, E, A])(implicit trace: Trace): ZIO[R, E, Unit] = ref.modifyZIO { case (oldScope, a) => ZIO.uninterrupti...
fim
zio/zio
scala
<|fim_suffix|> @tailrec def loop( n: Long, state: Either[ScalaQueue[(Promise[Nothing, Unit], Long)], Long], acc: UIO[Any] ): (UIO[Any], Either[ScalaQueue[(Promise[Nothing, Unit], Long)], Long]) = state match { case Right(permits...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the <|fim_suffix|>ngImplicits.disableAutoTrace final case class StackTrace( fiberId: FiberId, stackTrace: Chunk[Trace] ) { self => def ++(that: StackTrace): StackTrace = if ((self eq that) || self.isEmpty) that else if (that.isEmpty) self e...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2020-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>lue. */ def envOrElse(variable: => String, alt: => String)(implicit trace: Trace ): IO[SecurityException, String] = ZIO.systemWith(_.envOrElse(variable, alt)) /** * Retrieves the value of an environment variable or else returns the * specified optional fallback value. */ def e...
fim
zio/zio
scala
<|fim_prefix|>package zio import zio.internal.FiberRuntime import zio.stacktracer.TracingImplicits.disableAutoTrace import java.util.concurrent.atomic.AtomicReference sealed trait ThreadLocalBridge { def makeFiberRef[A](initialValue: A)(link: A => Unit): ZIO[Scope, Nothing, FiberRef[A]] } object ThreadLocalBridge...
fim
zio/zio
scala
/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * <|fim_suffix|>1") def unsafeCompat[A](f: Unsafe ...
fim
zio/zio
scala
<|fim_suffix|> (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), Z, (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, Z) ] = new Unzippable[(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S), Z] { type In = (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, Z) ...
fim
zio/zio
scala
package zio // Kept for compatibility purposes only private trait UpdateRuntimeFlagsWithinPlatformSpecific {} <|endoftext|>
fim
zio/zio
scala
<|fim_suffix|>/ new ConcurrentHashMap[(LightTypeTag, LightTypeTag), java.lang.Boolean](1024) private val taggedServices: ConcurrentHashMap[LightTypeTag, Set[LightTypeTag]] = new ConcurrentHashMap[LightTypeTag, Set[LightTypeTag]](256) private sealed trait BoxedBool { self => final def value: Boolean = ...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>re { if (ZIOApp.installedSignals.compareAndSet(false, true)) { val dumpFibers = () => runtime.unsafe.run(Fiber.dumpAll)(trace, Unsafe.unsafe).getOrThrowFiberFailure()(Unsafe.unsafe) if (!System.os.isWindows) { Platform.addSignalHandler("INFO", dumpFibers)(Unsafe....
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICEN<|fim_suffix...
fim
zio/zio
scala
<|fim_suffix|> <|fim_prefix|>/* * Copyright 2021-2024 John A. D<|fim_middle|>e Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.o...
fim
zio/zio
scala
<|fim_suffix|> UpperA1] ): ZIOAspect[LowerR1, UpperR1, LowerE1, UpperE1, LowerA1, UpperA1] = self.andThen(that) /** * Returns a new aspect that represents the sequential composition of this * aspect with the specified one. */ def @@[ LowerR1 >: LowerR, UpperR1 <: UpperR, LowerE1 >: Lower...
fim
zio/zio
scala
<|fim_prefix|>package zio /** * A `ZIOFunctionConstructor[Input]` knows how to construct a `ZIO` value from a * function of type `In`. This allows the type of the `ZIO` value constructed to * depend on `In`. */ sealed abstract class ZIOFunctionConstructor[In] { /** * The type of the `ZIO` value. */ type...
fim
zio/zio
scala
<|fim_suffix|> while (count != -1) { countTotalBytes = countTotalBytes + count buffer.write(data, 0, count); data = new Array[Byte](bufferSize) count = is.read(data, 0, data.length) } ZIO.succeed(Chunk.fromArray(buffer.toByteArray()).t...
fim
zio/zio
scala
<|fim_suffix|>ool is returned in a * `Scope`, which governs the lifetime of the pool. When the pool is shutdown * because the `Scope` is closed, the individual items allocated by the pool * will be released in some unspecified order. * * The size of the underlying pools can be configured per key. */ ...
fim
zio/zio
scala
<|fim_suffix|>h C with D with E with F with G with H with I with J with K, Nothing, L ]] = new FunctionConstructor[(A, B, C, D, E, F, G, H, I, J, K) => L] { type Out = ZLayer[A with B with C with D with E with F with G with H with I with J with K, Nothing, L] def apply(f: (A, B, C,...
fim
zio/zio
scala
<|fim_prefix|>package zio import zio.stacktracer.TracingImplicits.disableAutoTrace trait ZLayerAspect[+LowerRIn, -UpperRIn, +LowerE, -UpperE, +LowerROut, -UpperROut] { self => def apply[RIn >: LowerRIn <: UpperRIn, E >: LowerE <: UpperE, ROut >: LowerROut <: UpperROut]( layer: ZLayer[RIn, E, ROut] )(implicit...
fim
zio/zio
scala
<|fim_suffix|>t.next().renderInto(sb, nowMillis)(Unsafe) } } val parsedTrace = Trace.parseOrNull(trace) if (parsedTrace ne null) { sb.append(" location=") appendQuoted(parsedTrace.location, sb) sb.append(" file=") appendQuoted(parsedTrace.file, sb) sb.append(" line=").ap...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2020-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * <|fim_suffix|>eAutoTrace import java.io.IOExcep...
fim
zio/zio
scala
/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you <|fim_suffix|>d { for { fiberRef <- FiberRef.makePatch(state, differ) } yield new ZState[State] { def get(implicit trace: Trace): UIO[...
fim
zio/zio
scala
<|fim_prefix|>package zio import zio.stacktracer.TracingImplicits.disableAutoTrace trait Zippable[-A, -B] { type Out def zip(left: A, right: B): Out def discardsLeft: Boolean = false def discardsRight: Boolean = false } object Zippable extends ZippableLowPriority1 { type Out[-A, -B, C] = Zippable[...
fim
zio/zio
scala
<|fim_suffix|>e var segmentIndex: Int = 0 private var referenceIndex: Int = 0 private var references: Array[RefNode[V]] = _ private var reference: RefNode[V] = _ private var nextElement: V = null.asInstanceOf[V] private var lastElement: V =...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>List[A] = listModule.cons(a, self) def dropWhile(p: A => Boolean): List[A] = if (isEmpty) List.Nil else { val h = head val t = tail if (p(h)) t.dropWhile(p) else self } def exists(p: A => Boolean): Boolean = if (isEmpty) false else p...
fim
zio/zio
scala
<|fim_suffix|>rivate[zio] object FiberMessage { final case class InterruptSignal(cause: Cause[Nothing]) extends FiberMessage final case class Stateful(onFiber: FiberRuntime[_, _] => Unit) extends FiberMessage final case class Resume(effect: ZIO[_, _, _]) extends FiberMessage @deprecated...
fim
zio/zio
scala
<|fim_suffix|>lags(runtimeFlags) val trace = renderTrace(trace0) s"Suspended($flags, $trace)" } } <|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance ...
fim
zio/zio
scala
<|fim_suffix|>e def run(depth: Int): Unit } <|fim_prefix|>package zio.internal import zio._ import zio.stac<|fim_middle|>ktracer.TracingImplicits.disableAutoTrace private[zio] trait FiberRunnable extends Runnable { def location: Trac<|endoftext|>
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>nt ne null) { // Parent is not GC'd. Let's check to see if the parent is the current // fiber: if (currentFiber eq parent) { // The parent is the current fiber so it is safe to directly add the // child to the parent: parent.addChildren(children) ...
fim
zio/zio
scala
<|fim_suffix|>from the hub. */ def size(): Int /** * Unsubscribes this subscriber from the hub. */ def unsubscribe(): Unit } private def nextPow2(n: Int): Int = { val nextPow = (math.log(n.toDouble) / math.log(2.0)).ceil.toInt math.pow(2, nextPow.toDouble).toInt.max(2) } } <|f...
fim
zio/zio
scala
<|fim_suffix|>.1.21") val empty: Patch = Empty private final case class Add(isFatal: IsFatal) extends Patch private final case class AndThen(first: Patch, second: Patch) extends Patch private case object Empty extends Patch private final case...
fim
zio/zio
scala
<|fim_suffix|>aximum''' number of elements that a queue can hold. * * @note * that unbounded queues can still implement this interface with `capacity = * MAX_INT`. */ val capacity: Int /** * A non-blocking enqueue. * * @return * whether the enqueue was successful or not. */ de...
fim
zio/zio
scala
<|fim_suffix|> OneElementConcurrentQueue.ref * 20 4 java.util.concurrent.atomic.LongAdder OneElementConcurrentQueue.deqAdder * Instance size: 24 bytes * Space losses: 0 bytes internal + 0 bytes external = 0 bytes total */ // format: on private[zio] final class OneElementConcurrentQueue[A] extends M...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ object Platform extends PlatformSpecific <...
fim
zio/zio
scala
<|fim_suffix|>the specific language governing permissions and * limitations under the License. */ package zio.internal import zio.stacktracer.TracingImplicits.disableAutoTrace private[zio] final class RingBufferArb[A] private (capacity: Int) extends RingBuffer[A](capacity) { protected def posToIdx(pos: Long, cap...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2018-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>roup[Tuple1[Int]] = null } <|fim_prefix|>package zio.internal private[zio] object Special<|fim_middle|>izationHelpers { final val SpecializeInt: Specializable.G<|endoftext|>
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>permissions and * limitations under the License. */ package zio.internal import zio._ import scala.collection.mutable.ArrayBuilder import scala.reflect.ClassTag private[zio] class StackTraceBuilder private () { self => private[this] val builder = new ArrayBuilder.ofRef()(ClassTag.AnyRef.asInstance...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. <|fim_suffix|>cense for the specific language governing permissions and * limitations under the License. */ package zio.internal import zio.stacktracer.TracingImplicits.disableAutoTrace /** * This can be used whenever an arbitrary number of unique keys needs to be ...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright <|fim_suffix|>rst && oldIdx != last) { fs = fs.updated(oldIdx, Tombstone(next - oldIdx)) } new UpdateOrderLinkedMap(fs :+ key, underlying.updated(key, Entry(fs.length, value))).maybeReindex() } } /** * Rebuilds the underlying vector and map, removing tombst...
fim
zio/zio
scala
<|fim_suffix|> ref.get() if ((value ne null) && isAlive(value)) graduates.add(ref) i += 1 } } /** * Returns a weakly consistent iterator over the bag. This iterator will never * throw exceptions even in the presence of concurrent modifications. */ final def iterator: Iterator[A] = { ...
fim
zio/zio
scala
<|fim_suffix|>addMetrics) new AtomicLong(0) else null private[this] val dequeuedCounter = if (addMetrics) new AtomicLong(0) else null override def size(): Int = jucConcurrentQueue.size() override def enqueuedCount(): Long = if (enqueuedCounter ne null) enqueuedCounter.get() else 0L override def dequeuedCount...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2018-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of th<|fim_suffix|>ty } def poll(random: ThreadLocalRandom): A = { ...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2018-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_prefix|>package zio.internal.macros /** * DummyK is used to pull `WeakTypeTag` information into a Macro when there is * otherwise no value to extract it<|fim_suffix|>keImpl]] */ private[zio] final case class DummyK[A]() private[zio] object DummyK { private val singleton: DummyK[Any] = DummyK() implicit d...
fim
zio/zio
scala
<|fim_suffix|> Graph(nodes.map(_.map(f)), keyEquals, unknownLayerFactory(_).map(_.map(f))) private val nodeWithOutputCache = new java.util.HashMap[Key, Option[Node[Key, A]]] private def getNodeWithOutput[E](output: Key, error: => E): Either[::[E], Node[Key, A]] = nodeWithOutputCache.computeIfAbsent(output, f...
fim
zio/zio
scala
<|fim_suffix|>ependency[Key, A](node: Node[Key, A], dependency: Key): GraphError[Key, A] = MissingTransitiveDependencies(node, Chunk(dependency)) case class MissingTransitiveDependencies[+Key, +A](node: Node[Key, A], dependency: Chunk[Key]) extends GraphError[Key, A] case class MissingTopLevelDependency...
fim
zio/zio
scala
<|fim_prefix|>package zio.internal.macros import zio.ZLayer.Debug import zio._ import zio.internal.TerminalRendering import zio.internal.TerminalRendering.LayerWiringError import zio.internal.ansi.AnsiStringOps import java.nio.charset.StandardCharsets import java.util.Base64 import scala.collection.mutable.ListBuffer...
fim
zio/zio
scala
<|fim_suffix|>Nothing] final case class Value[+A](value: A) extends LayerTree[A] final case class ComposeH[+A](left: LayerTree[A], right: LayerTree[A]) extends LayerTree[A] final case class ComposeV[+A](left: LayerTree[A], right: LayerTree[A]) extends LayerTree[A] implicit fin...
fim
zio/zio
scala
<|fim_suffix|>(value)) } <|fim_prefix|>package zio.internal.macros final case clas<|fim_middle|>s Node[+Key, +A](inputs: List[Key], outputs: List[Key], value: A) { def map[B](f: A => B): Node[Key, B] = copy(value = f<|endoftext|>
fim
zio/zio
scala
<|fim_prefix|>package zio.internal.macros import zio.internal.ansi.{AnsiStringOps, Color} private[macros] sealed trait RenderedGraph { self => def ++(that: RenderedGraph): RenderedGraph def >>>(that: RenderedGraph): RenderedGraph def render(depth: Int): String def render: String = render(0) } private[macros]...
fim
zio/zio
scala
<|fim_suffix|>f .split("\n") .zipAll(that.split("\n"), "", "") .map { case (a, b) => a ++ b } .mkString("\n") } } <|fim_prefix|>package zio.internal.macros import scala.util.Try private[zio] ob<|fim_middle|>ject StringUtils { private val UnstyledRegex = "\u001B\\[[;\\d]*m".r imp...
fim
zio/zio
scala
package zio.internal.metrics import zio.metrics._ private[zio] trait ConcurrentMetricHooks { def counter(key: MetricKey.Counter): MetricHook.Counter def gauge(key: MetricKey.Gauge, startAt: Double): MetricHook.Gauge def histogram(key: MetricKey.Histogram): MetricHook.Histogram def summary(key: MetricKey.Su...
fim
zio/zio
scala
<|fim_prefix|>package zio.internal.metrics import zio._ import zio.metrics._ import java.time.Instant import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.atomic.AtomicReference import scala.annotation.tailrec private[zio] class ConcurrentMetricRegistry { private val listenersRef: AtomicRefer...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>Hook[Double, MetricState.Counter] type Gauge = MetricHook[Double, MetricState.Gauge] type Histogram = MetricHook[Double, MetricState.Histogram] type Summary = MetricHook[(Double, java.time.Instant), MetricState.Summary] type Frequency = MetricHook[String, MetricState.Frequency] } <|fim_prefi...
fim
zio/zio
scala
<|fim_prefix|>package zio.internal import zio.Chunk import zio.stacktracer.TracingImplicits.disableAutoTrace import scala.annotation.tailrec package object metrics { private[zio] val metricRegistry: ConcurrentMetricRe<|fim_suffix|>Some(value)) } } } } } <|fim_middle|>gistry = new Concurren...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
/* * Copyright 2020-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_suffix|>Some(description0) } } <|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at <|fim_middle|> * ...
fim
zio/zio
scala
<|fim_suffix|>the License for the specific language governing permissions and * limitations under the License. */ package zio.metrics import zio._ import zio.stacktracer.TracingImplicits.disableAutoTrace sealed trait MetricKeyType { type In type Out } object MetricKeyType { type WithIn[T] = MetricKeyType { ...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2020-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>cKeyType.Gauge], value: Double)(implicit unsafe: Unsafe): Unit def updateFrequency(key: MetricKey[MetricKeyType.Frequency], value: String)(implicit unsafe: Unsafe): Unit def updateSummary(key: MetricKey[MetricKeyType.Summary], value: Double, instant: java.time.Instant)(implicit unsafe: Unsafe ):...
fim
zio/zio
scala
/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2020-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may<|fim_suffix|>pected states. */ sealed trait MetricState[+Type] object MetricState { ty...
fim
zio/zio
scala
<|fim_suffix|>st.sortBy(_.key) "tags[" + byName.map(l => s"${l.key}: ${l.value}").mkString(", ") + "]" } } <|fim_prefix|>package zio.metrics import zio.{IO, Trace, UIO} import java.io.IOException final case class Metrics private[zio] (metrics: Set[MetricPair.Untyped]) { /** * Gets all current metrics in...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2022-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2017-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Ap<|fim_suffix|>for the specific language governing permissions and * limitations under the License. */ import zio.TagVersionSpecific import zio.internal.stacktracer.Tracer import zio.stacktracer.TracingImplicit...
fim
zio/zio
scala
<|fim_suffix|> See [[[zio.stm.ZSTM.validate[R,E,A,B](in:zio\.NonEmptyChunk*]]] */ def validate[E, A, B](in: NonEmptyChunk[A])( f: A => STM[E, B] )(implicit ev: CanFail[E]): STM[::[E], NonEmptyChunk[B]] = ZSTM.validate(in)(f) /** * @see * See [[zio.stm.ZSTM.validateFirst]] */ def validat...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>c ++ bs :+ b) } } else ZSTM.succeedNow(acc ++ bs) } takeRemainder(min, max, Chunk.empty) } /** * Takes the specified number of elements from the queue. If there are fewer * than the specified number of elements available, it retries un...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2021-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_suffix|>= TRef .make(data.foldLeft(SortedMap.empty[A, ::[A]])((map, a) => map.updated(a, map.get(a).fold(::(a, Nil))(::(a, _))))) .map(ref => new TPriorityQueue(ref)) /** * Makes a new `TPriorityQueue` that is initialized with specified values. */ def make[A](data: A*)(implicit ord: Ord...
fim
zio/zio
scala
<|fim_suffix|>ect { case Some(e) => STM.fromEither(e) }.flatten def done(v: Either[E, A]): USTM[Boolean] = ref.get.flatMap { case Some(_) => STM.succeedNow(false) case None => ref.set(Some(v)) *> STM.succeedNow(true) } def fail(e: E): USTM[Boolean] = done(Left(e)) def poll:...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala
<|fim_suffix|>M[Nothing, Float] ): USTM[Float] = if (minInclusive >= maxExclusive) STM.die(new IllegalArgumentException("invalid bounds")) else nextFloat.map { n => val result = n * (maxExclusive - minInclusive) + minInclusive if (result < maxExclusive) result else Math.nex...
fim
zio/zio
scala
/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless requir...
fim
zio/zio
scala
<|fim_suffix|> ZSTM.succeed(unsafe.make(a)(Unsafe.unsafe)) /** * A convenience method that makes a `TRef` and immediately commits the * transaction to extract the value out. */ def makeCommit[A](a: => A)(implicit trace: Trace): UIO[TRef[A]] = STM.atomically(make(a)) object unsafe { def make[...
fim
zio/zio
scala
<|fim_suffix|>phore] = make(permits).commit object unsafe { def make(permits: Long)(implicit unsafe: Unsafe): TSemaphore = new TSemaphore(TRef.unsafeMake(permits)) } } <|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0...
fim
zio/zio
scala
<|fim_suffix|>> STM[E, Unit]): STM[E, Unit] = foldSTM(())((_, a) => f(a)) /** * Atomically transforms the set into the intersection of itself and the * provided set. */ def intersect(other: TSet[A]): USTM[Unit] = other.toSet.flatMap(vals => retainIfDiscard(vals.contains)) /** * Stores new el...
fim
zio/zio
scala
<|fim_suffix|> /** * Abort and retry the whole transaction when any of the underlying * transactional variables have changed. */ val retry: USTM[Nothing] = Effect((_, _, _) => throw RetryException) /** * Returns an effect with the value on the right part. */ def right[A](a: => A): USTM[Either[N...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyri<|fim_suffix|>+A] = ZSTM[Any, E, A] type USTM[+A] = ZSTM[Any, Nothing, A] type TaskSTM[+A] = ZSTM[Any, Throwable, A] } <|fim_middle|>ght 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * Copyright 2013-2021 Miles Sabin * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.ap...
fim
zio/zio
scala
<|fim_prefix|>/* * Copyright 2019-2024 John A. De Goes and the ZIO Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * *...
fim
zio/zio
scala