IrisService

IrisService — Writing concurrent services

Synopsis

#define             IRIS_SERVICE_CONST                  (obj)
                    IrisServicePrivate;
                    IrisService;
void                iris_service_start                  (IrisService *service);
void                iris_service_stop                   (IrisService *service);
void                iris_service_send_exclusive         (IrisService *service,
                                                         IrisMessage *message);
void                iris_service_send_concurrent        (IrisService *service,
                                                         IrisMessage *message);
gboolean            iris_service_is_started             (IrisService *service);

Object Hierarchy

  GObject
   +----IrisService

Description

IrisService is a class to help design concurrent services. Most services tend to be in one of a couple of states. Either it can work on requests concurrently, or a state change meaning no concurrency, or the service is no-longer valid. Because of this, IrisService reflects this concept and provides a starting point for writing a new service.

By creating a new class with the proper overrides for handling messages, you can let IrisService handle the scaling up and down of message handling.

Details

IRIS_SERVICE_CONST()

#define IRIS_SERVICE_CONST(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), IRIS_TYPE_SERVICE, IrisService const))

obj :


IrisServicePrivate

typedef struct _IrisServicePrivate IrisServicePrivate;


IrisService

typedef struct _IrisService IrisService;


iris_service_start ()

void                iris_service_start                  (IrisService *service);

Starts the IrisService.

service :

An IrisService

iris_service_stop ()

void                iris_service_stop                   (IrisService *service);

Stops a running IrisService

service :

An IrisService

iris_service_send_exclusive ()

void                iris_service_send_exclusive         (IrisService *service,
                                                         IrisMessage *message);

Sends an exclusive message to the service. The message is guaranteed to be handled while no other handlers are executing.

service :

An IrisService

message :

An IrisMessage

iris_service_send_concurrent ()

void                iris_service_send_concurrent        (IrisService *service,
                                                         IrisMessage *message);

Sends a concurrent message to the service. The message can be handled concurrently with other concurrent messages to the service.

service :

An IrisService

message :

An IrisMessage

iris_service_is_started ()

gboolean            iris_service_is_started             (IrisService *service);

See iris_service_start().

service :

An IrisService

Returns :

TRUE if the service has been started