trait Source[+A] extends SourceLike[A, InTxn] with TxnDebuggable
Source[+A] consists of the covariant read-only operations of Ref[A].
- Alphabetic
- By Inheritance
- Source
- TxnDebuggable
- SourceLike
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
get(implicit txn: InTxn): A
Performs a transactional read and checks that it is consistent with all reads already made by
txn.Performs a transactional read and checks that it is consistent with all reads already made by
txn. Equivalent toapply(), which is more concise in many situations.- txn
an active transaction.
- returns
the value of the
Refas observed bytxn.
- Definition Classes
- SourceLike
- Exceptions thrown
IllegalStateExceptioniftxnis not active.
-
abstract
def
getWith[Z](f: (A) ⇒ Z)(implicit txn: InTxn): Z
Returns
f(get), possibly reevaluatingfto avoid rollback if a conflicting change is made but the old and new values are equal after application off.Returns
f(get), possibly reevaluatingfto avoid rollback if a conflicting change is made but the old and new values are equal after application off. Requires thatf(x) == f(y)ifx == y.getWith(f)is equivalent tof(relaxedGet({ f(_) == f(_) })), although perhaps more efficient.- f
an idempotent function.
- returns
the result of applying
fto the value contained in thisRef.
- Definition Classes
- SourceLike
-
abstract
def
relaxedGet(equiv: (A, A) ⇒ Boolean)(implicit txn: InTxn): A
Returns the same value as
get, but allows the caller to determine whethertxnshould be rolled back if another thread changes the value of thisRefbeforetxnis committed.Returns the same value as
get, but allows the caller to determine whethertxnshould be rolled back if another thread changes the value of thisRefbeforetxnis committed. Ifref.relaxedGet(equiv)returnsv0intxn, another context changesreftov1, andequiv(v0, v1) == true, thentxnwon't be required to roll back (at least not due to this read). If additional changes are made torefadditional calls to the equivalence function will be made, always withv0as the first parameter.equivwill always be invoked on the current thread. Extreme care should be taken if the equivalence function accesses anyRefs.As an example, to perform a read that will not be validated during commit you can use the maximally permissive equivalence function:
val unvalidatedValue = ref.relaxedGet({ (_, _) => true })
To check view serializability rather than conflict serializability for a read:
val viewSerializableValue = ref.relaxedGet({ _ == _ })The
getWithmethod provides related functionality.- equiv
an equivalence function that returns true if a transaction that observed the first argument will still complete correctly, where the second argument is the actual value that should have been observed.
- returns
a value of the
Ref, not necessary consistent with the rest of the reads performed bytxn.
- Definition Classes
- SourceLike
-
abstract
def
single: View[A]
See
Ref.single.
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
-
def
apply()(implicit txn: InTxn): A
Performs a transactional read and checks that it is consistent with all reads already made by
txn.Performs a transactional read and checks that it is consistent with all reads already made by
txn. Equivalent toget.Example:
val x = Ref(0) atomic { implicit t => ... val v = x() // perform a read inside a transaction ... }
- txn
an active transaction.
- returns
the value of the
Refas observed bytxn.
- Definition Classes
- SourceLike
- Exceptions thrown
IllegalStateExceptioniftxnis not active.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
dbgStr: String
Returns a string representation of the transactional value in this instance for debugging convenience.
Returns a string representation of the transactional value in this instance for debugging convenience. The
Refreads (and writes) performed while constructing the result will be discarded before returning. This method works fine outside a transaction.If this method is called from within a transaction that is already doomed (status
Txn.Rolledback), a string describing the reason for the outer transaction's rollback will be returned.- Definition Classes
- Source → TxnDebuggable
-
def
dbgValue: Any
Returns some value that is suitable for examination in a debugger, or returns a
Txn.RollbackCauseif called from inside a doomed atomic block.Returns some value that is suitable for examination in a debugger, or returns a
Txn.RollbackCauseif called from inside a doomed atomic block.- Definition Classes
- Source → TxnDebuggable
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- 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
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- 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( ... )