Package io.antmedia.datastore.db
Class DataStore
java.lang.Object
io.antmedia.datastore.db.DataStore
- Direct Known Subclasses:
InMemoryDataStore
,MapBasedDataStore
,MongoStore
-
Field Summary
Modifier and TypeFieldDescriptionprotected AppSettings
We have appSettings fields because we need to refect the changes on the flyprotected boolean
private long
protected static org.slf4j.Logger
static final int
private static final int
private static final int
static final String
static final long
private long
protected int
protected long
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
abstract boolean
addEndpoint
(String id, Endpoint endpoint) void
addQueryTime
(long queryTimeNanoSec) Add query time in nanosecondsabstract boolean
addSubscriber
(String streamId, Subscriber subscriber) adds subscriber to the datastore for this streamboolean
addSubscriberConnectionEvent
(String streamId, String subscriberId, ConnectionEvent event) sets the connection status of the subscriber in the datastoreabstract boolean
addSubTrack
(String mainTrackId, String subTrackId) Deprecated, for removal: This API element is subject to removal in a future version.no need to use this method, logic has changed and we use directly getSubtracks, getActiveSubtracks.abstract String
Add VoD record to the datastoreabstract boolean
blockSubscriber
(String streamId, String subscriberId, String blockedType, int seconds) blocks subscribe from playing or publishingstatic ConferenceRoom
broadcastToConference
(Broadcast broadcast) This is a helper method to remove the ConferenceRoom in later versions May 11, 2024 - mekyaabstract void
clearStreamInfoList
(String streamId) Remove the stream info list from dbabstract void
close
(boolean deleteDB) Closes the databasestatic Broadcast
conferenceToBroadcast
(ConferenceRoom conferenceRoom) static BroadcastUpdate
conferenceUpdateToBroadcastUpdate
(ConferenceRoom conferenceRoom) This is a helper method to remove the ConferenceRoom in later versions May 11, 2024 - mekyaabstract boolean
Creates new P2PConnectionabstract boolean
abstract boolean
deleteP2PConnection
(String streamId) Deletes a P2PConnectionabstract boolean
deleteSubscriber
(String streamId, String subscriberId) deletes subscriber from the datastore for this streamabstract boolean
deleteToken
(String tokenId) Delete specific tokenabstract boolean
abstract boolean
deleteWebRTCViewerInfo
(String viewerId) This is used to delete a WebRTC Viewer Info from datastoreabstract int
fetchUserVodList
(File filedir) Gets the video files under thefileDir
directory parameter and saves them to the datastore as USER_VOD inVod
classabstract Broadcast
Return the broadcast in data storeabstract long
Return the number of active broadcasts in the serverlong
getActiveBroadcastCount
(Map<String, String> broadcastMap, com.google.gson.Gson gson, String hostAddress) getActiveBroadcastList
(Map<String, String> broadcastMap, com.google.gson.Gson gson, String hostAddress) getActiveSubtracks
(String mainTrackId, String role) Get of active subtracks.abstract long
getActiveSubtracksCount
(String mainTrackId, String role) Get the count of active subtracks.long
Calculate total query time in millisecondsabstract long
Deprecated.long
getBroadcastCount
(Map<String, String> broadcastMap) getBroadcastList
(int offset, int size, String type, String sortBy, String orderBy, String search) Returns the Broadcast List in orderprotected static List<ConnectionEvent>
getConnectionEventListFromCollection
(Collection<ConnectionEvent> values, String streamId) Simple converter from Collection to Listabstract List<ConnectionEvent>
getConnectionEvents
(String streamId, String subscriberId, int offset, int size) Get connection events for a specific streamId and subscriberId ConnectionEvents are recorded ifAppSettings.isWriteSubscriberEventsToDatastore()
is trueabstract List<TensorFlowObject>
getDetection
(String id) getDetection
(Map<String, String> detectionMap, String id, com.google.gson.Gson gson) abstract List<TensorFlowObject>
getDetectionList
(String idFilter, int offsetSize, int batchSize) getDetectionList
(Map<String, String> detectionMap, String idFilter, int offsetSize, int batchSize, com.google.gson.Gson gson) long
Get executed query count.abstract long
getLocalLiveBroadcastCount
(String hostAddress) getLocalLiveBroadcasts
(String hostAddress) abstract long
getObjectDetectedTotal
(String streamId) Returns the total number of detected objects in the streamlong
getObjectDetectedTotal
(Map<String, String> detectionMap, String streamId, com.google.gson.Gson gson) abstract P2PConnection
getP2PConnection
(String streamId) Get the P2PConnection by streamIdabstract long
getPartialBroadcastNumber
(String search) Returns the number of broadcasts which contains searched stringabstract long
getPartialVodNumber
(String search) Returns the number of vods which contains searched stringabstract List<StreamInfo>
getStreamInfoList
(String streamId) Returns stream info list added to dbabstract Subscriber
getSubscriber
(String streamId, String subscriberId) gets subscriber from the datastoregetSubscriber
(Map<String, String> subscriberMap, String streamId, String subscriberId, com.google.gson.Gson gson) abstract SubscriberMetadata
getSubscriberMetaData
(String subscriberId) Get subscriber metadataabstract long
getSubtrackCount
(String mainTrackId, String role, String status) Get the count of subtracksgetSubtracks
(String mainTrackId, int offset, int size, String role) Get the subtracks of the main trackgetSubtracks
(String mainTrackId, int offset, int size, String role, String status) Get the subtracks of the main trackabstract Token
retrieve specific tokenabstract long
long
getTotalBroadcastNumber
(Map<String, String> broadcastMap) abstract long
long
getTotalVodNumber
(Map<String, String> broadcastMap) abstract int
This is used to get total number of WebRTC viewersint
getTotalWebRTCViewersCount
(Map<String, String> broadcastMap, com.google.gson.Gson gson) abstract VoD
Return the vod by idgetVodList
(int offset, int size, String sortBy, String orderBy, String filterStreamId, String search) Returns the VoD List in ordergetVodListV2
(Map<String, String> vodMap, String streamId, String search, com.google.gson.Gson gson, String dbName) abstract List<WebRTCViewerInfo>
getWebRTCViewerList
(int offset, int size, String sortBy, String orderBy, String search) Get list of webrtc viewersgetWebRTCViewerList
(Map<String, String> webRTCViewerMap, int offset, int size, String sortBy, String orderBy, String search, com.google.gson.Gson gson) protected boolean
handleConnectionEvent
(String streamId, String subscriberId, ConnectionEvent event) abstract boolean
hasSubtracks
(String streamId) boolean
Return if data store is available.boolean
isSubscriberConnected
(String streamId, String subscriberId) gets the connection status of the subscriber from the datastoreabstract List<Subscriber>
listAllSubscribers
(String streamId, int offset, int size) Lists all subscribers of requested streamlistAllSubscribers
(Map<String, String> subscriberMap, String streamId, int offset, int size, com.google.gson.Gson gson) listAllSubscriberStats
(String streamId, int offset, int size) Lists all subscriber statistics of requested streamlistAllTokens
(String streamId, int offset, int size) Lists all tokens of requested streamlistAllTokens
(Map<String, String> tokenMap, String streamId, int offset, int size, com.google.gson.Gson gson) abstract void
Move ConferenceRoom to Broadcastabstract void
putSubscriberMetaData
(String subscriberId, SubscriberMetadata metadata) Put subscriber metadata.abstract boolean
abstract boolean
removeEndpoint
(String id, Endpoint endpoint, boolean checkRTMPUrl) abstract boolean
removeSubTrack
(String mainTrackId, String subTrackId) Deprecated, for removal: This API element is subject to removal in a future version.no need to use this method, logic has changed and we use directly getSubtracks, getActiveSubtracks.abstract int
resetBroadcasts
(String hostAddress) Resets the broadcasts in the database.abstract boolean
sets the connection status of all the subscribers false in the datastore called after an ungraceful shutdownabstract boolean
revokeSubscribers
(String streamId) deletes all subscriber from the datastore for this streamabstract boolean
revokeTokens
(String streamId) Delete all tokens of the streamabstract String
protected Broadcast
saveBroadcast
(Broadcast broadcast) abstract void
saveDetection
(String id, long timeElapsed, List<TensorFlowObject> detectedObjects) abstract void
saveStreamInfo
(StreamInfo streamInfo) Saves the stream info to the dbabstract boolean
saves token to storeabstract void
This is used to save WebRTC Viewer Info to datastoresearchOnServer
(ArrayList<Broadcast> broadcastList, String search) searchOnServerVod
(ArrayList<VoD> broadcastList, String search) Below search methods and sortandcrop methods are used for getting the searched items and sorting and pagination.protected ArrayList<WebRTCViewerInfo>
searchOnWebRTCViewerInfo
(ArrayList<WebRTCViewerInfo> list, String search) void
setAppSettings
(AppSettings appSettings) Setter for appSettingsabstract boolean
setMp4Muxing
(String streamId, int enabled) enables or disables mp4 muxing for the streamabstract boolean
setWebMMuxing
(String streamId, int enabled) enables or disables WebM muxing for the streamvoid
showWarningIfElapsedTimeIsMoreThanThreshold
(long elapsedNano, String methodName) sortAndCropBroadcastList
(List<Broadcast> broadcastList, int offset, int size, String sortBy, String orderBy) sortAndCropVodList
(List<VoD> vodList, int offset, int size, String sortBy, String orderBy) protected List<WebRTCViewerInfo>
sortAndCropWebRTCViewerInfoList
(List<WebRTCViewerInfo> list, int offset, int size, String sortBy, String orderBy) abstract boolean
updateBroadcastFields
(String streamId, BroadcastUpdate broadcast) Updates the Broadcast objects fields if it's not null.boolean
updateDASHViewerCount
(String streamId, int diffCount) Add or subtract the DASH viewer count from current valueprotected abstract boolean
updateDASHViewerCountLocal
(String streamId, int diffCount) boolean
updateHLSViewerCount
(String streamId, int diffCount) Add or subtract the HLS viewer count from current valueprotected abstract boolean
updateHLSViewerCountLocal
(String streamId, int diffCount) boolean
updateRtmpViewerCount
(String streamId, boolean increment) Update the RTMP viewer countprotected abstract boolean
updateRtmpViewerCountLocal
(String streamId, boolean increment) abstract boolean
updateStatus
(String id, String status) protected void
updateStreamInfo
(Broadcast broadcast, BroadcastUpdate newBroadcast) Updates the stream fields if it's not nullabstract boolean
updateStreamMetaData
(String streamId, String metaData) This is used to update meta data for a bradcastboolean
updateSubscriberBitrateEvent
(String streamId, String subscriberId, long avgVideoBitrate, long avgAudioBitrate) sets the avarage bitrate of the subscriber in the datastoreabstract boolean
updateVoDProcessStatus
(String id, String status) boolean
updateWebRTCViewerCount
(String streamId, boolean increment) Update the WebRTC viewer countprotected abstract boolean
updateWebRTCViewerCountLocal
(String streamId, boolean increment) abstract Token
validateToken
(Token token) Validates token
-
Field Details
-
QUERY_TIME_THRESHOLD_MS_SEC
private static final int QUERY_TIME_THRESHOLD_MS_SEC- See Also:
-
QUERY_TIME_THRESHOLD_NANO_SEC
private static final int QUERY_TIME_THRESHOLD_NANO_SEC- See Also:
-
MAX_ITEM_IN_ONE_LIST
public static final int MAX_ITEM_IN_ONE_LIST- See Also:
-
REPLACE_CHARS_REGEX
- See Also:
-
executedQueryCount
private long executedQueryCount -
totalQueryTimeNanoSec
private long totalQueryTimeNanoSec -
available
protected volatile boolean available -
logger
protected static org.slf4j.Logger logger -
appSettings
We have appSettings fields because we need to refect the changes on the fly -
TOTAL_WEBRTC_VIEWER_COUNT_CACHE_TIME
public static final long TOTAL_WEBRTC_VIEWER_COUNT_CACHE_TIME- See Also:
-
totalWebRTCViewerCount
protected int totalWebRTCViewerCount -
totalWebRTCViewerCountLastUpdateTime
protected long totalWebRTCViewerCountLastUpdateTime
-
-
Constructor Details
-
DataStore
public DataStore()
-
-
Method Details
-
save
-
saveBroadcast
-
get
Return the broadcast in data store- Parameters:
id
-- Returns:
- broadcast
-
get
-
getVoD
Return the vod by id- Parameters:
id
-- Returns:
- Vod object
-
getVoD
-
updateStatus
-
getPartialVodNumber
Returns the number of vods which contains searched string- Parameters:
search
- is used for searching in vodIds and names of the vods- Returns:
-
getPartialBroadcastNumber
Returns the number of broadcasts which contains searched string- Parameters:
search
- is used for searching in streamIds and names of the stream- Returns:
-
addEndpoint
-
addVod
Add VoD record to the datastore- Parameters:
vod
-- Returns:
- the id of the VoD if it's successful or it returns null if it's failed
-
getBroadcastCount
Deprecated.Use getTotalBroadcastNumber -
getBroadcastCount
-
delete
-
deleteVod
-
updateVoDProcessStatus
-
getBroadcastList
public abstract List<Broadcast> getBroadcastList(int offset, int size, String type, String sortBy, String orderBy, String search) Returns the Broadcast List in order- Parameters:
offset
- the number of items to skipsize
- batch sizetype
- can get "liveStream" or "ipCamera" or "streamSource" or "VoD" values. Default is getting all broadcast types.sortBy
- can get "name" or "date" or "status" valuesorderBy
- can get "desc" or "asc"search
- is used for searching in streamIds and names of the stream- Returns:
-
removeEndpoint
-
getExternalStreamsList
-
close
public abstract void close(boolean deleteDB) Closes the database- Parameters:
deleteDB
- if it's true, it also deletes the db and closes
-
getVodList
public abstract List<VoD> getVodList(int offset, int size, String sortBy, String orderBy, String filterStreamId, String search) Returns the VoD List in order- Parameters:
offset
- : the number of items to skipsize
- : batch sizesortBy
- can get "name" or "date" valuesorderBy
- can get "desc" or "asc"filterStreamId
- is used for filtering the vod by stream id. If it's null or empty, it's not usedsearch
- is used for searching in vodIds and names of the vods.- Returns:
-
getVodListV2
-
removeAllEndpoints
-
getTotalVodNumber
public abstract long getTotalVodNumber() -
getTotalVodNumber
-
getTotalBroadcastNumber
public abstract long getTotalBroadcastNumber() -
getTotalBroadcastNumber
-
saveDetection
public abstract void saveDetection(String id, long timeElapsed, List<TensorFlowObject> detectedObjects) -
getDetectionList
public abstract List<TensorFlowObject> getDetectionList(String idFilter, int offsetSize, int batchSize) -
getDetectionList
-
getDetection
-
getDetection
-
saveToken
saves token to store- Parameters:
token
- - created token- Returns:
- true/false
-
listAllTokens
Lists all tokens of requested stream- Parameters:
streamId
-offset
-size
-- Returns:
- lists of tokens
-
listAllTokens
-
validateToken
Validates token- Parameters:
token
-streamId
-- Returns:
- token if validated, null if not
-
revokeTokens
Delete all tokens of the stream- Parameters:
streamId
-
-
deleteToken
Delete specific token- Parameters:
tokenId
- id of the token
-
getToken
retrieve specific token- Parameters:
tokenId
- id of the token
-
getToken
-
listAllSubscribers
Lists all subscribers of requested stream- Parameters:
streamId
-offset
-size
-- Returns:
- lists of subscribers
-
listAllSubscribers
-
listAllSubscriberStats
Lists all subscriber statistics of requested stream- Parameters:
streamId
-offset
-size
-- Returns:
- lists of subscriber statistics
-
addSubscriber
adds subscriber to the datastore for this stream- Parameters:
streamId
-subscriber
- - subscriber to be added
-
deleteSubscriber
deletes subscriber from the datastore for this stream- Parameters:
streamId
-subscriberId
- - id of the subsciber to be deleted
-
blockSubscriber
public abstract boolean blockSubscriber(String streamId, String subscriberId, String blockedType, int seconds) blocks subscribe from playing or publishing- Parameters:
streamId
-subscriberId
- - id of the subsciber to be blockedblockedType
- - it can be the value of the static fieldSubscriber.PLAY_TYPE
,Subscriber.PUBLISH_TYPE
,Subscriber.PUBLISH_AND_PLAY_TYPE
publish, play, publish_playseconds
- - duration of seconds to block the user
-
revokeSubscribers
deletes all subscriber from the datastore for this stream- Parameters:
streamId
-
-
getSubscriber
gets subscriber from the datastore- Parameters:
streamId
-subscriberId
- - id of the subsciber to be deleted
-
getSubscriber
-
isSubscriberConnected
gets the connection status of the subscriber from the datastore- Parameters:
streamId
-subscriberId
- - id of the subscriber
-
addSubscriberConnectionEvent
public boolean addSubscriberConnectionEvent(String streamId, String subscriberId, ConnectionEvent event) sets the connection status of the subscriber in the datastore- Parameters:
streamId
-subscriberId
- - id of the subscriberevent
- - connection event which occured for this subscriber
-
handleConnectionEvent
protected boolean handleConnectionEvent(String streamId, String subscriberId, ConnectionEvent event) -
addConnectionEvent
-
updateSubscriberBitrateEvent
public boolean updateSubscriberBitrateEvent(String streamId, String subscriberId, long avgVideoBitrate, long avgAudioBitrate) sets the avarage bitrate of the subscriber in the datastore- Parameters:
streamId
-subscriberId
- - id of the subscriberevent
- - bitrate measurement event
-
resetSubscribersConnectedStatus
public abstract boolean resetSubscribersConnectedStatus()sets the connection status of all the subscribers false in the datastore called after an ungraceful shutdown -
setMp4Muxing
enables or disables mp4 muxing for the stream- Parameters:
streamId
- - id of the streamenabled
- 1 means enabled, -1 means disabled, 0 means no setting for the stream
-
setWebMMuxing
enables or disables WebM muxing for the stream- Parameters:
streamId
- - id of the streamenabled
- 1 means enabled, -1 means disabled, 0 means no setting for the stream
-
fetchUserVodList
Gets the video files under thefileDir
directory parameter and saves them to the datastore as USER_VOD inVod
class- Parameters:
file
-- Returns:
- number of files that are saved to datastore
-
getActiveBroadcastCount
public abstract long getActiveBroadcastCount()Return the number of active broadcasts in the server- Returns:
-
getActiveBroadcastCount
-
getActiveBroadcastList
-
updateBroadcastFields
Updates the Broadcast objects fields if it's not null. The updated fields are as follows name, description, userName, password, IP address, streamUrl- Parameters:
broadcast
-- Returns:
-
updateHLSViewerCount
Add or subtract the HLS viewer count from current value- Parameters:
streamId
-diffCount
-
-
updateHLSViewerCountLocal
-
updateDASHViewerCount
Add or subtract the DASH viewer count from current value- Parameters:
streamId
-diffCount
-
-
updateDASHViewerCountLocal
-
getObjectDetectedTotal
Returns the total number of detected objects in the stream- Parameters:
id
- is the stream id- Returns:
- total number of detected objects
-
getObjectDetectedTotal
-
updateWebRTCViewerCount
Update the WebRTC viewer count- Parameters:
streamId
-increment
- if it is true, increment viewer count by one if it is false, decrement viewer count by one
-
updateWebRTCViewerCountLocal
-
updateRtmpViewerCount
Update the RTMP viewer count- Parameters:
streamId
-increment
- if it is true, increment viewer count by one if it is false, decrement viewer count by one
-
updateRtmpViewerCountLocal
-
saveStreamInfo
Saves the stream info to the db- Parameters:
streamInfo
-
-
getStreamInfoList
Returns stream info list added to db- Parameters:
streamId
-- Returns:
-
clearStreamInfoList
Remove the stream info list from db- Parameters:
streamId
-
-
updateStreamInfo
Updates the stream fields if it's not null- Parameters:
broadcast
-name
-description
-userName
-password
-ipAddr
-streamUrl
-
-
getLocalLiveBroadcastCount
-
getLocalLiveBroadcasts
-
searchOnServerVod
Below search methods and sortandcrop methods are used for getting the searched items and sorting and pagination. Sorting, search and cropping is available for Broadcasts, VoDs and Conference Rooms. They are used by InMemoryDataStore and MapDBStore, Mongodb implements the same functionality inside its own class. -
sortAndCropVodList
-
searchOnServer
-
sortAndCropBroadcastList
-
createP2PConnection
Creates new P2PConnection- Parameters:
conn
- - P2PConnection object- Returns:
- boolean - success
-
getP2PConnection
Get the P2PConnection by streamId- Parameters:
streamId
- - stream id for P2PConnection- Returns:
- P2PConnection - if exist else null
-
deleteP2PConnection
Deletes a P2PConnection- Parameters:
conn
- - P2PConnection object- Returns:
- boolean - success
-
addSubTrack
@Deprecated(since="2.9.1", forRemoval=true) public abstract boolean addSubTrack(String mainTrackId, String subTrackId) Deprecated, for removal: This API element is subject to removal in a future version.no need to use this method, logic has changed and we use directly getSubtracks, getActiveSubtracks. It's kept for backward compatibility Add a subtrack id to a main track (broadcast)- Parameters:
mainTrackId
- - main track idsubTrackId
- - main track id- Returns:
- boolean - success
-
removeSubTrack
@Deprecated(since="2.9.1", forRemoval=true) public abstract boolean removeSubTrack(String mainTrackId, String subTrackId) Deprecated, for removal: This API element is subject to removal in a future version.no need to use this method, logic has changed and we use directly getSubtracks, getActiveSubtracks. It's kept for backward compatibility Remove a subtrack id from a main track (broadcast)- Parameters:
mainTrackId
- - main track idsubTrackId
- - main track id- Returns:
- boolean - success
-
resetBroadcasts
Resets the broadcasts in the database. It sets number of viewers to zero. It also delete the stream if it's zombi stream -
isAvailable
public boolean isAvailable()Return if data store is available. DataStore is available if it's initialized and not closed. It's not available if it's closed.- Returns:
- availability of the datastore
-
getTotalWebRTCViewersCount
public abstract int getTotalWebRTCViewersCount()This is used to get total number of WebRTC viewers -
getTotalWebRTCViewersCount
-
searchOnWebRTCViewerInfo
protected ArrayList<WebRTCViewerInfo> searchOnWebRTCViewerInfo(ArrayList<WebRTCViewerInfo> list, String search) -
sortAndCropWebRTCViewerInfoList
protected List<WebRTCViewerInfo> sortAndCropWebRTCViewerInfoList(List<WebRTCViewerInfo> list, int offset, int size, String sortBy, String orderBy) -
saveViewerInfo
This is used to save WebRTC Viewer Info to datastore- Parameters:
info
- information for the WebRTC Viewer
-
getWebRTCViewerList
public abstract List<WebRTCViewerInfo> getWebRTCViewerList(int offset, int size, String sortBy, String orderBy, String search) Get list of webrtc viewers- Parameters:
offset
-size
-search
-orderBy
-sortBy
-- Returns:
- list of webrtc viewers
-
getWebRTCViewerList
-
deleteWebRTCViewerInfo
This is used to delete a WebRTC Viewer Info from datastore- Parameters:
viewerId
- WebRTC Viewer Id
-
updateStreamMetaData
This is used to update meta data for a bradcast- Parameters:
streamId
- id for the broadcastmetaData
- new meta data
-
putSubscriberMetaData
Put subscriber metadata. It overwrites the metadata, if you need to update something, first get thegetSubscriberMetaData(String)
, update it and put it- Parameters:
subscriberId
-SubscriberMetadata
-
-
getSubscriberMetaData
Get subscriber metadata- Parameters:
subscriberId
-- Returns:
-
broadcastToConference
This is a helper method to remove the ConferenceRoom in later versions May 11, 2024 - mekya- Parameters:
broadcast
-- Returns:
-
conferenceUpdateToBroadcastUpdate
public static BroadcastUpdate conferenceUpdateToBroadcastUpdate(ConferenceRoom conferenceRoom) throws Exception This is a helper method to remove the ConferenceRoom in later versions May 11, 2024 - mekya- Parameters:
broadcast
-- Returns:
- Throws:
Exception
-
conferenceToBroadcast
- Throws:
Exception
-
migrateConferenceRoomsToBroadcasts
public abstract void migrateConferenceRoomsToBroadcasts()Move ConferenceRoom to Broadcast -
getSubtracks
public abstract List<Broadcast> getSubtracks(String mainTrackId, int offset, int size, String role, String status) Get the subtracks of the main track- Parameters:
mainTrackId
- the main track to get the subtracksoffset
- the offset to get the subtrackssize
- number of items to getrole
- the role of the subtracks for role based streaming especially in conferences. It can be nullstatus
- the status of the stream broadcasting, finished etc. It can be null- Returns:
-
getSubtracks
Get the subtracks of the main track- Parameters:
mainTrackId
- the main track to get the subtracksoffset
- the offset to get the subtrackssize
- number of items to getrole
- the role of the subtracks for role based streaming especially in conferences. It can be null- Returns:
-
getSubtrackCount
Get the count of subtracks- Parameters:
mainTrackId
- the main track to get the subtracksrole
- the role of the subtracks for role based streaming especially in conferences- Returns:
- number of subtracks
-
getActiveSubtracksCount
Get the count of active subtracks. If subtrack is stucked in broadcasting or preparing, it will not count it.- Parameters:
mainTrackId
-role
-- Returns:
-
getActiveSubtracks
Get of active subtracks. If subtrack is stucked in broadcasting or preparing, it will not return it. This method is generally not recommended to use because it can be very costly. It's implemented for the poll mechanism in Subtracks and poll mechanismi will be replaced with event mechanism- Parameters:
mainTrackId
-role
-- Returns:
-
hasSubtracks
- Parameters:
streamId
-- Returns:
- If the stream has subtracks, it return true. If not, it returns false
-
getExecutedQueryCount
public long getExecutedQueryCount()Get executed query count. For now only mongodb queries are counted.- Returns:
- Executed query count.
-
getConnectionEvents
public abstract List<ConnectionEvent> getConnectionEvents(String streamId, @Nullable String subscriberId, int offset, int size) Get connection events for a specific streamId and subscriberId ConnectionEvents are recorded ifAppSettings.isWriteSubscriberEventsToDatastore()
is true- Parameters:
streamId
-subscriberId
-offset
-size
-- Returns:
-
getConnectionEventListFromCollection
protected static List<ConnectionEvent> getConnectionEventListFromCollection(Collection<ConnectionEvent> values, String streamId) Simple converter from Collection to List- Parameters:
values
-- Returns:
-
setAppSettings
Setter for appSettings- Parameters:
appSettings
-
-
getAverageQueryTimeMs
public long getAverageQueryTimeMs()Calculate total query time in milliseconds- Returns:
-
addQueryTime
public void addQueryTime(long queryTimeNanoSec) Add query time in nanoseconds- Parameters:
queryTimeNanoSec
-
-
showWarningIfElapsedTimeIsMoreThanThreshold
-