Package org.apache.flink.runtime.blob
Class BlobCacheSizeTracker
- java.lang.Object
-
- org.apache.flink.runtime.blob.BlobCacheSizeTracker
-
public class BlobCacheSizeTracker extends Object
BlobCacheSizeTracker usesLinkedHashMap
to maintain the LRU order for the files in the cache. When new files are intended to be put into cache,checkLimit
is called to query the files should be removed. This tracker maintains a lock to avoid concurrent modification. To avoid the inconsistency, make sure that hold the READ/WRITE lock inPermanentBlobCache
first and then hold the lock here.
-
-
Field Summary
Fields Modifier and Type Field Description protected long
sizeLimit
-
Constructor Summary
Constructors Constructor Description BlobCacheSizeTracker(long sizeLimit)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey>>
checkLimit(long size)
Check the size limit and return the BLOBs to delete.void
track(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, long size)
Register the BLOB to the tracker.void
untrack(org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey> key)
Remove the BLOB from the tracker.void
untrackAll(org.apache.flink.api.common.JobID jobId)
Unregister all the tracked BLOBs related to the given job.void
update(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)
Update the least used index for the BLOBs so that the tracker can easily find out the least recently used BLOBs.
-
-
-
Method Detail
-
checkLimit
public List<org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey>> checkLimit(long size)
Check the size limit and return the BLOBs to delete.- Parameters:
size
- size of the BLOB intended to put into the cache- Returns:
- list of BLOBs to delete before putting into the target BLOB
-
track
public void track(org.apache.flink.api.common.JobID jobId, BlobKey blobKey, long size)
Register the BLOB to the tracker.
-
untrack
public void untrack(org.apache.flink.api.java.tuple.Tuple2<org.apache.flink.api.common.JobID,BlobKey> key)
Remove the BLOB from the tracker.
-
update
public void update(org.apache.flink.api.common.JobID jobId, BlobKey blobKey)
Update the least used index for the BLOBs so that the tracker can easily find out the least recently used BLOBs.
-
untrackAll
public void untrackAll(org.apache.flink.api.common.JobID jobId)
Unregister all the tracked BLOBs related to the given job.
-
-