MicrofeedFeed

This module implementing a feed is used only in the publisher side. 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)
typedef MicrofeedError *(* MicrofeedFeedDownloadItemDataCallback )(MicrofeedFeed *feed, const char *uid, void **data, size_t *length, void *user_data)

Functions

MicrofeedFeedmicrofeed_feed_new (MicrofeedPublisher *publisher, const char *uri, 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)
MicrofeedPublishermicrofeed_feed_get_publisher (MicrofeedFeed *feed)
int microfeed_feed_is_using_threads (MicrofeedFeed *feed)
void microfeed_feed_stop_update (MicrofeedFeed *feed)
void microfeed_feed_replace_item (MicrofeedFeed *feed, MicrofeedItem *item)
void microfeed_feed_remove_item (MicrofeedFeed *feed, const char *uid)
void microfeed_feed_add_subscriber (MicrofeedFeed *feed, const char *bus_name)
MicrofeedItemmicrofeed_feed_get_item (MicrofeedFeed *feed, const char *uid)
int microfeed_feed_get_subscriber_count (MicrofeedFeed *feed)
const char * microfeed_feed_get_uri (MicrofeedFeed *feed)
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_remove_subscriber (MicrofeedFeed *feed, const char *bus_name)
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)
int microfeed_feed_unset_item_status (MicrofeedFeed *feed, const char *uid, MicrofeedItemStatus status_to_unset)
void microfeed_feed_unset_item_statuses (MicrofeedFeed *feed, const char *start_uid, const char *end_uid, MicrofeedItemStatus status_to_unset)
void microfeed_feed_add_new_setting (MicrofeedFeed *feed, const char *uid, time_t position, const char *text, const char *unit, const char *type, const char *value)
void microfeed_feed_send_item_data (MicrofeedFeed *feed, const char *uid, const char *bus_name)
void microfeed_feed_ref_item_data (MicrofeedFeed *feed, const char *uid)
void microfeed_feed_unref_item_data (MicrofeedFeed *feed, const char *uid)
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

This module implementing a feed is used only in the publisher side.

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 24 of file microfeedfeed.h.

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

Definition at line 44 of file microfeedfeed.h.

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

Definition at line 62 of file microfeedfeed.h.

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

Definition at line 29 of file microfeedfeed.h.

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

Definition at line 61 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.

Definition at line 60 of file microfeedfeed.h.


Function Documentation

void microfeed_feed_add_new_setting ( MicrofeedFeed feed,
const char *  uid,
time_t  position,
const char *  text,
const char *  unit,
const char *  type,
const char *  value 
)

void microfeed_feed_add_subscriber ( MicrofeedFeed feed,
const char *  bus_name 
)

void microfeed_feed_free ( MicrofeedFeed feed  ) 

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

MicrofeedPublisher* microfeed_feed_get_publisher ( MicrofeedFeed feed  ) 

Definition at line 173 of file microfeedfeed.c.

References _MicrofeedFeed::publisher.

int microfeed_feed_get_subscriber_count ( MicrofeedFeed feed  ) 

const char* microfeed_feed_get_uri ( MicrofeedFeed feed  ) 

Definition at line 333 of file microfeedfeed.c.

References _MicrofeedFeed::uri.

Referenced by microfeed_publisher_new().

MicrofeedWeakReference* microfeed_feed_get_weak_reference ( MicrofeedFeed feed  ) 

int microfeed_feed_is_using_threads ( 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 651 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,
MicrofeedFeedCallbacks callbacks,
void *  user_data 
)

MicrofeedFeed* microfeed_feed_ref ( MicrofeedFeed feed  ) 

void microfeed_feed_ref_item_data ( MicrofeedFeed feed,
const char *  uid 
)

void microfeed_feed_remove_item ( MicrofeedFeed feed,
const char *  uid 
)

void microfeed_feed_remove_subscriber ( MicrofeedFeed feed,
const char *  bus_name 
)

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 
)

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

void microfeed_feed_stop_update ( MicrofeedFeed feed  ) 

void microfeed_feed_unref ( MicrofeedFeed feed  ) 

void microfeed_feed_unref_item_data ( MicrofeedFeed feed,
const char *  uid 
)

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

void 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 Sat Feb 28 23:19:16 2009 for Microfeed by  doxygen 1.5.6