UDisksPersistentStore

UDisksPersistentStore — Stores information that persists across reboots

Synopsis

                    UDisksPersistentStore;
UDisksPersistentStore * udisks_persistent_store_new     (const gchar *path,
                                                         const gchar *temp_path);
const gchar *       udisks_persistent_store_get_path    (UDisksPersistentStore *store);
const gchar *       udisks_persistent_store_get_temp_path
                                                        (UDisksPersistentStore *store);
enum                UDisksPersistentFlags;
GVariant *          udisks_persistent_store_get         (UDisksPersistentStore *store,
                                                         UDisksPersistentFlags flags,
                                                         const gchar *key,
                                                         const GVariantType *type,
                                                         GError **error);
gboolean            udisks_persistent_store_set         (UDisksPersistentStore *store,
                                                         UDisksPersistentFlags flags,
                                                         const gchar *key,
                                                         const GVariantType *type,
                                                         GVariant *value,
                                                         GError **error);

Object Hierarchy

  GObject
   +----UDisksPersistentStore

Properties

  "path"                     gchar*                : Read / Write / Construct Only
  "temp-path"                gchar*                : Read / Write / Construct Only

Description

Object used to store information that persists across the life cycle of the process.

The low-level interface consists of udisks_persistent_store_get() and udisks_persistent_store_set() that can be used to get/set any GVariant.

Details

UDisksPersistentStore

typedef struct _UDisksPersistentStore UDisksPersistentStore;

The UDisksPersistentStore structure contains only private data and should only be accessed using the provided API.


udisks_persistent_store_new ()

UDisksPersistentStore * udisks_persistent_store_new     (const gchar *path,
                                                         const gchar *temp_path);

Creates a new UDisksPersistentStore object.

Data will be stored in a sub-directory of path and temp_path called udisks-persistence-2.0. See the "path" and "temp-path" properties for more information.

path :

Path to where to store data that will persist across reboots (e.g. /var/lib/udisks2).

temp_path :

Path to where to store data that will persist only until next reboot (e.g. /run/udisks2).

Returns :

A UDisksPersistentStore. Free with g_object_unref().

udisks_persistent_store_get_path ()

const gchar *       udisks_persistent_store_get_path    (UDisksPersistentStore *store);

Gets the path that store stores its data at.

store :

A UDisksPersistentStore.

Returns :

A string owned by store. Do not free.

udisks_persistent_store_get_temp_path ()

const gchar *       udisks_persistent_store_get_temp_path
                                                        (UDisksPersistentStore *store);

Gets the that store stores its temporary data at.

store :

A UDisksPersistentStore.

Returns :

A string owned by store. Do not free.

enum UDisksPersistentFlags

typedef enum
{
  UDISKS_PERSISTENT_FLAGS_NONE = 0,
  UDISKS_PERSISTENT_FLAGS_NORMAL_STORE = (1<<0),
  UDISKS_PERSISTENT_FLAGS_TEMPORARY_STORE = (1<<1),
} UDisksPersistentFlags;

Flag enumeration used in the UDisksPersistentStore type.

UDISKS_PERSISTENT_FLAGS_NONE

No flags set.

UDISKS_PERSISTENT_FLAGS_NORMAL_STORE

The value should be set/get in the database that persist across reboots.

UDISKS_PERSISTENT_FLAGS_TEMPORARY_STORE

The value should be set/get in the database that does not persist across reboots.

udisks_persistent_store_get ()

GVariant *          udisks_persistent_store_get         (UDisksPersistentStore *store,
                                                         UDisksPersistentFlags flags,
                                                         const gchar *key,
                                                         const GVariantType *type,
                                                         GError **error);

Low-level function to look up the value for key, if any.

store :

A UDisksPersistentStore.

flags :

Zero or more flags from the UDisksPersistentFlags enumeration.

key :

The key to get the value for. Must be ASCII and not contain the '/' character.

type :

A definite GVariantType.

error :

Return location for error or NULL.

Returns :

The value or NULL if not found or if error is set. The returned GVariant must be freed with g_variant_unref().

udisks_persistent_store_set ()

gboolean            udisks_persistent_store_set         (UDisksPersistentStore *store,
                                                         UDisksPersistentFlags flags,
                                                         const gchar *key,
                                                         const GVariantType *type,
                                                         GVariant *value,
                                                         GError **error);

Low-level function that sets the value for key to value.

If value is floating it is consumed.

store :

A UDisksPersistentStore.

flags :

Zero or more flags from the UDisksPersistentFlags enumeration.

key :

The key to get the value for. Must be ASCII and not contain the '/' character.

type :

A definite GVariantType.

value :

The value to set.

error :

Return location for error or NULL.

Returns :

TRUE if setting the value succeeded, FALSE if error is set.

Property Details

The "path" property

  "path"                     gchar*                : Read / Write / Construct Only

The path to store data that will persist across reboots.

Data will be stored in this directory - if it does not exist, it will be created with mode 0700.

Default value: NULL


The "temp-path" property

  "temp-path"                gchar*                : Read / Write / Construct Only

The path to store data that will not persist across reboots.

Data will be stored in this directory - if it does not exist, it will be created with mode 0700.

Default value: NULL