public abstract class CacheableData<T extends CacheBlock> extends Data
null
to allow Java garbage collection. If other parts of the system continue
keep references to the cache block, its eviction will not release any memory.Modifier and Type | Class and Description |
---|---|
static class |
CacheableData.CacheStatus
Defines all possible cache status types for a data blob.
|
Modifier and Type | Field and Description |
---|---|
static String |
cacheEvictionLocalFilePath |
static String |
cacheEvictionLocalFilePrefix |
static boolean |
CACHING_ASYNC_FILECLEANUP |
static boolean |
CACHING_BUFFER_PAGECACHE |
static LazyWriteBuffer.RPolicy |
CACHING_BUFFER_POLICY |
static double |
CACHING_BUFFER_SIZE |
static String |
CACHING_COUNTER_GROUP_NAME |
static String |
CACHING_EVICTION_FILEEXTENSION |
static long |
CACHING_THRESHOLD |
static boolean |
CACHING_WRITE_CACHE_ON_READ |
Modifier and Type | Method and Description |
---|---|
T |
acquireModify(T newData)
Acquires the exclusive "write" lock for a thread that wants to throw away the
old cache block data and link up with new cache block data.
|
T |
acquireRead()
Acquires a shared "read-only" lock, produces the reference to the cache block,
restores the cache block to main memory, reads from HDFS if needed.
|
T |
acquireReadAndRelease() |
static void |
addBroadcastSize(long size) |
static void |
cleanupCacheDir() |
static void |
cleanupCacheDir(boolean withDir)
Deletes the DML-script-specific caching working dir.
|
void |
clearData() |
void |
clearData(long tid)
Sets the cache block reference to
null , abandons the old block. |
static void |
disableCaching() |
static void |
enableCaching() |
void |
enableCleanup(boolean flag)
Enables or disables the cleanup of the associated
data object on clearData().
|
void |
exportData() |
void |
exportData(int replication)
Writes, or flushes, the cache block data to HDFS.
|
void |
exportData(String fName,
String outputFormat) |
void |
exportData(String fName,
String outputFormat,
FileFormatProperties formatProperties) |
void |
exportData(String fName,
String outputFormat,
int replication,
FileFormatProperties formatProperties) |
void |
exportData(String fName,
String outputFormat,
int replication,
FileFormatProperties formatProperties,
String opcode)
Synchronized because there might be parallel threads (parfor local) that
access the same object (in case it was created before the loop).
|
void |
freeEvictedBlob()
Low-level cache I/O method that deletes the file containing the
evicted data blob, without reading it.
|
BroadcastObject<T> |
getBroadcastHandle() |
static long |
getBroadcastSize() |
DataCharacteristics |
getDataCharacteristics() |
long |
getDataSize() |
String |
getDebugName() |
FederationMap |
getFedMapping()
Gets the mapping of indices ranges to federated objects.
|
FileFormatProperties |
getFileFormatProperties() |
String |
getFileName() |
GPUObject |
getGPUObject(GPUContext gCtx) |
MetaData |
getMetaData() |
long |
getNumColumns() |
long |
getNumRows() |
RDDObject |
getRDDHandle() |
CacheableData.CacheStatus |
getStatus() |
long |
getUniqueID() |
static void |
initCaching()
Inits caching with the default uuid of DMLScript
|
static void |
initCaching(String uuid)
Creates the DML-script-specific caching working dir.
|
boolean |
isCached(boolean inclCachedNoWrite) |
static boolean |
isCachingActive() |
boolean |
isCleanupEnabled()
Indicates if cleanup of the associated data object
is enabled on clearData().
|
boolean |
isDirty()
true if the in-memory or evicted matrix may be different from
the matrix located at _hdfsFileName ; false if the two
matrices are supposed to be the same. |
boolean |
isFederated()
Check if object is federated.
|
boolean |
isFederated(FederationMap.FType type) |
boolean |
isHDFSFileExists() |
boolean |
moveData(String fName,
String outputFormat) |
abstract void |
refreshMetaData() |
void |
release()
Releases the shared ("read-only") or exclusive ("write") lock.
|
void |
removeMetaData() |
void |
setBroadcastHandle(BroadcastObject bc) |
void |
setDirty(boolean flag) |
void |
setEmptyStatus() |
void |
setFedMapping(FederationMap fedMapping)
Sets the mapping of indices ranges to federated objects.
|
void |
setFileFormatProperties(FileFormatProperties props) |
void |
setFileName(String file) |
void |
setGPUObject(GPUContext gCtx,
GPUObject gObj) |
void |
setHDFSFileExists(boolean flag) |
void |
setMetaData(MetaData md) |
void |
setRDDHandle(RDDObject rdd) |
String |
toString() |
getDataType, getPrivacyConstraint, getValueType, setPrivacyConstraints, updateDataCharacteristics
public static final long CACHING_THRESHOLD
public static final double CACHING_BUFFER_SIZE
public static final LazyWriteBuffer.RPolicy CACHING_BUFFER_POLICY
public static final boolean CACHING_BUFFER_PAGECACHE
public static final boolean CACHING_WRITE_CACHE_ON_READ
public static final String CACHING_COUNTER_GROUP_NAME
public static final String CACHING_EVICTION_FILEEXTENSION
public static final boolean CACHING_ASYNC_FILECLEANUP
public static String cacheEvictionLocalFilePath
public static String cacheEvictionLocalFilePrefix
public void enableCleanup(boolean flag)
flag
- true if cleanuppublic boolean isCleanupEnabled()
public CacheableData.CacheStatus getStatus()
public boolean isHDFSFileExists()
public void setHDFSFileExists(boolean flag)
public String getFileName()
public long getUniqueID()
public void setFileName(String file)
public boolean isDirty()
true
if the in-memory or evicted matrix may be different from
the matrix located at _hdfsFileName
; false
if the two
matrices are supposed to be the same.public void setDirty(boolean flag)
public FileFormatProperties getFileFormatProperties()
public void setFileFormatProperties(FileFormatProperties props)
public void setMetaData(MetaData md)
setMetaData
in class Data
public MetaData getMetaData()
getMetaData
in class Data
public void removeMetaData()
removeMetaData
in class Data
public DataCharacteristics getDataCharacteristics()
public long getNumRows()
public long getNumColumns()
public abstract void refreshMetaData()
public boolean isFederated()
public boolean isFederated(FederationMap.FType type)
public FederationMap getFedMapping()
public void setFedMapping(FederationMap fedMapping)
fedMapping
- mappingpublic RDDObject getRDDHandle()
public void setRDDHandle(RDDObject rdd)
public BroadcastObject<T> getBroadcastHandle()
public void setBroadcastHandle(BroadcastObject bc)
public GPUObject getGPUObject(GPUContext gCtx)
public void setGPUObject(GPUContext gCtx, GPUObject gObj)
public T acquireReadAndRelease()
public T acquireRead()
public T acquireModify(T newData)
newData
- new datapublic void release()
public void clearData()
public void clearData(long tid)
null
, abandons the old block.
Makes the "envelope" empty. Run it to finalize the object (otherwise the
evicted cache block file may remain undeleted).
In-Status: EMPTY, EVICTABLE, EVICTED;
Out-Status: EMPTY.tid
- thread IDpublic void exportData()
public void exportData(int replication)
replication
- ?public void exportData(String fName, String outputFormat, FileFormatProperties formatProperties)
public void exportData(String fName, String outputFormat, int replication, FileFormatProperties formatProperties)
public void exportData(String fName, String outputFormat, int replication, FileFormatProperties formatProperties, String opcode)
fName
- file nameoutputFormat
- formatreplication
- ?formatProperties
- file format propertiesopcode
- instruction opcode if availablepublic final void freeEvictedBlob()
public long getDataSize()
public String getDebugName()
getDebugName
in class Data
public boolean isCached(boolean inclCachedNoWrite)
public void setEmptyStatus()
public static void addBroadcastSize(long size)
public static long getBroadcastSize()
public static void cleanupCacheDir()
public static void cleanupCacheDir(boolean withDir)
withDir
- if true, delete directorypublic static void initCaching() throws IOException
IOException
- if IOException occurspublic static void initCaching(String uuid) throws IOException
uuid
- IDIOException
- if IOException occurspublic static boolean isCachingActive()
public static void disableCaching()
public static void enableCaching()
Copyright © 2020 The Apache Software Foundation. All rights reserved.