Storage Class Reference

#include <storage.h>

Inheritance diagram for Storage:
Singleton< Storage > zmm::Object SQLStorage

Data Structures

class  ChangedContainers

Public Member Functions

virtual void init ()=0
virtual void addObject (zmm::Ref< CdsObject > object, int *changedContainer)=0
virtual void addContainerChain (zmm::String path, zmm::String lastClass, int lastRefID, int *containerID, int *updateID)=0
 Adds a virtual container chain specified by path.
virtual zmm::String buildContainerPath (int parentID, zmm::String title)=0
 Builds the container path. Fetches the path of the parent and adds the title.
virtual void updateObject (zmm::Ref< CdsObject > object, int *changedContainer)=0
virtual zmm::Ref< zmm::Array
< CdsObject > > 
browse (zmm::Ref< BrowseParam > param)=0
virtual zmm::Ref< zmm::Array
< zmm::StringBase > > 
getMimeTypes ()=0
virtual zmm::Ref< CdsObjectfindObjectByPath (zmm::String path)=0
 Loads a given (pc directory) object, identified by the given path from the database.
virtual int findObjectIDByPath (zmm::String fullpath)=0
 checks for a given (pc directory) object, identified by the given path from the database
virtual zmm::String incrementUpdateIDs (int *ids, int size)=0
 increments the updateIDs for the given objectIDs
virtual zmm::Ref< CdsObjectloadObject (int objectID)=0
virtual int getChildCount (int contId, bool containers=true, bool items=true, bool hideFsRoot=false)=0
virtual zmm::Ref
< ChangedContainers
removeObject (int objectID, bool all)=0
 Removes the object identified by the objectID from the database. all references will be automatically removed. If the object is a container, all children will be also removed automatically. If the object is a reference to another object, the "all" flag determines, if the main object will be removed too.
virtual zmm::Ref< DBRHash< int > > getObjects (int parentID, bool withoutContainer)=0
 Get all objects under the given parentID.
virtual zmm::Ref
< ChangedContainers
removeObjects (zmm::Ref< DBRHash< int > > list, bool all=false)=0
 Remove all objects found in list.
virtual zmm::Ref< CdsObjectloadObjectByServiceID (zmm::String serviceID)=0
 Loads an object given by the online service ID.
virtual zmm::Ref< zmm::IntArraygetServiceObjectIDs (char servicePrefix)=0
 Return an array of object ID's for a particular service.
virtual int getTotalFiles ()=0
virtual zmm::String getInternalSetting (zmm::String key)=0
virtual void storeInternalSetting (zmm::String key, zmm::String value)=0
virtual void updateAutoscanPersistentList (scan_mode_t scanmode, zmm::Ref< AutoscanList > list)=0
virtual zmm::Ref< AutoscanListgetAutoscanList (scan_mode_t scanmode)=0
virtual void addAutoscanDirectory (zmm::Ref< AutoscanDirectory > adir)=0
virtual void updateAutoscanDirectory (zmm::Ref< AutoscanDirectory > adir)=0
virtual void removeAutoscanDirectoryByObjectID (int objectID)=0
virtual void removeAutoscanDirectory (int autoscanID)=0
virtual int isAutoscanChild (int objectID)=0
 checks if the given object is a direct or indirect child of a recursive autoscan start point
virtual int getAutoscanDirectoryType (int objectId)=0
 returns wheather the given id is an autoscan start point and if yes, if it is persistent
virtual int isAutoscanDirectoryRecursive (int objectId)=0
 returns wheather the given id is an autoscan start point and if yes, if it is recursive
virtual zmm::Ref
< AutoscanDirectory
getAutoscanDirectory (int objectID)=0
 returns the AutoscanDirectory for the given objectID or nil if it's not an autoscan start point - scan id will be invalid
virtual void autoscanUpdateLM (zmm::Ref< AutoscanDirectory > adir)=0
 updates the last modified info for the given AutoscanDirectory in the database
virtual void checkOverlappingAutoscans (zmm::Ref< AutoscanDirectory > adir)=0
virtual zmm::Ref< zmm::IntArraygetPathIDs (int objectID)=0
virtual void shutdown ()=0
 shutdown the Storage with its possible threads
virtual int ensurePathExistence (zmm::String path, int *changedContainer)=0
 Ensures that a container given by it's location on disk is present in the database. If it does not exist it will be created, but it's content will not be added.
virtual void clearFlagInDB (int flag)=0
 clears the given flag in all objects in the DB
virtual zmm::String getFsRootName ()=0
virtual void threadCleanup ()=0
virtual bool threadCleanupRequired ()=0
void retain ()
void release ()
int getRefCount ()

Static Public Member Functions

static zmm::Ref< StoragegetInstance ()
static void * operator new (size_t size)
static void operator delete (void *ptr)

Protected Member Functions

virtual void registerSingleton ()

Static Protected Member Functions

static void stripAndUnescapeVirtualContainerFromPath (zmm::String path, zmm::String &first, zmm::String &last)
static zmm::Ref< StoragecreateInstance ()

Protected Attributes

mt_atomic_t _ref_count

Static Protected Attributes

static zmm::Ref< Mutexmutex
static zmm::Ref< Storageinstance
static bool singletonActive

Detailed Description

Definition at line 101 of file storage.h.


Member Function Documentation

virtual void Storage::addAutoscanDirectory ( zmm::Ref< AutoscanDirectory adir  )  [pure virtual]

Implemented in SQLStorage.

virtual void Storage::addContainerChain ( zmm::String  path,
zmm::String  lastClass,
int  lastRefID,
int *  containerID,
int *  updateID 
) [pure virtual]

Adds a virtual container chain specified by path.

Parameters:
path container path separated by '/'. Slashes in container titles must be escaped.
lastClass upnp:class of the last container in the chain, it is only set when the container is created for the first time.
lastRefID reference id of the last container in the chain, INVALID_OBJECT_ID indicates that the id will not be set.
containerID will be filled in by the function
updateID will be filled in by the function only if it is set to INVALID_OBJECT_ID and it is necessary to update a container. Otherwise it will be left unchanged.

The function gets a path (i.e. "/Audio/All Music/") and will create the container path if needed. The container ID will be filled in with the object ID of the container that is last in the path. The updateID will hold the objectID of the container that was changed, in case new containers were created during the operation.

Implemented in SQLStorage.

virtual void Storage::addObject ( zmm::Ref< CdsObject object,
int *  changedContainer 
) [pure virtual]

Implemented in SQLStorage.

virtual void Storage::autoscanUpdateLM ( zmm::Ref< AutoscanDirectory adir  )  [pure virtual]

updates the last modified info for the given AutoscanDirectory in the database

Parameters:
adir the AutoscanDirectory to be updated

Implemented in SQLStorage.

virtual zmm::Ref<zmm::Array<CdsObject> > Storage::browse ( zmm::Ref< BrowseParam param  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::String Storage::buildContainerPath ( int  parentID,
zmm::String  title 
) [pure virtual]

Builds the container path. Fetches the path of the parent and adds the title.

Parameters:
parentID the parent id of the parent container
title the title of the container to add to the path. It will be escaped.

Implemented in SQLStorage.

virtual void Storage::checkOverlappingAutoscans ( zmm::Ref< AutoscanDirectory adir  )  [pure virtual]

Implemented in SQLStorage.

virtual void Storage::clearFlagInDB ( int  flag  )  [pure virtual]

clears the given flag in all objects in the DB

Implemented in SQLStorage.

Ref< Storage > Storage::createInstance (  )  [static, protected]

Definition at line 72 of file storage.cc.

References _, _Exception, CFG_SERVER_STORAGE_DRIVER, and getInstance().

Referenced by getInstance().

virtual int Storage::ensurePathExistence ( zmm::String  path,
int *  changedContainer 
) [pure virtual]

Ensures that a container given by it's location on disk is present in the database. If it does not exist it will be created, but it's content will not be added.

Parameters:
*changedContainer returns the ID for the UpdateManager
Returns:
objectID of the container given by path

Implemented in SQLStorage.

virtual zmm::Ref<CdsObject> Storage::findObjectByPath ( zmm::String  path  )  [pure virtual]

Loads a given (pc directory) object, identified by the given path from the database.

Parameters:
path the path of the object; object is interpreted as directory if the path ends with DIR_SEPERATOR, as file otherwise multiple DIR_SEPERATOR are irgnored
Returns:
the CdsObject

Implemented in SQLStorage.

virtual int Storage::findObjectIDByPath ( zmm::String  fullpath  )  [pure virtual]

checks for a given (pc directory) object, identified by the given path from the database

Parameters:
path the path of the object; object is interpreted as directory if the path ends with DIR_SEPERATOR, as file otherwise multiple DIR_SEPERATOR are irgnored
Returns:
the obejectID

Implemented in SQLStorage.

virtual zmm::Ref<AutoscanDirectory> Storage::getAutoscanDirectory ( int  objectID  )  [pure virtual]

returns the AutoscanDirectory for the given objectID or nil if it's not an autoscan start point - scan id will be invalid

Parameters:
objectID the object id to get the AutoscanDirectory for
Returns:
nil if the given id is no autoscan start point, or the matching AutoscanDirectory

Implemented in SQLStorage.

virtual int Storage::getAutoscanDirectoryType ( int  objectId  )  [pure virtual]

returns wheather the given id is an autoscan start point and if yes, if it is persistent

Parameters:
objectId the object id to check
Returns:
0 if the given id is no autoscan start point, 1 if it is a non-persistent one, 2 if it is a persistent one

Implemented in SQLStorage.

virtual zmm::Ref<AutoscanList> Storage::getAutoscanList ( scan_mode_t  scanmode  )  [pure virtual]

Implemented in SQLStorage.

virtual int Storage::getChildCount ( int  contId,
bool  containers = true,
bool  items = true,
bool  hideFsRoot = false 
) [pure virtual]

Implemented in SQLStorage.

virtual zmm::String Storage::getFsRootName (  )  [pure virtual]

Implemented in SQLStorage.

Ref< Storage > Storage::getInstance (  )  [static]
virtual zmm::String Storage::getInternalSetting ( zmm::String  key  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::Ref<zmm::Array<zmm::StringBase> > Storage::getMimeTypes (  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::Ref<DBRHash<int> > Storage::getObjects ( int  parentID,
bool  withoutContainer 
) [pure virtual]

Get all objects under the given parentID.

Parameters:
parentID parent container
withoutContainer if false: all children are returned; if true: only items are returned
Returns:
DBHash containing the objectID's - nil if there are none!

Implemented in SQLStorage.

virtual zmm::Ref<zmm::IntArray> Storage::getPathIDs ( int  objectID  )  [pure virtual]

Implemented in SQLStorage.

int Object::getRefCount (  )  [inherited]

Definition at line 78 of file object.cc.

References zmm::Object::_ref_count, and atomic_get().

virtual zmm::Ref<zmm::IntArray> Storage::getServiceObjectIDs ( char  servicePrefix  )  [pure virtual]

Return an array of object ID's for a particular service.

In the database, the service is identified by a service id prefix.

Implemented in SQLStorage.

virtual int Storage::getTotalFiles (  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::String Storage::incrementUpdateIDs ( int *  ids,
int  size 
) [pure virtual]

increments the updateIDs for the given objectIDs

Parameters:
ids pointer to the array of ids
size number of entries in the given array
Returns:
a String for UPnP: a CSV list; for every existing object: "id,update_id"

Implemented in SQLStorage.

virtual void Storage::init (  )  [pure virtual]

Reimplemented from Singleton< Storage >.

Implemented in SQLStorage.

virtual int Storage::isAutoscanChild ( int  objectID  )  [pure virtual]

checks if the given object is a direct or indirect child of a recursive autoscan start point

Parameters:
objectID the object id of the object to check
Returns:
the objectID of the nearest matching autoscan start point or INVALID_OBJECT_ID if it is not a child.

Implemented in SQLStorage.

virtual int Storage::isAutoscanDirectoryRecursive ( int  objectId  )  [pure virtual]

returns wheather the given id is an autoscan start point and if yes, if it is recursive

Parameters:
objectId the object id to check
Returns:
0 if the given id is no autoscan start point, 1 if it is a non-recursive one, 2 if it is a recursive on

Implemented in SQLStorage.

virtual zmm::Ref<CdsObject> Storage::loadObject ( int  objectID  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::Ref<CdsObject> Storage::loadObjectByServiceID ( zmm::String  serviceID  )  [pure virtual]

Loads an object given by the online service ID.

Implemented in SQLStorage.

void Object::operator delete ( void *  ptr  )  [static, inherited]

Definition at line 87 of file object.cc.

References FREE.

void * Object::operator new ( size_t  size  )  [static, inherited]

Definition at line 83 of file object.cc.

References MALLOC.

virtual void Singleton< Storage >::registerSingleton (  )  [inline, protected, virtual, inherited]

Definition at line 94 of file singleton.h.

void Object::release (  )  [inherited]
virtual void Storage::removeAutoscanDirectory ( int  autoscanID  )  [pure virtual]

Implemented in SQLStorage.

virtual void Storage::removeAutoscanDirectoryByObjectID ( int  objectID  )  [pure virtual]

Implemented in SQLStorage.

virtual zmm::Ref<ChangedContainers> Storage::removeObject ( int  objectID,
bool  all 
) [pure virtual]

Removes the object identified by the objectID from the database. all references will be automatically removed. If the object is a container, all children will be also removed automatically. If the object is a reference to another object, the "all" flag determines, if the main object will be removed too.

Parameters:
objectID the object id of the object to remove
all if true and the object to be removed is a reference
objectType pointer to an int; will be filled with the objectType of the removed object, if not NULL
Returns:
changed container ids

Implemented in SQLStorage.

virtual zmm::Ref<ChangedContainers> Storage::removeObjects ( zmm::Ref< DBRHash< int > >  list,
bool  all = false 
) [pure virtual]

Remove all objects found in list.

Parameters:
list a DBHash containing objectIDs that have to be removed
all if true and the object to be removed is a reference
Returns:
changed container ids

Implemented in SQLStorage.

void Object::retain (  )  [inherited]
virtual void Storage::shutdown (  )  [pure virtual]

shutdown the Storage with its possible threads

Reimplemented from Singleton< Storage >.

Implemented in SQLStorage.

virtual void Storage::storeInternalSetting ( zmm::String  key,
zmm::String  value 
) [pure virtual]

Implemented in SQLStorage.

void Storage::stripAndUnescapeVirtualContainerFromPath ( zmm::String  path,
zmm::String first,
zmm::String last 
) [static, protected]
virtual void Storage::threadCleanup (  )  [pure virtual]
virtual bool Storage::threadCleanupRequired (  )  [pure virtual]
virtual void Storage::updateAutoscanDirectory ( zmm::Ref< AutoscanDirectory adir  )  [pure virtual]

Implemented in SQLStorage.

virtual void Storage::updateAutoscanPersistentList ( scan_mode_t  scanmode,
zmm::Ref< AutoscanList list 
) [pure virtual]

Implemented in SQLStorage.

virtual void Storage::updateObject ( zmm::Ref< CdsObject object,
int *  changedContainer 
) [pure virtual]

Implemented in SQLStorage.


Field Documentation

mt_atomic_t zmm::Object::_ref_count [protected, inherited]
zmm::Ref<Storage > Singleton< Storage >::instance [static, protected, inherited]

Definition at line 91 of file singleton.h.

Referenced by getInstance().

zmm::Ref<Mutex> Singleton< Storage >::mutex [static, protected, inherited]

Reimplemented from zmm::Object.

Definition at line 90 of file singleton.h.

Referenced by SQLStorage::addToInsertBuffer(), SQLStorage::flushInsertBuffer(), and getInstance().

bool Singleton< Storage >::singletonActive [static, protected, inherited]

Definition at line 92 of file singleton.h.


The documentation for this class was generated from the following files:

Generated on Fri Mar 26 20:16:57 2010 for MediaTomb by  doxygen 1.6.1