Dee.ResourceManager

g Dee.ResourceManager Dee.ResourceManager GObject.GInterface GObject.GInterface GObject.GInterface->Dee.ResourceManager

Implementations:

Dee.FileResourceManager

Methods

class

get_default ()

load (resource_name)

store (resource, resource_name)

Virtual Methods

do_load (resource_name)

do_store (resource, resource_name)

Properties

None

Signals

None

Fields

None

Class Details

class Dee.ResourceManager
Bases:

GObject.GInterface

Structure:

Dee.ResourceManagerIface

classmethod get_default()
Returns:

The default resource manager for the platform. Do not unreference. If you need to keep the instance around you must manually reference it.

Return type:

Dee.ResourceManager

Get a pointer to the platform default Dee.ResourceManager.

load(resource_name)
Parameters:

resource_name (str) – The name of the resource to retrieve

Raises:

GLib.Error

Returns:

A newly allocated GObject.Object in case of success and None otherwise. In case of a runtime error the error pointer will be set.

Return type:

GObject.Object

Load a resource from persistent storage. The loaded resource will be of the same GObject.GType as when it was stored (provided that the same serialization and parse functions are registered).

In case of an error the error will be in the GLib.FileError domain. Specifically if there is no resource with the name resource_name the error code will be GLib.FileError.NOENT.

Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.

store(resource, resource_name)
Parameters:
  • resource (Dee.Serializable) – A Dee.Serializable to store under resource_name

  • resource_name (str) – The name to store the resource under. Will overwrite any existing resource with the same name

Raises:

GLib.Error

Returns:

True on success and False otherwise. In case of a runtime error the error pointer will point to a GLib.Error in the #DeeResourceError domain.

Return type:

bool

Store a resource under a given name. The resource manager must guarantee that the stored data survives system reboots and that you can recreate a copy of resource by calling Dee.ResourceManager.load() using the same resource_name.

Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.

do_load(resource_name) virtual
Parameters:

resource_name (str) – The name of the resource to retrieve

Returns:

A newly allocated GObject.Object in case of success and None otherwise. In case of a runtime error the error pointer will be set.

Return type:

GObject.Object

Load a resource from persistent storage. The loaded resource will be of the same GObject.GType as when it was stored (provided that the same serialization and parse functions are registered).

In case of an error the error will be in the GLib.FileError domain. Specifically if there is no resource with the name resource_name the error code will be GLib.FileError.NOENT.

Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.

do_store(resource, resource_name) virtual
Parameters:
  • resource (Dee.Serializable) – A Dee.Serializable to store under resource_name

  • resource_name (str) – The name to store the resource under. Will overwrite any existing resource with the same name

Returns:

True on success and False otherwise. In case of a runtime error the error pointer will point to a GLib.Error in the #DeeResourceError domain.

Return type:

bool

Store a resource under a given name. The resource manager must guarantee that the stored data survives system reboots and that you can recreate a copy of resource by calling Dee.ResourceManager.load() using the same resource_name.

Important note: This call may do blocking IO. The resource manager must guarantee that this call is reasonably fast, like writing the externalized resource to a file, but not blocking IO over a network socket.