## InfdFilesystemAccountStorage

InfdFilesystemAccountStorage — Standalone account storage backend

## Stability Level

Unstable, unless otherwise indicated

## Functions

InfdFilesystemAccountStorage * | infd_filesystem_account_storage_new ()
gboolean | infd_filesystem_account_storage_set_filesystem ()

## Properties

InfdFilesystemStorage * | filesystem-storage | Read / Write

## Types and Values

struct | InfdFilesystemAccountStorage
struct | InfdFilesystemAccountStorageClass
enum | InfdFilesystemAccountStorageError

## Object Hierarchy

        GObject
        ╰── InfdFilesystemAccountStorage

## Implemented Interfaces

InfdFilesystemAccountStorage implements InfdAccountStorage.

## Includes

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

## 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.

## Functions

### 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.

[constructor]

#### Returns

A new InfdFilesystemAccountStorage.

[transfer full]

### 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.

#### Parameters

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.

## Types and Values

### struct InfdFilesystemAccountStorage

    struct 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

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.

#### Members

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. |

## Property Details

### The `“filesystem-storage”` property

      “filesystem-storage”       InfdFilesystemStorage *

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

Owner: InfdFilesystemAccountStorage

Flags: Read / Write

## See Also

InfdAccountStorage, InfdDirectory