Ubuntu TV Media Scanner
A centralized index for removable media content.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | List of all members
mediascanner::CommitPolicy Class Referenceabstract

A commit policy decides when changes to the media index are written back to the disk. More...

#include <mediascanner/commitpolicy.h>

+ Inheritance diagram for mediascanner::CommitPolicy:

Public Member Functions

virtual ~CommitPolicy ()
 
virtual bool OnCreate (const std::vector< std::wstring > &media_urls, WritableMediaIndex *media_index)=0
 This method is called when data has been inserted into the specified media_index. More...
 
virtual bool OnUpdate (const std::vector< std::wstring > &media_urls, WritableMediaIndex *media_index)=0
 This method is called when data has been updated in the specified media_index. More...
 
virtual bool OnRemove (const std::vector< std::wstring > &media_urls, WritableMediaIndex *media_index)=0
 This method is called when data has been deleted from the specified media_index. More...
 

Static Public Member Functions

static CommitPolicyPtr default_policy ()
 The default policy - currently an instance of InstantCommitPolicy. More...
 

Detailed Description

A commit policy decides when changes to the media index are written back to the disk.

Choosing the proper policy has great impact on reliability and performance, but also on hardware wear (for instance, flash disk wear).

Constructor & Destructor Documentation

virtual mediascanner::CommitPolicy::~CommitPolicy ( )
virtual

Member Function Documentation

static CommitPolicyPtr mediascanner::CommitPolicy::default_policy ( )
static

The default policy - currently an instance of InstantCommitPolicy.

virtual bool mediascanner::CommitPolicy::OnCreate ( const std::vector< std::wstring > &  media_urls,
WritableMediaIndex media_index 
)
pure virtual

This method is called when data has been inserted into the specified media_index.

Policy implementations can now decide when to call CommitPendingChanges().

Parameters
media_urlsThe URLs of the affected media.
media_indexThe affected media index.
Returns
If the change got committed.

Implemented in mediascanner::DelayedCommitPolicy, and mediascanner::InstantCommitPolicy.

virtual bool mediascanner::CommitPolicy::OnRemove ( const std::vector< std::wstring > &  media_urls,
WritableMediaIndex media_index 
)
pure virtual

This method is called when data has been deleted from the specified media_index.

Policy implementations can now decide when to call CommitPendingChanges().

Parameters
media_urlsThe URLs of the affected media.
media_indexThe affected media index.
Returns
If the change got committed.

Implemented in mediascanner::DelayedCommitPolicy, and mediascanner::InstantCommitPolicy.

virtual bool mediascanner::CommitPolicy::OnUpdate ( const std::vector< std::wstring > &  media_urls,
WritableMediaIndex media_index 
)
pure virtual

This method is called when data has been updated in the specified media_index.

Policy implementations can now decide when to call CommitPendingChanges().

Parameters
media_urlsThe URLs of the affected media.
media_indexThe affected media index.
Returns
If the change got committed.

Implemented in mediascanner::DelayedCommitPolicy, and mediascanner::InstantCommitPolicy.