InfdFilesystemAccountStorage

InfdFilesystemAccountStorage — Standalone account storage backend

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <libinfinity/server/infd-filesystem-account-storage.h>

                    InfdFilesystemAccountStorage;
struct              InfdFilesystemAccountStorageClass;
enum                InfdFilesystemAccountStorageError;
InfdFilesystemAccountStorage * infd_filesystem_account_storage_new
                                                        (void);
gboolean            infd_filesystem_account_storage_set_filesystem
                                                        (InfdFilesystemAccountStorage *s,
                                                         InfdFilesystemStorage *fs,
                                                         GError **error);

Object Hierarchy

  GObject
   +----InfdFilesystemAccountStorage

Implemented Interfaces

InfdFilesystemAccountStorage implements InfdAccountStorage.

Properties

  "filesystem-storage"       InfdFilesystemStorage*  : Read / Write

Description

This class implements the InfdAccountStorage interface via an underlying InfdFilesystemStorage. It uses the "root-directory" of that underlying storage to store an XML file there which contains the account information.

This is a simple implementation of an account storage which keeps all accounts read from the file in memory. When you have more than a thousand accounts or so you should start thinking of using a more sophisticated account storage, for example a database backend.

Details

InfdFilesystemAccountStorage

typedef struct _InfdFilesystemAccountStorage InfdFilesystemAccountStorage;

InfdFilesystemAccountStorage is an opaque data type. You should only access it via the public API functions.


struct InfdFilesystemAccountStorageClass

struct InfdFilesystemAccountStorageClass {
};

This structure does not contain any public fields.


enum InfdFilesystemAccountStorageError

typedef enum {
  INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_INVALID_FORMAT,
  INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_DUPLICATE_NAME,
  INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_DUPLICATE_CERTIFICATE,
  INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_IDS_EXHAUSTED,
  INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_NO_SUCH_ACCOUNT
} InfdFilesystemAccountStorageError;

Specifies the possible error codes in the INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR error domain. Such errors can occur when reading the accounts file from disk.

INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_INVALID_FORMAT

An on-disk XML file is not formatted correctly.

INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_DUPLICATE_NAME

An account name is already in use.

INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_DUPLICATE_CERTIFICATE

An account which uses the same certificate to login exists already.

INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_IDS_EXHAUSTED

Could not obtain a unique account ID.

INFD_FILESYSTEM_ACCOUNT_STORAGE_ERROR_NO_SUCH_ACCOUNT

The account with the given ID does not exist.

infd_filesystem_account_storage_new ()

InfdFilesystemAccountStorage * infd_filesystem_account_storage_new
                                                        (void);

Creates a new InfdFilesystemAccountStorage that stores its account list as a file in the filesystem. Use infd_filesystem_account_storage_set_filesystem() to set the underlying InfdFilesystemStorage object.

Returns :

A new InfdFilesystemAccountStorage.

infd_filesystem_account_storage_set_filesystem ()

gboolean            infd_filesystem_account_storage_set_filesystem
                                                        (InfdFilesystemAccountStorage *s,
                                                         InfdFilesystemStorage *fs,
                                                         GError **error);

Uses fs as the underlying InfdFilesystemStorage for s. The "root-directory" property specifies where the account list is stored.

If an error occurs while loading the account list, the function returns FALSE and error is set.

s :

A InfdFilesystemAccountStorage.

fs :

The underlying InfdFilesystemStorage to use.

error :

Location for error information, if any, or NULL.

Returns :

TRUE on success or FALSE on error.

Property Details

The "filesystem-storage" property

  "filesystem-storage"       InfdFilesystemStorage*  : Read / Write

The filesystem storage which to use the store the accounts file.

See Also

InfdAccountStorage, InfdDirectory