trait DataSource[-R, -A] extends AnyRef
A DataSource[R, A] requires an environment R and is capable of executing
requests of type A.
Data sources must implement the method runAll which takes a collection of
requests and returns an effect with a CompletedRequestMap containing a
mapping from requests to results. The type of the collection of requests is
a Chunk[Chunk[A]]. The outer Chunk represents batches of requests that
must be performed sequentially. The inner Chunk represents a batch of
requests that can be performed in parallel. This allows data sources to
introspect on all the requests being executed and optimize the query.
Data sources will typically be parameterized on a subtype of Request[A],
though that is not strictly necessarily as long as the data source can map
the request type to a Request[A]. Data sources can then pattern match on
the collection of requests to determine the information requested, execute
the query, and place the results into the CompletedRequestsMap using
CompletedRequestMap.empty and CompletedRequestMap.insert. Data
sources must provide results for all requests received. Failure to do so
will cause a query to die with a QueryFailure when run.
- Self Type
- DataSource[R, A]
- Alphabetic
- By Inheritance
- DataSource
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
val
identifier: String
The data source's identifier.
-
abstract
def
runAll(requests: Chunk[Chunk[A]]): ZIO[R, Nothing, CompletedRequestMap]
Execute a collection of requests.
Execute a collection of requests. The outer
Chunkrepresents batches of requests that must be performed sequentially. The innerChunkrepresents a batch of requests that can be performed in parallel.
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
batchN(n: Int): DataSource[R, A]
Returns a data source that executes at most
nrequests in parallel. -
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
contramap[B](f: Described[(B) ⇒ A]): DataSource[R, B]
Returns a new data source that executes requests of type
Busing the specified function to transformBrequests into requests that this data source can execute. -
final
def
contramapM[R1 <: R, B](f: Described[(B) ⇒ ZIO[R1, Nothing, A]]): DataSource[R1, B]
Returns a new data source that executes requests of type
Busing the specified effectual function to transformBrequests into requests that this data source can execute. -
final
def
eitherWith[R1 <: R, B, C](that: DataSource[R1, B])(f: Described[(C) ⇒ Either[A, B]]): DataSource[R1, C]
Returns a new data source that executes requests of type
Cusing the specified function to transformCrequests into requests that either this data source or that data source can execute. -
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
equals(that: Any): Boolean
- Definition Classes
- DataSource → AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
hashCode(): Int
- Definition Classes
- DataSource → AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
provide(r: Described[R])(implicit ev: NeedsEnv[R]): DataSource[Any, A]
Provides this data source with its required environment.
-
final
def
provideSome[R0](f: Described[(R0) ⇒ R])(implicit ev: NeedsEnv[R]): DataSource[R0, A]
Provides this data source with part of its required environment.
-
final
def
race[R1 <: R, A1 <: A](that: DataSource[R1, A1]): DataSource[R1, A1]
Returns a new data source that executes requests by sending them to this data source and that data source, returning the results from the first data source to complete and safely interrupting the loser.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
final
def
toString(): String
- Definition Classes
- DataSource → AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()