Bulk transactional storage, roughly equivalent to Array[Ref[T]]
but
potentially much more space efficient. Elements can be read and written
directly, or the refs
method can be used to obtain transient Ref
instances backed by the elements of the TArray
.
Bulk transactional storage, roughly equivalent to Array[Ref[T]]
but
potentially much more space efficient. Elements can be read and written
directly, or the refs
method can be used to obtain transient Ref
instances backed by the elements of the TArray
.
- Authors
Nathan Bronson
- Companion
- object
Value members
Abstract methods
Performs a transactional read of the index
th element of this
transactional array. Equivalent to refs(index).get
.
Performs a transactional read of the index
th element of this
transactional array. Equivalent to refs(index).get
.
Returns the length of this TArray
, which does not change.
Returns the length of this TArray
, which does not change.
Returns a sequence of Ref
instances that are backed by elements of this
TArray
. All operations on the contained Ref
s are supported.
Returns a sequence of Ref
instances that are backed by elements of this
TArray
. All operations on the contained Ref
s are supported.
As an example, the following code tests whether a(i)
is greater than
10 without requiring the transaction to roll back for all writes to
a(i)
:
atomic { implicit t =>
if (a.refs(i).getWith( _ > 10 )) {
... lots of stuff
}
}
Inherited methods
Returns a string representation of the transactional value in this
instance for debugging convenience. The Ref
reads (and writes)
performed while constructing the result will be discarded before
returning. This method works fine outside a transaction.
Returns a string representation of the transactional value in this
instance for debugging convenience. The Ref
reads (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.
- Inherited from
- TxnDebuggable
Returns some value that is suitable for examination in a debugger,
or returns a Txn.RollbackCause
if called from inside a doomed atomic
block.
Returns some value that is suitable for examination in a debugger,
or returns a Txn.RollbackCause
if called from inside a doomed atomic
block.
- Inherited from
- TxnDebuggable