CouchdbSession

CouchdbSession

Synopsis

                    CouchdbSession;
                    CouchdbSessionClass;
CouchdbSession *    couchdb_session_new                 (const char *uri);
const char *        couchdb_session_get_uri             (CouchdbSession *session);
GSList *            couchdb_session_list_databases      (CouchdbSession *session,
                                                         GError **error);
void                couchdb_session_free_database_list  (GSList *dblist);
CouchdbDatabaseInfo * couchdb_session_get_database_info (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);
CouchdbDatabase *   couchdb_session_get_database        (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);
gboolean            couchdb_session_create_database     (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);
gboolean            couchdb_session_delete_database     (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);
gboolean            couchdb_session_compact_database    (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);
void                couchdb_session_enable_authentication
                                                        (CouchdbSession *session,
                                                         CouchdbCredentials *credentials);
void                couchdb_session_disable_authentication
                                                        (CouchdbSession *session);
gboolean            couchdb_session_is_authentication_enabled
                                                        (CouchdbSession *session);
gboolean            couchdb_session_replicate           (CouchdbSession *session,
                                                         const gchar *source,
                                                         const gchar *target,
                                                         gboolean continous,
                                                         GError **error);
                    CouchdbDatabase;
                    CouchdbSessionPrivate;

Object Hierarchy

  GObject
   +----CouchdbSession
  GObject
   +----CouchdbDatabase

Properties

  "uri"                      gchar*                : Read / Write / Construct

Signals

  "authentication-failed"                          : Run Last
  "database-created"                               : Run Last
  "database-deleted"                               : Run Last

Description

Details

CouchdbSession

typedef struct _CouchdbSession CouchdbSession;


CouchdbSessionClass

typedef struct {
	GObjectClass parent_class;

	/* Signals */
	void (* authentication_failed) (CouchdbSession *session);

	void (* database_created) (CouchdbSession *session, const char *dbname);
	void (* database_deleted) (CouchdbSession *session, const char *dbname);
} CouchdbSessionClass;


couchdb_session_new ()

CouchdbSession *    couchdb_session_new                 (const char *uri);

Create a new CouchdbSession object, which is the entry point for operations on a CouchDB instance.

uri :

URI of the CouchDB instance to connect to

Returns :

A newly-created CouchdbSession object.

couchdb_session_get_uri ()

const char *        couchdb_session_get_uri             (CouchdbSession *session);

Retrieve the URI of the CouchDB instance a CouchdbSession object is bound to.

session :

A CouchdbSession object

Returns :

the URI of the CouchDB instance used by this CouchdbSession object.

couchdb_session_list_databases ()

GSList *            couchdb_session_list_databases      (CouchdbSession *session,
                                                         GError **error);

Retrieve the list of databases that exist in the CouchDB instance being used.

session :

A CouchdbSession object

error :

Placeholder for error information

Returns :

A list of strings containing the names of all the databases that exist in the CouchDB instance connected to. Once no longer needed, this list can be freed by calling couchdb_session_free_database_list.

couchdb_session_free_database_list ()

void                couchdb_session_free_database_list  (GSList *dblist);

Free the list of databases returned by couchdb_session_list_databases.

dblist :

A list of databases, as returned by couchdb_session_list_databases

couchdb_session_get_database_info ()

CouchdbDatabaseInfo * couchdb_session_get_database_info (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);

Retrieve information about a given database.

session :

A CouchdbSession object

dbname :

Name of the database for which to retrieve the information

error :

Placeholder for error information

Returns :

A CouchdbDatabaseInfo object, whose API can be used to retrieve all the information returned by CouchDB about this database.

couchdb_session_get_database ()

CouchdbDatabase *   couchdb_session_get_database        (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);

Get a CouchdbDatabase object reference for an existing database.

session :

A CouchdbSession object

dbname :

Name of the database to retrieve

error :

Placeholder for error information

Returns :

A CouchdbDatabase object if the database exists on the specified CouchdbSession object, or NULL if the database does not exist.

couchdb_session_create_database ()

gboolean            couchdb_session_create_database     (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);

Create a new database on a CouchDB instance.

session :

A CouchdbSession object

dbname :

Name of the database to be created

error :

Placeholder for error information

Returns :

TRUE if successful, FALSE otherwise.

couchdb_session_delete_database ()

gboolean            couchdb_session_delete_database     (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);

Delete an existing database on a CouchDB instance.

session :

A CouchdbSession object

dbname :

Name of the database to be deleted

error :

Placeholder for error information

Returns :

TRUE if successful, FALSE otherwise.

couchdb_session_compact_database ()

gboolean            couchdb_session_compact_database    (CouchdbSession *session,
                                                         const char *dbname,
                                                         GError **error);

Compact the given database, which means removing outdated document revisions and deleted documents.

session :

A CouchdbSession object

dbname :

Name of the database to be compacted

error :

Placeholder for error information

Returns :

TRUE if successful, FALSE otherwise.

couchdb_session_enable_authentication ()

void                couchdb_session_enable_authentication
                                                        (CouchdbSession *session,
                                                         CouchdbCredentials *credentials);

Enables authentication for the given CouchdbSession object. The authentication mechanism should be specificied when creating the CouchdbCredentials object.

session :

A CouchdbSession object

credentials :

A CouchdbCredentials object

couchdb_session_disable_authentication ()

void                couchdb_session_disable_authentication
                                                        (CouchdbSession *session);

Disables authentication for the given CouchdbSession object.

session :

A CouchdbSession object

couchdb_session_is_authentication_enabled ()

gboolean            couchdb_session_is_authentication_enabled
                                                        (CouchdbSession *session);

Gets whether the given CouchdbSession object has authentication enabled.

session :

A CouchdbSession object

Returns :

TRUE if authentication is enabled, FALSE otherwise.

couchdb_session_replicate ()

gboolean            couchdb_session_replicate           (CouchdbSession *session,
                                                         const gchar *source,
                                                         const gchar *target,
                                                         gboolean continous,
                                                         GError **error);

Replicates a source database to another database, on the same CouchDB instance or on a remote instance.

If continous is FALSE, the replication will happen once, but if set to TRUE, CouchDB will listen to all changes made to the source database, and automatically replicate over any new docs as the come into the source to the target.

session :

A CouchdbSession object

source :

Source database

target :

Target database

continous :

Whether to replicate once or keep replicating

error :

Placeholder for error information

Returns :

TRUE if successful, FALSE otherwise, in which case the error parameter will be set to contain information about the error.

CouchdbDatabase

typedef struct _CouchdbDatabase CouchdbDatabase;


CouchdbSessionPrivate

typedef struct _CouchdbSessionPrivate CouchdbSessionPrivate;

Property Details

The "uri" property

  "uri"                      gchar*                : Read / Write / Construct

Uri pointing to the host to connect to.

Default value: NULL

Signal Details

The "authentication-failed" signal

void                user_function                      (CouchdbSession *couchdbsession,
                                                        gpointer        user_data)           : Run Last

couchdbsession :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "database-created" signal

void                user_function                      (CouchdbSession *couchdbsession,
                                                        gchar          *arg1,
                                                        gpointer        user_data)           : Run Last

couchdbsession :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "database-deleted" signal

void                user_function                      (CouchdbSession *couchdbsession,
                                                        gchar          *arg1,
                                                        gpointer        user_data)           : Run Last

couchdbsession :

the object which received the signal.

user_data :

user data set when the signal handler was connected.