EBackend.Backend¶
| Subclasses: | EBackend.CollectionBackend | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| credentials_required(reason, certificate_pem, certificate_errors, op_error, cancellable, callback, *user_data) | |
| credentials_required_finish(result) | |
| credentials_required_sync(reason, certificate_pem, certificate_errors, op_error, cancellable) | |
| ensure_online_state_updated(cancellable) | |
| ensure_source_status_connected() | |
| get_destination_address() | |
| get_online() | |
| get_source() | |
| get_user_prompter() | |
| is_destination_reachable(cancellable) | |
| prepare_shutdown() | |
| ref_connectable() | |
| ref_main_context() | |
| schedule_authenticate(credentials) | |
| schedule_credentials_required(reason, certificate_pem, certificate_errors, op_error, cancellable, who_calls) | |
| set_connectable(connectable) | |
| set_online(online) | |
| trust_prompt(parameters, cancellable, callback, *user_data) | |
| trust_prompt_finish(result) | |
| trust_prompt_sync(parameters, cancellable) | 
Virtual Methods¶
| Inherited: | GObject.Object (7) | 
|---|
| do_authenticate_sync(credentials, out_certificate_pem, out_certificate_errors, cancellable) | |
| do_get_destination_address() | |
| do_prepare_shutdown() | 
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| connectable | Gio.SocketConnectable | r/w/en | Socket endpoint of a network service | 
| main-context | GLib.MainContext | r | The main loop context on which to attach event sources | 
| online | bool | r/w/en | Whether the backend is online | 
| source | EDataServer.Source | r/w/co | The data source being acted upon | 
| user-prompter | EBackend.UserPrompter | r | User prompter instance | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
Class Details¶
- 
class EBackend.Backend(**kwargs)¶
- Bases: - GObject.Object- Abstract: - Yes - Structure: - EBackend.BackendClass- Contains only private data that should be read and manipulated using the functions below. - New in version 3.4. - 
credentials_required(reason, certificate_pem, certificate_errors, op_error, cancellable, callback, *user_data)¶
- Parameters: - reason (EDataServer.SourceCredentialsReason) – anEDataServer.SourceCredentialsReason, why the credentials are required
- certificate_pem (str) – PEM-encoded secure connection certificate, or an empty string
- certificate_errors (Gio.TlsCertificateFlags) – a bit-or ofGio.TlsCertificateFlagsfor secure connection certificate
- op_error (GLib.ErrororNone) – aGLib.Errorwith a description of the previous credentials error, orNone
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – data to pass to the callback function
 - Asynchronously calls the - EBackend.Backend.credentials_required_sync() on the self, to inform clients that credentials are required.- When the operation is finished, callback will be called. You can then call - EBackend.Backend.credentials_required_finish() to get the result of the operation.- New in version 3.16. 
- reason (
 - 
credentials_required_finish(result)¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - Trueon success,- Falseon error- Return type: - bool- Finishes the operation started with - EBackend.Backend.credentials_required().- If an error occurs, the function sets error and returns - False.- New in version 3.16. 
 - 
credentials_required_sync(reason, certificate_pem, certificate_errors, op_error, cancellable)¶
- Parameters: - reason (EDataServer.SourceCredentialsReason) – anEDataServer.SourceCredentialsReason, why the credentials are required
- certificate_pem (str) – PEM-encoded secure connection certificate, or an empty string
- certificate_errors (Gio.TlsCertificateFlags) – a bit-or ofGio.TlsCertificateFlagsfor secure connection certificate
- op_error (GLib.ErrororNone) – aGLib.Errorwith a description of the previous credentials error, orNone
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
 - Raises: - Returns: - Return type: - Synchronously lets the clients know that the backned requires credentials to be properly opened. It’s a proxy function for - EDataServer.Source.invoke_credentials_required_sync(), where can be found more information about actual parameters meaning.- The provided credentials are received through - EBackend.Backend.do_authenticate_sync() method asynchronously.- If an error occurs, the function sets error and returns - False.- New in version 3.16. 
- reason (
 - 
ensure_online_state_updated(cancellable)¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – optional- Gio.Cancellableobject, or- None- Makes sure that the “online” property is updated, that is, if there is any destination reachability test pending, it’ll be done immediately and the only state will be updated as well. - New in version 3.18. 
 - 
ensure_source_status_connected()¶
- Makes sure that the associated - EDataServer.Source- ::connection-statusis connected. This is useful in cases when the backend can connect to the destination without invoking- EBackend.Backend.do_authenticate_sync(), possibly through- EBackend.Backend.schedule_authenticate().- New in version 3.18. 
 - 
get_destination_address()¶
- Returns: - True, when it’s a remote backend and provides both host and port;- Falseotherwise.- host: - destination server host name - port: - destination server port - Return type: - ( - bool, host:- str, port:- int)- Provides destination server host name and port to which the backend connects. This is used to determine required connection point for - EBackend.Backend.is_destination_reachable(). The host is a newly allocated string, which will be freed with- GLib.free(). When self sets both host and port, then it should return- True, indicating it’s a remote backend. Default implementation returns- False, which is treated like the backend is local, no checking for server reachability is possible.- New in version 3.8. 
 - 
get_online()¶
- Returns: - the online state - Return type: - bool- Returns the online state of self: - Trueif self is online,- Falseif offline.- If the - EBackend.Backend- :connectableproperty is non-- None, the self will automatically determine whether the network service should be reachable, and hence whether the self is- EBackend.Backend- :online. But subclasses may override the online state if, for example, a connection attempt fails.- New in version 3.4. 
 - 
get_source()¶
- Returns: - the - EDataServer.Sourceto which self is paired- Return type: - EDataServer.Source- Returns the - EDataServer.Sourceto which self is paired.- New in version 3.4. 
 - 
get_user_prompter()¶
- Returns: - an - EBackend.UserPrompterinstance- Return type: - objector- None- Gets an instance of - EBackend.UserPrompter, associated with this self.- The returned instance is owned by the self. - New in version 3.8. 
 - 
is_destination_reachable(cancellable)¶
- Parameters: - cancellable ( - Gio.Cancellableor- None) – a- Gio.Cancellableinstance, or- None- Raises: - GLib.Error- Returns: - True, when destination server address is reachable or the backend doesn’t provide destination address;- Falseif the backend destination server cannot be reached currently.- Return type: - bool- Checks whether the self ‘s destination server, as returned by - EBackend.Backend.get_destination_address(), is reachable. If the- EBackend.Backend.get_destination_address() returns- False, this function returns- True, meaning the destination is always reachable. This uses- Gio.NetworkMonitor‘s- Gio.NetworkMonitor.can_reach() for reachability tests.- New in version 3.8. 
 - 
prepare_shutdown()¶
- Let’s the self know that it’ll be shut down shortly, no client connects to it anymore. The self can free any resources which reference it, for example the opened views. - New in version 3.16. 
 - 
ref_connectable()¶
- Returns: - a - Gio.SocketConnectable, or- None- Return type: - Gio.SocketConnectableor- None- Returns the socket endpoint for the network service to which self is a client, or - Noneif self does not use network sockets.- The initial value of the - EBackend.Backend- :connectableproperty is derived from the- EDataServer.SourceAuthenticationextension of the self’s- EBackend.Backend- :sourceproperty, if the extension is present.- The returned - Gio.SocketConnectableis referenced for thread-safety and must be unreferenced with- GObject.Object.unref() when finished with it.- New in version 3.8. 
 - 
ref_main_context()¶
- Returns: - a - GLib.MainContext- Return type: - GLib.MainContext- Returns the - GLib.MainContexton which event sources for self are to be attached.- The returned - GLib.MainContextis referenced for thread-safety and must be unreferenced with- GLib.MainContext.unref() when finished with it.- New in version 3.8. 
 - 
schedule_authenticate(credentials)¶
- Parameters: - credentials ( - EDataServer.NamedParametersor- None) – a credentials to use to authenticate, or- None- Schedules a new authenticate session, cancelling any previously run. This is usually done automatically, when an ‘authenticate’ signal is received for the associated - EDataServer.Source. With- Nonecredentials an attempt without it is run.- New in version 3.16. 
 - 
schedule_credentials_required(reason, certificate_pem, certificate_errors, op_error, cancellable, who_calls)¶
- Parameters: - reason (EDataServer.SourceCredentialsReason) – anEDataServer.SourceCredentialsReason, why the credentials are required
- certificate_pem (str) – PEM-encoded secure connection certificate, or an empty string
- certificate_errors (Gio.TlsCertificateFlags) – a bit-or ofGio.TlsCertificateFlagsfor secure connection certificate
- op_error (GLib.ErrororNone) – aGLib.Errorwith a description of the previous credentials error, orNone
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- who_calls (strorNone) – an identification who calls this
 - Asynchronously invokes - EBackend.Backend.credentials_required(), but installs its own callback which only prints a runtime warning on the console when the call fails. The who_calls is a prefix of the console message. This is useful when the caller just wants to start the operation without having actual place where to show the operation result.- New in version 3.16. 
- reason (
 - 
set_connectable(connectable)¶
- Parameters: - connectable ( - Gio.SocketConnectable) – a- Gio.SocketConnectable, or- None- Sets the socket endpoint for the network service to which self is a client. This can be - Noneif self does not use network sockets.- The initial value of the - EBackend.Backend- :connectableproperty is derived from the- EDataServer.SourceAuthenticationextension of the self’s- EBackend.Backend- :sourceproperty, if the extension is present.- New in version 3.8. 
 - 
set_online(online)¶
- Parameters: - online ( - bool) – the online state- Sets the online state of self: - Trueif self is online,- Falseif offline.- If the - EBackend.Backend- :connectableproperty is non-- None, the self will automatically determine whether the network service should be reachable, and hence whether the self is- EBackend.Backend- :online. But subclasses may override the online state if, for example, a connection attempt fails.- New in version 3.4. 
 - 
trust_prompt(parameters, cancellable, callback, *user_data)¶
- Parameters: - parameters (EDataServer.NamedParameters) – anEDataServer.NamedParameterswith values for the trust prompt
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
- callback (Gio.AsyncReadyCallbackorNone) – aGio.AsyncReadyCallbackto call when the request is satisfied
- user_data (objectorNone) – data to pass to the callback function
 - Initiates a user trust prompt with given parameters. - When the operation is finished, callback will be called. You can then call - EBackend.Backend.trust_prompt_finish() to get the result of the operation.- New in version 3.8. 
- parameters (
 - 
trust_prompt_finish(result)¶
- Parameters: - result ( - Gio.AsyncResult) – a- Gio.AsyncResult- Raises: - GLib.Error- Returns: - an - EDataServer.TrustPromptResponsewhat user responded- Note: The function can return also - EDataServer.TrustPromptResponse.UNKNOWN, it’s on error or if user closes the trust prompt dialog with other than the offered buttons. Usual behaviour in such case is to treat it as a temporary reject.- Return type: - EDataServer.TrustPromptResponse- Finishes the operation started with - EBackend.Backend.trust_prompt(). If an error occurred, the function will set error and return- EDataServer.TrustPromptResponse.UNKNOWN.- New in version 3.8. 
 - 
trust_prompt_sync(parameters, cancellable)¶
- Parameters: - parameters (EDataServer.NamedParameters) – anEDataServer.NamedParameterswith values for the trust prompt
- cancellable (Gio.CancellableorNone) – optionalGio.Cancellableobject, orNone
 - Raises: - Returns: - an - EDataServer.TrustPromptResponsewhat user responded- Note: The function can return also - EDataServer.TrustPromptResponse.UNKNOWN, it’s on error or if user closes the trust prompt dialog with other than the offered buttons. Usual behaviour in such case is to treat it as a temporary reject.- Return type: - Asks a user a trust prompt with given parameters, and returns what user responded. This blocks until the response is delivered. - New in version 3.8. 
- parameters (
 - 
do_authenticate_sync(credentials, out_certificate_pem, out_certificate_errors, cancellable) virtual¶
- Parameters: - credentials (EDataServer.NamedParameters) –
- out_certificate_pem (str) –
- out_certificate_errors (Gio.TlsCertificateFlags) –
- cancellable (Gio.CancellableorNone) –
 - Return type: 
- credentials (
 - 
do_get_destination_address() virtual¶
- Returns: - True, when it’s a remote backend and provides both host and port;- Falseotherwise.- host: - destination server host name - port: - destination server port - Return type: - ( - bool, host:- str, port:- int)- Provides destination server host name and port to which the backend connects. This is used to determine required connection point for - EBackend.Backend.is_destination_reachable(). The host is a newly allocated string, which will be freed with- GLib.free(). When backend sets both host and port, then it should return- True, indicating it’s a remote backend. Default implementation returns- False, which is treated like the backend is local, no checking for server reachability is possible.- New in version 3.8. 
 - 
do_prepare_shutdown() virtual¶
- Let’s the backend know that it’ll be shut down shortly, no client connects to it anymore. The backend can free any resources which reference it, for example the opened views. - New in version 3.16. 
 
- 
Property Details¶
- 
EBackend.Backend.props.connectable¶
- Name: - connectable- Type: - Gio.SocketConnectable- Default Value: - None- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Socket endpoint of a network service 
- 
EBackend.Backend.props.main_context¶
- Name: - main-context- Type: - GLib.MainContext- Default Value: - None- Flags: - READABLE- The main loop context on which to attach event sources 
- 
EBackend.Backend.props.online¶
- Name: - online- Type: - bool- Default Value: - True- Flags: - READABLE,- WRITABLE,- EXPLICIT_NOTIFY- Whether the backend is online 
- 
EBackend.Backend.props.source¶
- Name: - source- Type: - EDataServer.Source- Default Value: - None- Flags: - READABLE,- WRITABLE,- CONSTRUCT_ONLY- The data source being acted upon 
- 
EBackend.Backend.props.user_prompter¶
- Name: - user-prompter- Type: - EBackend.UserPrompter- Default Value: - None- Flags: - READABLE- User prompter instance