EBackend.ServerSideSource¶
- Subclasses:
None
Methods¶
- Inherited:
EDataServer.Source (83), GObject.Object (37), Gio.Initable (2), Gio.ProxyResolver (5)
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Whether the source has been exported over D-Bus |
||
r/w/co |
The key file for the data source |
||
r/w/en |
The object providing OAuth 2.0 support |
||
r/w/co |
The server to which the data source belongs |
||
r/w/en |
Directory in which to write changes to disk |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class EBackend.ServerSideSource(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
Contains only private data that should be read and manipulated using the functions below.
New in version 3.6.
- classmethod get_user_dir()¶
- Returns:
the user-specific data source directory
- Return type:
Returns the directory where user-specific data source files are stored.
New in version 3.6.
- classmethod new(server, file)¶
- Parameters:
server (
EBackend.SourceRegistryServer
) – anEBackend.SourceRegistryServer
- Raises:
- Returns:
a new
EBackend.ServerSideSource
, orNone
- Return type:
Creates a new
EBackend.ServerSideSource
which belongs to server. If file is non-None
and points to an existing file, theEBackend.ServerSideSource
is initialized from the file content. If a read error occurs or the file contains syntax errors, the function sets error and returnsNone
.New in version 3.6.
- classmethod new_memory_only(server, uid)¶
- Parameters:
server (
EBackend.SourceRegistryServer
) – anEBackend.SourceRegistryServer
- Raises:
- Returns:
a new memory-only
EBackend.ServerSideSource
, orNone
on error- Return type:
Creates a memory-only
EBackend.ServerSideSource
which belongs to server. No on-disk key file is created for this data source, so it will not be remembered across sessions.Data source collections are often populated with memory-only data sources to serve as proxies for resources discovered on a remote server. These data sources are usually neither
EBackend.ServerSideSource
:writable
norEBackend.ServerSideSource
:removable
by clients, at least not directly.If an error occurs while instantiating the
EBackend.ServerSideSource
, the function sets error and returnsNone
. Although at this time there are no known error conditions for memory-only data sources.New in version 3.6.
- classmethod new_user_file(uid)¶
- Parameters:
uid (
str
orNone
) – unique identifier for a data source, orNone
- Returns:
the
Gio.File
for a new data source- Return type:
Generates a unique file name for a new user-specific data source. If uid is non-
None
it will be used in the basename of the file, otherwise a unique basename will be generated usingEDataServer.util_generate_uid
().The returned
Gio.File
can then be passed toEBackend.ServerSideSource.new
(). Unreference theGio.File
withGObject.Object.unref
() when finished with it.Note the data source file itself is not created here, only its name.
New in version 3.6.
- classmethod uid_from_file(file)¶
- Parameters:
- Raises:
- Returns:
the unique identity string for file, or
None
- Return type:
Extracts a unique identity string from the base name of file. If the base name of file is missing a ‘.source’ extension, the function sets error and returns
None
.New in version 3.6.
- get_exported()¶
- Returns:
whether self has been exported
- Return type:
Returns whether self has been exported over D-Bus.
The function returns
False
after self is initially created,True
after passing self uid toEBackend.SourceRegistryServer.ref_source
() (provided that self'sEDataServer.Source
:parent
is also exported).New in version 3.6.
- get_file()¶
-
Returns the
Gio.File
from which data source content is loaded and to which changes are saved. Note the self may not have aGio.File
.New in version 3.6.
- get_node()¶
-
Returns the
GLib.Node
representing the self's hierarchical placement, orNone
if self has not been placed in the data source hierarchy. The data member of theGLib.Node
points back to self. This is an easy way to traverse ancestor and descendant data sources.Note that accessing other data sources this way is not thread-safe, and this therefore function may be replaced at some later date.
New in version 3.6.
- get_server()¶
- Returns:
the
EBackend.SourceRegistryServer
for self- Return type:
Returns the
EBackend.SourceRegistryServer
to which self belongs.New in version 3.6.
- get_write_directory()¶
- Returns:
the directory where changes are written
- Return type:
Returns the local directory path where changes to self are written.
By default, changes are written to the local directory path returned by
EBackend.ServerSideSource.get_user_dir
(), but anEBackend.CollectionBackend
may wish to override this to use its own private cache directory for data sources it creates automatically.New in version 3.6.
- load(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object, orNone
- Raises:
- Returns:
- Return type:
Reloads data source content from the file pointed to by the
EBackend.ServerSideSource
:file
property.If the
EBackend.ServerSideSource
:file
property isNone
or the file it points to does not exist, the function does nothing and returnsTrue
.If a read error occurs or the file contains syntax errors, the function sets error and returns
False
.New in version 3.6.
- ref_oauth2_support()¶
- Returns:
an
EBackend.OAuth2Support
object, orNone
- Return type:
Returns the object implementing the
EBackend.OAuth2SupportInterface
, orNone
if self does not support OAuth 2.0 authentication.The returned
EBackend.OAuth2Support
object is referenced for thread-safety. Unreference the object withGObject.Object.unref
() when finished with it.New in version 3.8.
- set_oauth2_support(oauth2_support)¶
- Parameters:
oauth2_support (
EBackend.OAuth2Support
orNone
) – anEBackend.OAuth2Support
object, orNone
Indicates whether self supports OAuth 2.0 authentication.
If oauth2_support is non-
None
, the OAuth2Support D-Bus interface is exported at the object path for self. If oauth2_support isNone
, the OAuth2Support D-Bus interface is unexported at the object path for self, and any attempt by clients to callEDataServer.Source.get_oauth2_access_token
() will fail.Requests for OAuth 2.0 access tokens are forwarded to oauth2_support, which implements the
EBackend.OAuth2SupportInterface
.New in version 3.8.
- set_remote_creatable(remote_creatable)¶
- Parameters:
remote_creatable (
bool
) – whether to export the RemoteCreatable interface
Indicates whether self can be used to create resources on a remote server. Typically this is only set to
True
for collection sources.If
True
, the RemoteCreatable D-Bus interface is exported at the object path for self. IfFalse
, the RemoteCreatable D-Bus interface is unexported at the object path for self, and any attempt by clients to callEDataServer.Source.remote_create
() will fail.Unlike the
EDataServer.Source
:removable
andEDataServer.Source
:writable
properties, this is enforced for both clients of the registry D-Bus service and within the registry D-Bus service itself.New in version 3.6.
- set_remote_deletable(remote_deletable)¶
- Parameters:
remote_deletable (
bool
) – whether to export the RemoteDeletable interface
Indicates whether self can be used to delete resources on a remote server. Typically this is only set to
True
for sources created by anEBackend.CollectionBackend
to represent a remote resource.If
True
, the RemoteDeletable D-Bus interface is exported at the object path for self. IfFalse
, the RemoteDeletable D-Bus interface is unexported at the object path for self, and any attempt by clients to callEDataServer.Source.remote_delete
() will fail.Unlike the
EDataServer.Source
:removable
andEDataServer.Source
:writable
properties, this is enforced for both clients of the registry D-Bus server and within the registry D-Bus service itself.New in version 3.6.
- set_removable(removable)¶
- Parameters:
removable (
bool
) – whether to export the Removable interface
Sets whether to allow registry clients to remove self and its descendants. If
True
, the Removable D-Bus interface is exported at the object path for self. IfFalse
, the Removable D-Bus interface is unexported at the object path for self, and any attempt by clients to callEDataServer.Source.remove
() will fail.Note this is only enforced for clients of the registry D-Bus service. The service itself may remove any data source at any time.
New in version 3.6.
- set_writable(writable)¶
- Parameters:
writable (
bool
) – whether to export the Writable interface
Sets whether to allow registry clients to alter the content of self. If
True
, the Writable D-Bus interface is exported at the object path for self. IfFalse
, the Writable D-Bus interface is unexported at the object path for self, and any attempt by clients to callEDataServer.Source.write
() will fail.Note this is only enforced for clients of the registry D-Bus service. The service itself can write to any data source at any time.
New in version 3.6.
- set_write_directory(write_directory)¶
- Parameters:
write_directory (
str
) – the directory where changes are to be written
Sets the local directory path where changes to self are to be written.
By default, changes are written to the local directory path returned by
EBackend.ServerSideSource.get_user_dir
(), but anEBackend.CollectionBackend
may wish to override this to use its own private cache directory for data sources it creates automatically.New in version 3.6.
Property Details¶
- EBackend.ServerSideSource.props.exported¶
-
Whether the source has been exported over D-Bus
- EBackend.ServerSideSource.props.file¶
- Name:
file
- Type:
- Default Value:
- Flags:
The key file for the data source
- EBackend.ServerSideSource.props.oauth2_support¶
- Name:
oauth2-support
- Type:
- Default Value:
- Flags:
The object providing OAuth 2.0 support
- EBackend.ServerSideSource.props.server¶
- Name:
server
- Type:
- Default Value:
- Flags:
The server to which the data source belongs