Interface IMediaCacheItem


  • public interface IMediaCacheItem
    IMediaCacheItem
    • 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 writes
      long blockSize()
      Get the block size configured for this item
      void close()
      Close the item
      void decPendingWriteCount()
      Decrement the pending write count
      boolean exists()
      Return if the item exists
      long getBlockCount()
      Get the block count
      com.wowza.wms.mediacache.model.MediaCacheBlockPtr getBlockPtr​(long offset, long length)
      Get a block pointer for the offset and length given
      long getBlockSize()
      Get the block size for the item
      com.wowza.wms.mediacache.model.MediaCacheItemInfo getInfo()
      Get the MediaCacheItemInfo object for this item
      String getLocalPath()
      Get the local path for the item
      int getLockCount()
      Get the current lock count
      long getMaxTimeToLive()
      Get the maximum time to live for the item
      IMediaCacheSource getMediaCacheSource()
      Gets the MediaCache source for the item
      java.io.File getMediaFile()
      Get the file pointed to for this CacheItem
      String getMediaName()
      Get the MediaName for this item
      long getMinTimeToLive()
      Get the minimum time to live for the item
      long getPendingWriteCount()
      Get the pending write count
      com.wowza.wms.mediacache.model.MediaCacheBlockPtr getPendingWrites​(long blockId)
      Get the block from the list of pending writes
      IMediaCacheStoreItem getStoreItem()
      Get the store item object for this item
      IMediaCacheStoreItem getStoreItem​(boolean doLoad)
      Get the item from the store.
      edu.emory.mathcs.backport.java.util.concurrent.locks.WMSReadWriteLock getSyncLock()
      Get the WMSReadWriteLock object
      void incPendingWriteCount()
      Increment the pending write count
      boolean init​(String mediaName, IMediaCacheStoreItem storeItem)
      Initialize the item
      boolean isBlockInCache​(long block)
      Check if the block needed is already cached
      boolean isLocal()
      Return if the item is local
      boolean isReadAheadTrigger​(long pos, int threshold)
      Determine if the read ahead should occur
      long lastModified()
      Get the last modified time of the item
      long length()
      Get the length of the item
      int lock()
      Add to lock count for item
      long posToBlock​(long pos)
      Convert the position given into a block number
      void preload()
      Start the readahead system
      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
      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
      void readAhead()
      Read ahead for all pending read ahead objects
      com.wowza.wms.mediacache.model.MediaCacheBlockPtr removePendingWrites​(long blockId)
      Remove the block from list of pending writes
      void saveBlock​(com.wowza.wms.mediacache.model.MediaCacheBlockPtr blockPtr)
      Save the block provided by the block pointer object
      void setLastModified​(long lastModified)
      Set the last modified time of the item
      void setLastRelease​(long lastRelease)
      Set the last release time of the item
      void setLength​(long length)
      Set the length of the item
      void setLocal​(boolean isLocal)
      Set if the item is local
      void setLocalPath​(String localPath)
      Set the local path for the item
      void setMaxTimeToLive​(long maxTimeToLive)
      Set the maximum time to live for the item
      void setMediaCacheSource​(IMediaCacheSource mediaCacheSource)
      Sets the MediaCache source for the item
      void setMediaName​(String name)
      Set the MediaName for this item
      void setMinTimeToLive​(long minTimeToLive)
      Set the minimum time to live for the item
      void setReadAheadCount​(int readAheadCount)
      Set the number of blocks to get on readhead
      void tiggerReadAhead​(long pos)
      Cause a read ahead
      int unlock()
      Remove from lock count from item
      boolean validate()
      Validate this item
      boolean validate​(java.util.Properties props)
      Validate this item with your own properties
    • 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