mme_sync_file()

Synchronize a specified file.

Synopsis:

#include <mme/mme.h>

int mme_sync_file( mme_hdl_t *hdl,
                   uint64_t old_fid,
                   uint64_t new_msid,
                   const char *new_filename );


Arguments:

hdl
An MME connection handle.
old_fid
The file ID of the file in the library before the change. Use 0 for file additions, to indicate that there is no existing file associated with the operation.
new_msid
The ID for the media store with the new_filename path for the new file. This value may be 0 if new_filename is NULL, as in the case of file removals.
new_filename
The path and name of the new file, relative to the mountpath of the mediastore identified by new_msid. This value may be a NULL pointer to indicate there is no new file associated with the operation, as in the case of file removals.

Library:

mme

Description:

The function mme_sync_file() starts a synchronization for a specified file.

File synchronization allows the client application to have the MME synchronize only a specified file. This capability is typically used when the client application knows that a specific file change has occured: a file has been deleted, added, moved or renamed.

In all cases, the client application must specify, as a minimum, one of the old_fid or the new_filename. The values the client application should assign to these variables before passing them to mme_sync_file() depending on the reason it is calling the function:

Function behavior

No synchronization options are available for this function; it attempts to do the equivalent of both file and metadata synchronization passes.

File changes and additions

During synchronization, the mme_sync_file() delivers synchronization events:

File removal

If new_msid is 0 and new_filename is NULL, mme_sync_file() removes the file specified by fid. The function returns 0 on successful completion.

Limitations

The function mme_sync_file() can only be used with certain media store types. For example, the function it is not supported for use with iPods.

There is no support for changes across mediastores. For example, when both the msid and old_msid are specified, the msid for the old file must match the old_msid.

File move or rename is supported only when the file remains on the same media store. In this case, all metadata about the file is preserved. If the file is moved to a different mediastore, two separate calls to mme_sync_file() are required and:

Events

This function returns synchronization events with the operation ID. See File changes and additions above, and the chapter MME Synchronization Events for a full list.

 

Blocking and validation

This function is non-blocking. It returns synchronously. On completion, it returns 0 or a positive integer, which is the operation ID. This return value is sent with:

Returns:

0
Success:
=0
Operation completed synchronously. This situation occurs only if new_msid is 0 and new_filename is NULL.
>0
Value returned is synchronization operation ID. the operation ID of the directed synchronization.
-1
An error occurred (errno is set). The event MME_EVENT_SYNCABORTED is sent with the msid and the operation ID.

Classification:

QNX Neutrino

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

mme_directed_sync_cancel(), mme_resync_mediastore(), mme_setpriorityfolder(), mme_sync_cancel(), mme_sync_directed(), mme_sync_get_msid_status(), mme_sync_get_status()