![]() |
![]() |
![]() |
Reference Manual for CouchDB GLib Bindings | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties | Signals |
CouchdbSessionPrivate; CouchdbSession; CouchdbSessionClass; CouchdbSession * couchdb_session_new (const char *uri
); const char * couchdb_session_get_uri (CouchdbSession *couchdb
); GSList * couchdb_session_list_databases (CouchdbSession *couchdb
,GError **error
); void couchdb_session_free_database_list (GSList *dblist
); CouchdbDatabaseInfo * couchdb_session_get_database_info (CouchdbSession *couchdb
,const char *dbname
,GError **error
); gboolean couchdb_session_create_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
); gboolean couchdb_session_delete_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
); gboolean couchdb_session_compact_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
); void couchdb_session_listen_for_changes (CouchdbSession *couchdb
,const char *dbname
); void couchdb_session_enable_authentication (CouchdbSession *couchdb
,CouchdbCredentials *credentials
); void couchdb_session_disable_authentication (CouchdbSession *couchdb
); gboolean couchdb_session_is_authentication_enabled (CouchdbSession *couchdb
); gboolean couchdb_session_send_message (CouchdbSession *couchdb
,const char *method
,const char *url
,const char *body
,JsonParser *output
,GError **error
); GSList * couchdb_session_list_documents (CouchdbSession *couchdb
,const char *dbname
,GError **error
); void couchdb_session_free_document_list (GSList *doclist
); gboolean couchdb_session_replicate (CouchdbSession *couchdb
,const gchar *source
,const gchar *target
,gboolean continous
,GError **error
);
"authentication-failed" : Run Last "database-created" : Run Last "database-deleted" : Run Last "document-created" : Run Last "document-deleted" : Run Last "document-updated" : Run Last
typedef struct { GObjectClass parent_class; void (* authentication_failed) (CouchdbSession *couchdb); void (* database_created) (CouchdbSession *couchdb, const char *dbname); void (* database_deleted) (CouchdbSession *couchdb, const char *dbname); void (* document_created) (CouchdbSession *couchdb, const char *dbname, CouchdbDocument *document); void (* document_updated) (CouchdbSession *couchdb, const char *dbname, CouchdbDocument *document); void (* document_deleted) (CouchdbSession *couchdb, const char *dbname, const char *docid); } CouchdbSessionClass;
CouchdbSession * couchdb_session_new (const char *uri
);
Create a new CouchdbSession object, which is the entry point for operations on a CouchDB instance.
|
URI of the CouchDB instance to connect to |
Returns : |
A newly-created CouchdbSession object. |
const char * couchdb_session_get_uri (CouchdbSession *couchdb
);
Retrieve the URI of the CouchDB instance a CouchdbSession object is bound to.
|
A CouchdbSession object |
Returns : |
the URI of the CouchDB instance used by this CouchdbSession object. |
GSList * couchdb_session_list_databases (CouchdbSession *couchdb
,GError **error
);
Retrieve the list of databases that exist in the CouchDB instance being used.
|
A CouchdbSession object |
|
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. |
void couchdb_session_free_database_list (GSList *dblist
);
Free the list of databases returned by couchdb_session_list_databases.
|
A list of databases, as returned by couchdb_session_list_databases |
CouchdbDatabaseInfo * couchdb_session_get_database_info (CouchdbSession *couchdb
,const char *dbname
,GError **error
);
Retrieve information about a given database.
|
A CouchdbSession object |
|
Name of the database for which to retrieve the information |
|
Placeholder for error information |
Returns : |
A CouchdbDatabaseInfo object, whose API can be used to retrieve all the information returned by CouchDB about this database. |
gboolean couchdb_session_create_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
);
Create a new database on a CouchDB instance.
|
A CouchdbSession object |
|
Name of the database to be created |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
gboolean couchdb_session_delete_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
);
Delete an existing database on a CouchDB instance.
|
A CouchdbSession object |
|
Name of the database to be deleted |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
gboolean couchdb_session_compact_database (CouchdbSession *couchdb
,const char *dbname
,GError **error
);
Compact the given database, which means removing outdated document revisions and deleted documents.
|
A CouchdbSession object |
|
Name of the database to be compacted |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
void couchdb_session_listen_for_changes (CouchdbSession *couchdb
,const char *dbname
);
Setup a listener to get information about changes done to a specific database. Please note that changes done in the application using couchdb-glib will be notified without the need of calling this function. But if the application wants to receive notifications of changes done externally (by another application, or by any other means, like replication with a remote database), it needs to call this function.
For each change, one of the signals on the CouchdbSession object will be emitted, so applications just have to connect to those signals before calling this function.
|
A CouchdbSession object |
|
Name of the database to poll changes for |
void couchdb_session_enable_authentication (CouchdbSession *couchdb
,CouchdbCredentials *credentials
);
Enables authentication for the given CouchdbSession object. The authentication mechanism should be specificied when creating the CouchdbCredentials object.
|
A CouchdbSession object |
|
A CouchdbCredentials object |
void couchdb_session_disable_authentication
(CouchdbSession *couchdb
);
Disables authentication for the given CouchdbSession object.
|
A CouchdbSession object |
gboolean couchdb_session_is_authentication_enabled
(CouchdbSession *couchdb
);
Gets whether the given CouchdbSession object has authentication enabled.
|
A CouchdbSession object |
Returns : |
TRUE if authentication is enabled, FALSE otherwise. |
gboolean couchdb_session_send_message (CouchdbSession *couchdb
,const char *method
,const char *url
,const char *body
,JsonParser *output
,GError **error
);
This function is used to communicate with CouchDB over HTTP, and should not be used by applications unless they really have a need (like missing API in couchdb-glib which the application needs).
|
A CouchdbSession object |
|
HTTP method to use |
|
URL to send the message to |
|
Body of the HTTP request |
|
Placeholder for output information |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
GSList * couchdb_session_list_documents (CouchdbSession *couchdb
,const char *dbname
,GError **error
);
Retrieve the list of all documents from a database on a running CouchDB instance. For each document, a CouchdbDocumentInfo object is returned on the list, which can then be used for retrieving specific information for each document.
|
A CouchdbSession object |
|
Name of the databases to retrieve documents from |
|
Placeholder for error information |
Returns : |
a list of CouchdbDocumentInfo objects, or NULL if there are none or there was an error (in which case the error argument will contain information about the error). Once no longer needed, the list should be freed by calling couchdb_session_free_document_list. |
void couchdb_session_free_document_list (GSList *doclist
);
Free the list of documents returned by couchdb_session_list_documents.
|
A list of CouchdbDocumentInfo objects, as returned by couchdb_session_list_documents |
gboolean couchdb_session_replicate (CouchdbSession *couchdb
,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.
|
A CouchdbSession object |
|
Source database |
|
Target database |
|
Whether to replicate once or keep replicating |
|
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.
|
"authentication-failed"
signalvoid user_function (CouchdbSession *couchdbsession, gpointer user_data) : Run Last
|
the object which received the signal. |
|
user data set when the signal handler was connected. |
"database-created"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"database-deleted"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
user data set when the signal handler was connected. |
"document-created"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, GObject *arg2, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
"document-deleted"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gchar *arg2, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |
"document-updated"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, GObject *arg2, gpointer user_data) : Run Last
|
the object which received the signal. |
|
|
|
|
|
user data set when the signal handler was connected. |