MicrofeedFeed
[libmicrofeed-provider - Modules that are used in the provider side]

A feed with caching support and automatical updates. More...

Data Structures

struct  MicrofeedFeedCallbacks

Typedefs

typedef struct _MicrofeedFeed MicrofeedFeed
 Opaque data type representing Microfeed feed.
typedef struct
_MicrofeedFeedIterator 
MicrofeedFeedIterator
 Opaque data type representing Microfeed feed iterator that iterates over the items of the feed.
typedef void(* MicrofeedFeedDestroyCallback )(MicrofeedFeed *feed, void *user_data)
typedef MicrofeedError *(* MicrofeedFeedUpdateCallback )(MicrofeedFeed *feed, int user_initiated, void *user_data)
 This function is called when a subscriber wants to update the feed.
typedef MicrofeedError *(* MicrofeedFeedModifyItemCallback )(MicrofeedFeed *feed, MicrofeedItem *existing_item, MicrofeedItem *new_item, void *user_data)
 This function is called when a subscriber wants to add a new item, modify an existing item, or delete an existing item.
typedef MicrofeedError *(* MicrofeedFeedDownloadItemDataCallback )(MicrofeedFeed *feed, const char *uid, void **data, size_t *length, void *user_data)
typedef MicrofeedError *(* MicrofeedFeedMarkCallback )(MicrofeedFeed *feed, const char *uid, int mark_status, void *user_data)

Enumerations

enum  MicrofeedFeedPermission { MICROFEED_FEED_PERMISSION_NONE = 0, MICROFEED_FEED_PERMISSION_ADD = 1 << 0 }

Functions

MicrofeedFeedmicrofeed_feed_new (MicrofeedPublisher *publisher, const char *uri, const char *name, MicrofeedFeedPermission feed_permission, MicrofeedFeedCallbacks *callbacks, void *user_data)
void microfeed_feed_free (MicrofeedFeed *feed)
MicrofeedFeedmicrofeed_feed_ref (MicrofeedFeed *feed)
void microfeed_feed_unref (MicrofeedFeed *feed)
MicrofeedWeakReferencemicrofeed_feed_get_weak_reference (MicrofeedFeed *feed)
void microfeed_feed_add_free_callback (MicrofeedFeed *feed, MicrofeedFreeCallback free_callback, void *user_data)
void microfeed_feed_remove_free_callback (MicrofeedFeed *feed, MicrofeedFreeCallback free_callback, void *user_data)
MicrofeedPublishermicrofeed_feed_get_publisher (MicrofeedFeed *feed)
const char * microfeed_feed_get_uri (MicrofeedFeed *feed)
const char * microfeed_feed_get_name (MicrofeedFeed *feed)
void microfeed_feed_set_name (MicrofeedFeed *feed, const char *name)
MicrofeedItemmicrofeed_feed_get_metadata_item (MicrofeedFeed *feed)
void microfeed_feed_replace_item (MicrofeedFeed *feed, MicrofeedItem *item)
void microfeed_feed_remove_item (MicrofeedFeed *feed, const char *uid)
void microfeed_feed_remove_items (MicrofeedFeed *feed, const char *start_uid, const char *end_uid)
MicrofeedItemmicrofeed_feed_get_item (MicrofeedFeed *feed, const char *uid)
MicrofeedErrormicrofeed_feed_send_item_data (MicrofeedFeed *feed, const char *uid, const char *bus_name)
MicrofeedFeedIteratormicrofeed_feed_iterate (MicrofeedFeed *feed, const char *start_uid, int backwards)
MicrofeedFeedIteratormicrofeed_feed_iterate_timeline (MicrofeedFeed *feed, time_t start_timestamp, int backwards)
void microfeed_feed_update (MicrofeedFeed *feed, const char *bus_name)
void microfeed_feed_republish (MicrofeedFeed *feed, const char *start_uid, const char *end_uid, unsigned int max_count, const char *bus_name)
MicrofeedErrormicrofeed_feed_set_item_status (MicrofeedFeed *feed, const char *uid, MicrofeedItemStatus status_to_set)
MicrofeedErrormicrofeed_feed_unset_item_status (MicrofeedFeed *feed, const char *uid, MicrofeedItemStatus status_to_unset)
MicrofeedErrormicrofeed_feed_unset_item_statuses (MicrofeedFeed *feed, const char *start_uid, const char *end_uid, MicrofeedItemStatus status_to_unset)
void microfeed_feed_ref_item_data (MicrofeedFeed *feed, const char *uid)
void microfeed_feed_unref_item_data (MicrofeedFeed *feed, const char *uid)
MicrofeedFeedPermission microfeed_feed_permission_from_string (const char *string)
char * microfeed_feed_permission_to_string (MicrofeedFeedPermission item_permission)
void microfeed_feed_iterator_free (MicrofeedFeedIterator *iterator)
MicrofeedFeedmicrofeed_feed_iterator_get_feed (MicrofeedFeedIterator *iterator)
MicrofeedItemmicrofeed_feed_iterator_get_item (MicrofeedFeedIterator *iterator)
void microfeed_feed_iterator_next (MicrofeedFeedIterator *iterator)
int microfeed_feed_iterator_jump_and_remove_previous_items (MicrofeedFeedIterator *iterator, const char *uid)

Detailed Description

A feed with caching support and automatical updates.

MicrofeedFeed is thread-aware, because it implements internal lock. Usually an MicrofeedFeed object is accessed simultaneously from multiple threads, for example from a feed update thread and from the main thread responding to DBus messages. When one thread is accessing the object, others are waiting.

Note that MicrofeedFeed launches a new thread for every update and similar operation that may take some time. Thus, you have to call microfeed_thread_init at the very first and microfeed_thread_cleanup at the very last in your application.


Typedef Documentation

typedef struct _MicrofeedFeed MicrofeedFeed

Opaque data type representing Microfeed feed.

Definition at line 44 of file microfeedfeed.h.

typedef void(* MicrofeedFeedDestroyCallback)(MicrofeedFeed *feed, void *user_data)

Definition at line 64 of file microfeedfeed.h.

typedef MicrofeedError*(* MicrofeedFeedDownloadItemDataCallback)(MicrofeedFeed *feed, const char *uid, void **data, size_t *length, void *user_data)

Definition at line 102 of file microfeedfeed.h.

Opaque data type representing Microfeed feed iterator that iterates over the items of the feed.

Definition at line 49 of file microfeedfeed.h.

typedef MicrofeedError*(* MicrofeedFeedMarkCallback)(MicrofeedFeed *feed, const char *uid, int mark_status, void *user_data)

Definition at line 103 of file microfeedfeed.h.

typedef MicrofeedError*(* MicrofeedFeedModifyItemCallback)(MicrofeedFeed *feed, MicrofeedItem *existing_item, MicrofeedItem *new_item, void *user_data)

This function is called when a subscriber wants to add a new item, modify an existing item, or delete an existing item.

If the existing item parameter is null, the new item parameter contains a new item to be added. If the new item parameter is null, the existing item parameter contains an esiting item to be deleted. In other case, the existing item parameter contains the current properties of a modified item and the new item parameter contains the new properties for the existing item.

Parameters:
feed Instantiated MicrofeedFeed.
existing_item An existing item or NULL.
new_item A new item or NULL.
user_data The pointer given when the feed has been instantiated.
Returns:
Error or NULL, if the operation succeeded.

Definition at line 101 of file microfeedfeed.h.

typedef MicrofeedError*(* MicrofeedFeedUpdateCallback)(MicrofeedFeed *feed, int user_initiated, void *user_data)

This function is called when a subscriber wants to update the feed.

The actual network operations are happening here. The function is called in a separate thread, so it may also block. For pull-type services, typically one update cycle is implemented. For push-type services, this function initializes the connection and waits for the events indefinitely. However, the function must check peridiocally if the subscriber count (microfeed_feed_get_subscriber_count) has dropped to zero and in that case close the connection and return.

The update thread has one reference to the feed meaning that the feed is not freed before the thread finishes. The reference count is incremented and decremented automatically.

If this function returns non-NULL error object, a signal to subscribers is sent.

Parameters:
feed Instantiated MicrofeedFeed.
user_intiatied Boolean value telling if the update is requested by a subscriber (true), or periodical event (false).
user_data The pointer given when the feed has been instantiated.
Returns:
Error or NULL, if the operation succeeded.

Definition at line 85 of file microfeedfeed.h.


Enumeration Type Documentation

Enumerator:
MICROFEED_FEED_PERMISSION_NONE 
MICROFEED_FEED_PERMISSION_ADD 

Definition at line 113 of file microfeedfeed.h.


Function Documentation

void microfeed_feed_add_free_callback ( MicrofeedFeed feed,
MicrofeedFreeCallback  free_callback,
void *  user_data 
)

void microfeed_feed_free ( MicrofeedFeed feed  ) 

MicrofeedItem* microfeed_feed_get_item ( MicrofeedFeed feed,
const char *  uid 
)

MicrofeedItem* microfeed_feed_get_metadata_item ( MicrofeedFeed feed  ) 

Definition at line 385 of file microfeedfeed.c.

References _MicrofeedFeed::metadata_item.

const char* microfeed_feed_get_name ( MicrofeedFeed feed  ) 

Definition at line 372 of file microfeedfeed.c.

References _MicrofeedFeed::name.

MicrofeedPublisher* microfeed_feed_get_publisher ( MicrofeedFeed feed  ) 

Definition at line 204 of file microfeedfeed.c.

References _MicrofeedFeed::publisher.

const char* microfeed_feed_get_uri ( MicrofeedFeed feed  ) 

Definition at line 367 of file microfeedfeed.c.

References _MicrofeedFeed::uri.

Referenced by microfeed_publisher_new().

MicrofeedWeakReference* microfeed_feed_get_weak_reference ( MicrofeedFeed feed  ) 

MicrofeedFeedIterator* microfeed_feed_iterate ( MicrofeedFeed feed,
const char *  start_uid,
int  backwards 
)

MicrofeedFeedIterator* microfeed_feed_iterate_timeline ( MicrofeedFeed feed,
time_t  start_timestamp,
int  backwards 
)

void microfeed_feed_iterator_free ( MicrofeedFeedIterator iterator  ) 

MicrofeedFeed* microfeed_feed_iterator_get_feed ( MicrofeedFeedIterator iterator  ) 

Definition at line 834 of file microfeedfeed.c.

References _MicrofeedFeedIterator::feed.

MicrofeedItem* microfeed_feed_iterator_get_item ( MicrofeedFeedIterator iterator  ) 

int microfeed_feed_iterator_jump_and_remove_previous_items ( MicrofeedFeedIterator iterator,
const char *  uid 
)

void microfeed_feed_iterator_next ( MicrofeedFeedIterator iterator  ) 

MicrofeedFeed* microfeed_feed_new ( MicrofeedPublisher publisher,
const char *  uri,
const char *  name,
MicrofeedFeedPermission  feed_permission,
MicrofeedFeedCallbacks callbacks,
void *  user_data 
)

MicrofeedFeedPermission microfeed_feed_permission_from_string ( const char *  string  ) 

char* microfeed_feed_permission_to_string ( MicrofeedFeedPermission  item_permission  ) 

Definition at line 805 of file microfeedfeed.c.

References MICROFEED_FEED_PERMISSION_ADD.

Referenced by microfeed_feed_new().

MicrofeedFeed* microfeed_feed_ref ( MicrofeedFeed feed  ) 

void microfeed_feed_ref_item_data ( MicrofeedFeed feed,
const char *  uid 
)

void microfeed_feed_remove_free_callback ( MicrofeedFeed feed,
MicrofeedFreeCallback  free_callback,
void *  user_data 
)

void microfeed_feed_remove_item ( MicrofeedFeed feed,
const char *  uid 
)

void microfeed_feed_remove_items ( MicrofeedFeed feed,
const char *  start_uid,
const char *  end_uid 
)

void microfeed_feed_replace_item ( MicrofeedFeed feed,
MicrofeedItem item 
)

void microfeed_feed_republish ( MicrofeedFeed feed,
const char *  start_uid,
const char *  end_uid,
unsigned int  max_count,
const char *  bus_name 
)

MicrofeedError* microfeed_feed_send_item_data ( MicrofeedFeed feed,
const char *  uid,
const char *  bus_name 
)

MicrofeedError* microfeed_feed_set_item_status ( MicrofeedFeed feed,
const char *  uid,
MicrofeedItemStatus  status_to_set 
)

void microfeed_feed_set_name ( MicrofeedFeed feed,
const char *  name 
)

Definition at line 377 of file microfeedfeed.c.

References _MicrofeedFeed::name.

void microfeed_feed_unref ( MicrofeedFeed feed  ) 

void microfeed_feed_unref_item_data ( MicrofeedFeed feed,
const char *  uid 
)

MicrofeedError* microfeed_feed_unset_item_status ( MicrofeedFeed feed,
const char *  uid,
MicrofeedItemStatus  status_to_unset 
)

MicrofeedError* microfeed_feed_unset_item_statuses ( MicrofeedFeed feed,
const char *  start_uid,
const char *  end_uid,
MicrofeedItemStatus  status_to_unset 
)

void microfeed_feed_update ( MicrofeedFeed feed,
const char *  bus_name 
)


Generated on Tue Aug 4 08:25:11 2009 for Microfeed by  doxygen 1.5.6