EBackend.ServerSideSource

g EBackend.ServerSideSource EBackend.ServerSideSource EDataServer.Source EDataServer.Source EDataServer.Source->EBackend.ServerSideSource GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable Gio.ProxyResolver Gio.ProxyResolver GObject.GInterface->Gio.ProxyResolver GObject.Object GObject.Object GObject.Object->EDataServer.Source Gio.Initable->EDataServer.Source Gio.ProxyResolver->EDataServer.Source

Subclasses:

None

Methods

Inherited:

EDataServer.Source (83), GObject.Object (37), Gio.Initable (2), Gio.ProxyResolver (5)

Structs:

GObject.ObjectClass (5)

class

get_user_dir ()

class

new (server, file)

class

new_memory_only (server, uid)

class

new_user_file (uid)

class

uid_from_file (file)

get_exported ()

get_file ()

get_node ()

get_server ()

get_write_directory ()

load (cancellable)

ref_oauth2_support ()

set_oauth2_support (oauth2_support)

set_remote_creatable (remote_creatable)

set_remote_deletable (remote_deletable)

set_removable (removable)

set_writable (writable)

set_write_directory (write_directory)

Virtual Methods

Inherited:

EDataServer.Source (21), GObject.Object (7), Gio.Initable (1), Gio.ProxyResolver (4)

Properties

Inherited:

EDataServer.Source (10)

Name

Type

Flags

Short Description

exported

bool

r

Whether the source has been exported over D-Bus

file

Gio.File

r/w/co

The key file for the data source

oauth2-support

EBackend.OAuth2Support

r/w/en

The object providing OAuth 2.0 support

server

EBackend.SourceRegistryServer

r/w/co

The server to which the data source belongs

write-directory

str

r/w/en

Directory in which to write changes to disk

Signals

Inherited:

EDataServer.Source (3), GObject.Object (1)

Fields

Inherited:

EDataServer.Source (3), GObject.Object (1)

Name

Type

Access

Description

parent

EDataServer.Source

r

Class Details

class EBackend.ServerSideSource(**kwargs)
Bases:

EDataServer.Source

Abstract:

No

Structure:

EBackend.ServerSideSourceClass

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:

str

Returns the directory where user-specific data source files are stored.

New in version 3.6.

classmethod new(server, file)
Parameters:
Raises:

GLib.Error

Returns:

a new EBackend.ServerSideSource, or None

Return type:

EDataServer.Source or None

Creates a new EBackend.ServerSideSource which belongs to server. If file is non-None and points to an existing file, the EBackend.ServerSideSource is initialized from the file content. If a read error occurs or the file contains syntax errors, the function sets error and returns None.

New in version 3.6.

classmethod new_memory_only(server, uid)
Parameters:
Raises:

GLib.Error

Returns:

a new memory-only EBackend.ServerSideSource, or None on error

Return type:

EDataServer.Source

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 nor EBackend.ServerSideSource :removable by clients, at least not directly.

If an error occurs while instantiating the EBackend.ServerSideSource, the function sets error and returns None. 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 or None) – unique identifier for a data source, or None

Returns:

the Gio.File for a new data source

Return type:

Gio.File

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 using EDataServer.util_generate_uid().

The returned Gio.File can then be passed to EBackend.ServerSideSource.new(). Unreference the Gio.File with GObject.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:

file (Gio.File) – a Gio.File for a data source

Raises:

GLib.Error

Returns:

the unique identity string for file, or None

Return type:

str or None

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:

bool

Returns whether self has been exported over D-Bus.

The function returns False after self is initially created, True after passing self uid to EBackend.SourceRegistryServer.ref_source() (provided that self's EDataServer.Source :parent is also exported).

New in version 3.6.

get_file()
Returns:

the Gio.File for self, or None

Return type:

Gio.File or None

Returns the Gio.File from which data source content is loaded and to which changes are saved. Note the self may not have a Gio.File.

New in version 3.6.

get_node()
Returns:

a GLib.Node, or None

Return type:

GLib.Node or None

Returns the GLib.Node representing the self's hierarchical placement, or None if self has not been placed in the data source hierarchy. The data member of the GLib.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:

EBackend.SourceRegistryServer

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:

str

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 an EBackend.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 or None) – optional Gio.Cancellable object, or None

Raises:

GLib.Error

Returns:

True on success, False on failure

Return type:

bool

Reloads data source content from the file pointed to by the EBackend.ServerSideSource :file property.

If the EBackend.ServerSideSource :file property is None or the file it points to does not exist, the function does nothing and returns True.

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, or None

Return type:

EBackend.OAuth2Support or None

Returns the object implementing the EBackend.OAuth2SupportInterface, or None if self does not support OAuth 2.0 authentication.

The returned EBackend.OAuth2Support object is referenced for thread-safety. Unreference the object with GObject.Object.unref() when finished with it.

New in version 3.8.

set_oauth2_support(oauth2_support)
Parameters:

oauth2_support (EBackend.OAuth2Support or None) – an EBackend.OAuth2Support object, or None

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 is None, the OAuth2Support D-Bus interface is unexported at the object path for self, and any attempt by clients to call EDataServer.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. If False, the RemoteCreatable D-Bus interface is unexported at the object path for self, and any attempt by clients to call EDataServer.Source.remote_create() will fail.

Unlike the EDataServer.Source :removable and EDataServer.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 an EBackend.CollectionBackend to represent a remote resource.

If True, the RemoteDeletable D-Bus interface is exported at the object path for self. If False, the RemoteDeletable D-Bus interface is unexported at the object path for self, and any attempt by clients to call EDataServer.Source.remote_delete() will fail.

Unlike the EDataServer.Source :removable and EDataServer.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. If False, the Removable D-Bus interface is unexported at the object path for self, and any attempt by clients to call EDataServer.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. If False, the Writable D-Bus interface is unexported at the object path for self, and any attempt by clients to call EDataServer.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 an EBackend.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
Name:

exported

Type:

bool

Default Value:

False

Flags:

READABLE

Whether the source has been exported over D-Bus

EBackend.ServerSideSource.props.file
Name:

file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The key file for the data source

EBackend.ServerSideSource.props.oauth2_support
Name:

oauth2-support

Type:

EBackend.OAuth2Support

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The object providing OAuth 2.0 support

EBackend.ServerSideSource.props.server
Name:

server

Type:

EBackend.SourceRegistryServer

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The server to which the data source belongs

EBackend.ServerSideSource.props.write_directory
Name:

write-directory

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Directory in which to write changes to disk