EBackend.Backend¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Socket endpoint of a network service |
||
r |
The main loop context on which to attach event sources |
||
r/w/en |
Whether the backend is online |
||
r/w/co |
The data source being acted upon |
||
r |
User prompter instance |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class EBackend.Backend(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
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 requiredcertificate_pem (
str
) – PEM-encoded secure connection certificate, or an empty stringcertificate_errors (
Gio.TlsCertificateFlags
) – a bit-or ofGio.TlsCertificateFlags
for secure connection certificateop_error (
GLib.Error
orNone
) – aGLib.Error
with a description of the previous credentials error, orNone
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – 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.
- credentials_required_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- Return type:
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 requiredcertificate_pem (
str
) – PEM-encoded secure connection certificate, or an empty stringcertificate_errors (
Gio.TlsCertificateFlags
) – a bit-or ofGio.TlsCertificateFlags
for secure connection certificateop_error (
GLib.Error
orNone
) – aGLib.Error
with a description of the previous credentials error, orNone
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, 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.
- ensure_online_state_updated(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
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-status
is connected. This is useful in cases when the backend can connect to the destination without invokingEBackend.Backend.do_authenticate_sync
(), possibly throughEBackend.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;False
otherwise.- host:
destination server host name
- port:
destination server port
- Return type:
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 withGLib.free
(). When self sets both host and port, then it should returnTrue
, indicating it’s a remote backend. Default implementation returnsFalse
, which is treated like the backend is local, no checking for server reachability is possible.New in version 3.8.
- get_network_monitor()¶
- Returns:
a
Gio.NetworkMonitor
used by the self- Return type:
Returns a
Gio.NetworkMonitor
used to check whether the backend can access the remote server. The instance is owned by the self.New in version 3.50.
- get_online()¶
- Returns:
the online state
- Return type:
Returns the online state of self:
True
if self is online,False
if offline.If the
EBackend.Backend
:connectable
property is non-None
, the self will automatically determine whether the network service should be reachable, and hence whether the self isEBackend.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.Source
to which self is paired- Return type:
Returns the
EDataServer.Source
to which self is paired.New in version 3.4.
- get_user_prompter()¶
- Returns:
an
EBackend.UserPrompter
instance- Return type:
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.Cancellable
orNone
) – aGio.Cancellable
instance, orNone
- Raises:
- Returns:
True
, when destination server address is reachable or the backend doesn’t provide destination address;False
if the backend destination server cannot be reached currently.- Return type:
Checks whether the self ‘s destination server, as returned by
EBackend.Backend.get_destination_address
(), is reachable. If theEBackend.Backend.get_destination_address
() returnsFalse
, this function returnsTrue
, meaning the destination is always reachable. This usesGio.NetworkMonitor
‘sGio.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
, orNone
- Return type:
Returns the socket endpoint for the network service to which self is a client, or
None
if self does not use network sockets.The initial value of the
EBackend.Backend
:connectable
property is derived from theEDataServer.SourceAuthentication
extension of the self'sEBackend.Backend
:source
property, if the extension is present.The returned
Gio.SocketConnectable
is referenced for thread-safety and must be unreferenced withGObject.Object.unref
() when finished with it.New in version 3.8.
- ref_main_context()¶
- Returns:
- Return type:
Returns the
GLib.MainContext
on which event sources for self are to be attached.The returned
GLib.MainContext
is referenced for thread-safety and must be unreferenced withGLib.MainContext.unref
() when finished with it.New in version 3.8.
- schedule_authenticate(credentials)¶
- Parameters:
credentials (
EDataServer.NamedParameters
orNone
) – a credentials to use to authenticate, orNone
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
. WithNone
credentials 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 requiredcertificate_pem (
str
) – PEM-encoded secure connection certificate, or an empty stringcertificate_errors (
Gio.TlsCertificateFlags
) – a bit-or ofGio.TlsCertificateFlags
for secure connection certificateop_error (
GLib.Error
orNone
) – aGLib.Error
with a description of the previous credentials error, orNone
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
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.
- set_connectable(connectable)¶
- Parameters:
connectable (
Gio.SocketConnectable
) – aGio.SocketConnectable
, orNone
Sets the socket endpoint for the network service to which self is a client. This can be
None
if self does not use network sockets.The initial value of the
EBackend.Backend
:connectable
property is derived from theEDataServer.SourceAuthentication
extension of the self'sEBackend.Backend
:source
property, 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:
True
if self is online,False
if offline.If the
EBackend.Backend
:connectable
property is non-None
, the self will automatically determine whether the network service should be reachable, and hence whether the self isEBackend.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.NamedParameters
with values for the trust promptcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – 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.
- trust_prompt_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
an
EDataServer.TrustPromptResponse
what user respondedNote: 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:
Finishes the operation started with
EBackend.Backend.trust_prompt
(). If an error occurred, the function will set error and returnEDataServer.TrustPromptResponse.UNKNOWN
.New in version 3.8.
- trust_prompt_sync(parameters, cancellable)¶
- Parameters:
parameters (
EDataServer.NamedParameters
) – anEDataServer.NamedParameters
with values for the trust promptcancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
an
EDataServer.TrustPromptResponse
what user respondedNote: 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.
- 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.Cancellable
orNone
) –
- Return type:
Authenticate synchronously
- do_get_destination_address() virtual¶
- Returns:
True
, when it’s a remote backend and provides both host and port;False
otherwise.- host:
destination server host name
- port:
destination server port
- Return type:
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 withGLib.free
(). When backend sets both host and port, then it should returnTrue
, indicating it’s a remote backend. Default implementation returnsFalse
, 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:
- Default Value:
- Flags:
Socket endpoint of a network service
- EBackend.Backend.props.main_context¶
- Name:
main-context
- Type:
- Default Value:
- Flags:
The main loop context on which to attach event sources
- EBackend.Backend.props.online¶
- Name:
online
- Type:
- Default Value:
- Flags:
Whether the backend is online
- EBackend.Backend.props.source¶
- Name:
source
- Type:
- Default Value:
- Flags:
The data source being acted upon
- EBackend.Backend.props.user_prompter¶
- Name:
user-prompter
- Type:
- Default Value:
- Flags:
User prompter instance