schedular.c File Reference

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "nntpgrab_plugin_schedular.h"
#include "schedular_plugin.h"

Go to the source code of this file.


Data Structures

struct   SchedularPluginClass
struct   _part_download_done

Typedefs

typedef struct SchedularPluginClass  SchedularPluginClass

Functions

  G_DEFINE_TYPE (SchedularPlugin, schedular_plugin, G_TYPE_OBJECT)
gboolean  nntpgrab_plugin_schedular_initialize (PluginSchedularImportedFuncs funcs, char **errmsg)
  Initialize the plugin.
void  nntpgrab_plugin_schedular_destroy (void)
  Destroy the plugin.
int  nntpgrab_plugin_schedular_get_version (void)
  Return the API version of the plugin.
gboolean  get_next_part_to_download (SchedularPlugin *schedular, int server_id, NNTPCollection **collection, NNTPFile **file, NNTPPart **part, GThreadPool *poolDecoder)
void  update_part_download_status (NNTPCollection *collection, NNTPFile *file, NNTPPart *part, int server_id, gboolean success, gboolean reset_to_zero, gboolean queue_is_being_paused, gboolean dont_retry_anymore, gpointer nntpconnection)
void  stop_schedular_from_seperate_thread (const char *reason)
gboolean  nntpgrab_plugin_schedular_start (void)
  Start the schedular thread.
gboolean  nntpgrab_plugin_schedular_stop (const char *reason)
  Stop/pause the schedular thread.
SchedularState  nntpgrab_plugin_schedular_get_state (void)
  Retrieves the status of the schedular.
gboolean  nntpgrab_plugin_schedular_add_task_to_queue (const char *collection_name, NNTPFile *file, char **errmsg)
  Add a new task to the download queue.
gboolean  nntpgrab_plugin_schedular_del_task_from_queue (const char *collection_name, const char *subject, char **errmsg)
  Remove a task from the download queue.
gboolean  nntpgrab_plugin_schedular_restart_task (const char *collection_name, const char *subject, char **errmsg)
  Restarts a task.
gboolean  nntpgrab_plugin_schedular_save_queue (char **errmsg)
  Saves the download queue to disk.
void  nntpgrab_plugin_schedular_foreach_task (GFunc foreach_func, gpointer data)
  Get a list of all the tasks which are already in the download queue.
gboolean  nntpgrab_plugin_schedular_move_task (const char *collection_name_src, const char *subject_src, const char *collection_name_dest, int position_dest)
  Moves one item in the download queue to a new position and collection.
gboolean  nntpgrab_plugin_schedular_move_collection (const char *collection_name, int new_position)
  Moves the position of one collection in the download queue.
gboolean  schedular_plugin_save_queue (char **errmsg)

Typedef Documentation

typedef struct SchedularPluginClass SchedularPluginClass

Definition at line 34 of file plugins/schedular/schedular.c.


Function Documentation

G_DEFINE_TYPE ( SchedularPlugin  ,
schedular_plugin  ,
G_TYPE_OBJECT   
)

gboolean get_next_part_to_download ( SchedularPlugin schedular,
int  server_id,
NNTPCollection **  collection,
NNTPFile **  file,
NNTPPart **  part,
GThreadPool *  poolDecoder  
)

Definition at line 138 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_add_task_to_queue ( const char *  collection_name,
NNTPFile file,
char **  errmsg  
)

Add a new task to the download queue.

Definition at line 784 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_del_task_from_queue ( const char *  collection_name,
const char *  subject,
char **  errmsg  
)

Remove a task from the download queue.

Returns:
TRUE on success, FALSE when the subject was not found in the given collection

Definition at line 875 of file plugins/schedular/schedular.c.

void nntpgrab_plugin_schedular_destroy ( void   ) 

Destroy the plugin.

Definition at line 62 of file plugins/schedular/schedular.c.

void nntpgrab_plugin_schedular_foreach_task ( GFunc  foreach_func,
gpointer  data  
)

Get a list of all the tasks which are already in the download queue.

Definition at line 1084 of file plugins/schedular/schedular.c.

SchedularState nntpgrab_plugin_schedular_get_state ( void   ) 

Retrieves the status of the schedular.

Returns:
SCHEDULAR_STATE_RUNNING when the schedular is running, SCHEDULAR_STATE_STOPPING when the schedular is waiting for jobs to finish so the schedular can be stopped SCHEDULAR_STATE_STOPPED when the schedular is not running

Definition at line 747 of file plugins/schedular/schedular.c.

int nntpgrab_plugin_schedular_get_version ( void   ) 

Return the API version of the plugin.

This is used to verify that the plugin is compatible with the interface the NNTPGrab Core expects

Returns:
NNTPGRAB_PLUGIN_API_VERSION

Definition at line 68 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_initialize ( PluginSchedularImportedFuncs  funcs,
char **  errmsg  
)

Initialize the plugin.

Returns:
TRUE when the initialization was successfull

Definition at line 46 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_move_collection ( const char *  collection_name,
int  new_position  
)

Moves the position of one collection in the download queue.

Returns:
TRUE when the collection has been successfully moved

Definition at line 1196 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_move_task ( const char *  collection_name_src,
const char *  subject_src,
const char *  collection_name_dest,
int  position_dest  
)

Moves one item in the download queue to a new position and collection.

Returns:
TRUE when the task has been successfully moved

Definition at line 1096 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_restart_task ( const char *  collection_name,
const char *  subject,
char **  errmsg  
)

Restarts a task.

All parts will be downloaded and decoded again

Returns:
TRUE on success, FALSE when the subject was not found in the given collection

Definition at line 984 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_save_queue ( char **  errmsg  ) 

Saves the download queue to disk.

Definition at line 1077 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_start ( void   ) 

Start the schedular thread.

Any items in the download queue will be downloaded

Returns:
FALSE when the queue is already started

Definition at line 626 of file plugins/schedular/schedular.c.

gboolean nntpgrab_plugin_schedular_stop ( const char *  reason  ) 

Stop/pause the schedular thread.

Active download jobs will be finished, but no new ones will be started.

Returns:
FALSE when the queue is already stopped

Definition at line 705 of file plugins/schedular/schedular.c.

gboolean schedular_plugin_save_queue ( char **  errmsg  ) 

Definition at line 1246 of file plugins/schedular/schedular.c.

void stop_schedular_from_seperate_thread ( const char *  reason  ) 

Definition at line 516 of file plugins/schedular/schedular.c.

void update_part_download_status ( NNTPCollection collection,
NNTPFile file,
NNTPPart part,
int  server_id,
gboolean  success,
gboolean  reset_to_zero,
gboolean  queue_is_being_paused,
gboolean  dont_retry_anymore,
gpointer  nntpconnection  
)

Definition at line 390 of file plugins/schedular/schedular.c.


Generated on Sun Oct 12 01:45:31 2008 for NNTPGrab by  1.5.4