Package com.wowza.wms.mediacache.model
Interface IMediaCacheItem
-
public interface IMediaCacheItem
IMediaCacheItem
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPS_ITEM_LASTMODIFIED
static String
PROPS_ITEM_LENGTH
static String
PROPS_ITEM_MEDIANAME
static String
PROPS_SOURCE_BLOCKSIZE
static String
PROPS_SOURCE_NAME
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPendingWrites(com.wowza.wms.mediacache.model.MediaCacheBlockPtr blockPtr)
Add the block to the list of pending writeslong
blockSize()
Get the block size configured for this itemvoid
close()
Close the itemvoid
decPendingWriteCount()
Decrement the pending write countboolean
exists()
Return if the item existslong
getBlockCount()
Get the block countcom.wowza.wms.mediacache.model.MediaCacheBlockPtr
getBlockPtr(long offset, long length)
Get a block pointer for the offset and length givenlong
getBlockSize()
Get the block size for the itemcom.wowza.wms.mediacache.model.MediaCacheItemInfo
getInfo()
Get the MediaCacheItemInfo object for this itemString
getLocalPath()
Get the local path for the itemint
getLockCount()
Get the current lock countlong
getMaxTimeToLive()
Get the maximum time to live for the itemIMediaCacheSource
getMediaCacheSource()
Gets the MediaCache source for the itemjava.io.File
getMediaFile()
Get the file pointed to for this CacheItemString
getMediaName()
Get the MediaName for this itemlong
getMinTimeToLive()
Get the minimum time to live for the itemlong
getPendingWriteCount()
Get the pending write countcom.wowza.wms.mediacache.model.MediaCacheBlockPtr
getPendingWrites(long blockId)
Get the block from the list of pending writesIMediaCacheStoreItem
getStoreItem()
Get the store item object for this itemIMediaCacheStoreItem
getStoreItem(boolean doLoad)
Get the item from the store.edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock
getSyncLock()
Get the WMSReadWriteLock objectvoid
incPendingWriteCount()
Increment the pending write countboolean
init(String mediaName, IMediaCacheStoreItem storeItem)
Initialize the itemboolean
isBlockInCache(long block)
Check if the block needed is already cachedboolean
isLocal()
Return if the item is localboolean
isReadAheadTrigger(long pos, int threshold)
Determine if the read ahead should occurlong
lastModified()
Get the last modified time of the itemlong
length()
Get the length of the itemint
lock()
Add to lock count for itemlong
posToBlock(long pos)
Convert the position given into a block numbervoid
preload()
Start the readahead systemlong
read(com.wowza.wms.mediacache.model.MediaCacheReadContext readContext, long foffset, byte[] buffer, long boffset, long length)
Reads data using the read context and returns the byte count readcom.wowza.wms.mediacache.model.MediaCacheReadResult
read(com.wowza.wms.mediacache.model.MediaCacheReadContext readContext, long foffset, long length)
Reads data using the read context and returns a MediaCacheReadResult objectvoid
readAhead()
Read ahead for all pending read ahead objectscom.wowza.wms.mediacache.model.MediaCacheBlockPtr
removePendingWrites(long blockId)
Remove the block from list of pending writesvoid
saveBlock(com.wowza.wms.mediacache.model.MediaCacheBlockPtr blockPtr)
Save the block provided by the block pointer objectvoid
setLastModified(long lastModified)
Set the last modified time of the itemvoid
setLastRelease(long lastRelease)
Set the last release time of the itemvoid
setLength(long length)
Set the length of the itemvoid
setLocal(boolean isLocal)
Set if the item is localvoid
setLocalPath(String localPath)
Set the local path for the itemvoid
setMaxTimeToLive(long maxTimeToLive)
Set the maximum time to live for the itemvoid
setMediaCacheSource(IMediaCacheSource mediaCacheSource)
Sets the MediaCache source for the itemvoid
setMediaName(String name)
Set the MediaName for this itemvoid
setMinTimeToLive(long minTimeToLive)
Set the minimum time to live for the itemvoid
setReadAheadCount(int readAheadCount)
Set the number of blocks to get on readheadvoid
tiggerReadAhead(long pos)
Cause a read aheadint
unlock()
Remove from lock count from itemboolean
validate()
Validate this itemboolean
validate(java.util.Properties props)
Validate this item with your own properties
-
-
-
Field Detail
-
PROPS_ITEM_LENGTH
static final String PROPS_ITEM_LENGTH
- See Also:
- Constant Field Values
-
PROPS_ITEM_LASTMODIFIED
static final String PROPS_ITEM_LASTMODIFIED
- See Also:
- Constant Field Values
-
PROPS_ITEM_MEDIANAME
static final String PROPS_ITEM_MEDIANAME
- See Also:
- Constant Field Values
-
PROPS_SOURCE_NAME
static final String PROPS_SOURCE_NAME
- See Also:
- Constant Field Values
-
PROPS_SOURCE_BLOCKSIZE
static final String PROPS_SOURCE_BLOCKSIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getMediaCacheSource
IMediaCacheSource getMediaCacheSource()
Gets the MediaCache source for the item- Returns:
- IMediaCacheSource
-
setMediaCacheSource
void setMediaCacheSource(IMediaCacheSource mediaCacheSource)
Sets the MediaCache source for the item- Parameters:
mediaCacheSource
-
-
lock
int lock()
Add to lock count for item- Returns:
- int
-
unlock
int unlock()
Remove from lock count from item- Returns:
- int
-
getLockCount
int getLockCount()
Get the current lock count- Returns:
- int
-
getSyncLock
edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock getSyncLock()
Get the WMSReadWriteLock object- Returns:
- WMSReadWriteLock
-
init
boolean init(String mediaName, IMediaCacheStoreItem storeItem)
Initialize the item- Parameters:
mediaName
-storeItem
-- Returns:
- boolean - false failed to init, true success
-
close
void close()
Close the item
-
getBlockPtr
com.wowza.wms.mediacache.model.MediaCacheBlockPtr getBlockPtr(long offset, long length)
Get a block pointer for the offset and length given- Parameters:
offset
-length
-- Returns:
- MediaCacheBlockPtr
-
saveBlock
void saveBlock(com.wowza.wms.mediacache.model.MediaCacheBlockPtr blockPtr)
Save the block provided by the block pointer object- Parameters:
blockPtr
-
-
readAhead
void readAhead()
Read ahead for all pending read ahead objects
-
getMediaFile
java.io.File getMediaFile()
Get the file pointed to for this CacheItem- Returns:
- File
-
isBlockInCache
boolean isBlockInCache(long block)
Check if the block needed is already cached- Parameters:
block
-- Returns:
- boolean - cached is true, not cached false
-
blockSize
long blockSize()
Get the block size configured for this item- Returns:
- long
-
validate
boolean validate()
Validate this item- Returns:
- boolean - valid is true, not valid is false
-
validate
boolean validate(java.util.Properties props)
Validate this item with your own properties- Parameters:
props
-- Returns:
- boolean - valid is true, not valid is false
-
getInfo
com.wowza.wms.mediacache.model.MediaCacheItemInfo getInfo()
Get the MediaCacheItemInfo object for this item- Returns:
- MediaCacheItemInfo
-
getMediaName
String getMediaName()
Get the MediaName for this item- Returns:
- String
-
setMediaName
void setMediaName(String name)
Set the MediaName for this item- Parameters:
name
-
-
getStoreItem
IMediaCacheStoreItem getStoreItem()
Get the store item object for this item- Returns:
- IMediaCacheStoreItem
-
getStoreItem
IMediaCacheStoreItem getStoreItem(boolean doLoad)
Get the item from the store. If doLoad is set to true or the item is already loaded then the item is returned, otherwise a new store item is returned- Parameters:
doLoad
-- Returns:
- IMediaCacheStoreItem
-
addPendingWrites
void addPendingWrites(com.wowza.wms.mediacache.model.MediaCacheBlockPtr blockPtr)
Add the block to the list of pending writes- Parameters:
blockPtr
-
-
removePendingWrites
com.wowza.wms.mediacache.model.MediaCacheBlockPtr removePendingWrites(long blockId)
Remove the block from list of pending writes- Parameters:
blockId
-- Returns:
- MediaCacheBlockPtr
-
getPendingWrites
com.wowza.wms.mediacache.model.MediaCacheBlockPtr getPendingWrites(long blockId)
Get the block from the list of pending writes- Parameters:
blockId
-- Returns:
- MediaCacheBlockPtr
-
incPendingWriteCount
void incPendingWriteCount()
Increment the pending write count
-
decPendingWriteCount
void decPendingWriteCount()
Decrement the pending write count
-
getPendingWriteCount
long getPendingWriteCount()
Get the pending write count- Returns:
- long
-
getMinTimeToLive
long getMinTimeToLive()
Get the minimum time to live for the item- Returns:
- long
-
setMinTimeToLive
void setMinTimeToLive(long minTimeToLive)
Set the minimum time to live for the item- Parameters:
minTimeToLive
-
-
getMaxTimeToLive
long getMaxTimeToLive()
Get the maximum time to live for the item- Returns:
- long
-
setMaxTimeToLive
void setMaxTimeToLive(long maxTimeToLive)
Set the maximum time to live for the item- Parameters:
maxTimeToLive
-
-
getBlockSize
long getBlockSize()
Get the block size for the item- Returns:
- long
-
getBlockCount
long getBlockCount()
Get the block count- Returns:
- long
-
isReadAheadTrigger
boolean isReadAheadTrigger(long pos, int threshold)
Determine if the read ahead should occur- Parameters:
pos
-threshold
-- Returns:
- boolean - readahead true, no readahead false
-
tiggerReadAhead
void tiggerReadAhead(long pos)
Cause a read ahead- Parameters:
pos
-
-
setReadAheadCount
void setReadAheadCount(int readAheadCount)
Set the number of blocks to get on readhead- Parameters:
readAheadCount
-
-
posToBlock
long posToBlock(long pos)
Convert the position given into a block number- Parameters:
pos
-- Returns:
- long
-
preload
void preload()
Start the readahead system
-
getLocalPath
String getLocalPath()
Get the local path for the item- Returns:
- String
-
setLocalPath
void setLocalPath(String localPath)
Set the local path for the item- Parameters:
localPath
-
-
isLocal
boolean isLocal()
Return if the item is local- Returns:
- boolean - local is true, not local is false
-
setLocal
void setLocal(boolean isLocal)
Set if the item is local- Parameters:
isLocal
-
-
exists
boolean exists()
Return if the item exists- Returns:
- boolean - exists is true, does not exist is false
-
length
long length()
Get the length of the item- Returns:
- long
-
setLength
void setLength(long length)
Set the length of the item- Parameters:
length
-
-
lastModified
long lastModified()
Get the last modified time of the item- Returns:
- long
-
setLastModified
void setLastModified(long lastModified)
Set the last modified time of the item- Parameters:
lastModified
-
-
setLastRelease
void setLastRelease(long lastRelease)
Set the last release time of the item- Parameters:
lastRelease
-
-
read
long read(com.wowza.wms.mediacache.model.MediaCacheReadContext readContext, long foffset, byte[] buffer, long boffset, long length)
Reads data using the read context and returns the byte count read- Parameters:
readContext
-foffset
-buffer
-boffset
-length
-- Returns:
- long
-
read
com.wowza.wms.mediacache.model.MediaCacheReadResult read(com.wowza.wms.mediacache.model.MediaCacheReadContext readContext, long foffset, long length)
Reads data using the read context and returns a MediaCacheReadResult object- Parameters:
readContext
-foffset
-length
-- Returns:
- MediaCacheReadResult
-
-