![]() |
![]() |
![]() |
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 *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
); 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_listen_for_changes (CouchdbSession *session
,const char *dbname
); void couchdb_session_enable_authentication (CouchdbSession *session
,CouchdbCredentials *credentials
); void couchdb_session_disable_authentication (CouchdbSession *session
); gboolean couchdb_session_is_authentication_enabled (CouchdbSession *session
); GSList * couchdb_session_list_documents (CouchdbSession *session
,const char *dbname
,GError **error
); GSList * couchdb_session_get_all_documents (CouchdbSession *session
,const char *dbname
,GError **error
); void couchdb_session_free_document_list (GSList *doclist
); gboolean couchdb_session_replicate (CouchdbSession *session
,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 *session); void (* database_created) (CouchdbSession *session, const char *dbname); void (* database_deleted) (CouchdbSession *session, const char *dbname); void (* document_created) (CouchdbSession *session, const char *dbname, CouchdbDocument *document); void (* document_updated) (CouchdbSession *session, const char *dbname, CouchdbDocument *document); void (* document_deleted) (CouchdbSession *session, 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 *session
);
Retrieve the URI of the CouchDB instance a CouchdbSession object is bound to.
|
|
Returns : |
the URI of the CouchDB instance used by this CouchdbSession object. |
GSList * couchdb_session_list_databases (CouchdbSession *session
,GError **error
);
Retrieve the list of databases that exist in the CouchDB instance being used.
|
|
|
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 *session
,const char *dbname
,GError **error
);
Retrieve information about a given database.
|
|
|
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 *session
,const char *dbname
,GError **error
);
Create a new database on a CouchDB instance.
|
|
|
Name of the database to be created |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
gboolean couchdb_session_delete_database (CouchdbSession *session
,const char *dbname
,GError **error
);
Delete an existing database on a CouchDB instance.
|
|
|
Name of the database to be deleted |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
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.
|
|
|
Name of the database to be compacted |
|
Placeholder for error information |
Returns : |
TRUE if successful, FALSE otherwise. |
void couchdb_session_listen_for_changes (CouchdbSession *session
,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.
|
|
|
Name of the database to poll changes for |
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.
|
|
|
A CouchdbCredentials object |
void couchdb_session_disable_authentication
(CouchdbSession *session
);
Disables authentication for the given CouchdbSession object.
|
gboolean couchdb_session_is_authentication_enabled
(CouchdbSession *session
);
Gets whether the given CouchdbSession object has authentication enabled.
|
|
Returns : |
TRUE if authentication is enabled, FALSE otherwise. |
GSList * couchdb_session_list_documents (CouchdbSession *session
,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. |
GSList * couchdb_session_get_all_documents (CouchdbSession *session
,const char *dbname
,GError **error
);
Retrieve all documents from a database on a running CouchDB instance. For each document found in the database, a CouchdbDocument object is returned on the list, which represents the document's contents as found on the underlying database.
|
|
|
Name of the databases to retrieve documents from |
|
Placeholder for error information |
Returns : |
a list of CouchdbDocument 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 *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.
|
|
|
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.
|
"uri"
property"uri" gchar* : Read / Write / Construct
Uri pointing to the host to connect to.
Default value: NULL
"authentication-failed"
signalvoid user_function (CouchdbSession *couchdbsession, gpointer user_data) : Run Last
@:
"database-created"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gpointer user_data) : Run Last
@: @:
"database-deleted"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gpointer user_data) : Run Last
@: @:
"document-created"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, GObject *arg2, gpointer user_data) : Run Last
@: @: @:
"document-deleted"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, gchar *arg2, gpointer user_data) : Run Last
@: @: @:
"document-updated"
signalvoid user_function (CouchdbSession *couchdbsession, gchar *arg1, GObject *arg2, gpointer user_data) : Run Last
@: @: @: