Read-only
DataAxesFormats.ReadOnly
—
Module
Read-only
Daf
storage format.
Arrays
Daf
access operations return a read-only result; this allows
Daf
to cache results for efficiency, which is important when getting the data is slow (e.g., accessing disk data or aggregating data). If you want to modify such results, you need to explicitly create a copy. TODO: Explicitly support the concept of in-place modifications of data in
Daf
(building on the memory-mapped implementation).
The read-only array functions below are restricted to dealing with normal (dense) arrays,
SparseArrays
,
NamedArrays
, and
LinearAlgebra
arrays (specifically,
Transpose
and
Adjoint
), as these are the types actually used in
Daf
storage. YMMV if using more exotic matrix types. In theory you could extend the implementation to cover such types as well.
DataAxesFormats.ReadOnly.read_only_array
—
Function
read_only_array(array::AbstractArray):AbstractArray
Return an immutable view of an
array
. This uses
SparseArrays.ReadOnly
, and properly deals with
NamedArray
. If the array is already immutable, it is returned as-is.
DataAxesFormats.ReadOnly.is_read_only_array
—
Function
is_read_only_array(array::AbstractArray)::Bool
Return whether an
array
is immutable.
Data
DataAxesFormats.ReadOnly.DafReadOnly
—
Type
A common base type for a read-only
DafReader
, which doesn't allow any modification of the data.
DataAxesFormats.ReadOnly.read_only
—
Function
read_only(daf::DafReader[; name::Maybe{AbstractString]} = nothing)::DafReadOnlyWrapper
Wrap
daf
with a
DafReadOnlyWrapper
to protect it against accidental modification. If not specified, the
name
of the
daf
is reused. If
name
is not specified and
daf
isa
DafReadOnly
, return it as-is.
DataAxesFormats.ReadOnly.DafReadOnlyWrapper
—
Type