++ed by:
AERO GBOUGARD

2 PAUSE users
1 non-PAUSE user.

Guillaume Bougard

NAME

FusionInventory::Agent::Storage - A data serializer/deserializer

SYNOPSIS

  my $storage = FusionInventory::Agent::Storage->new(
      directory => '/tmp'
  );
  my $data = $storage->restore(
      name => "foobar"
  );

  $data->{foo} = 'bar';

  $storage->save(
      name => "foobar",
      data => $data
  );

DESCRIPTION

This is the object used by the agent to ensure data persistancy between invocations.

The data structure is saved in a dedicated file. The file directory is a configuration parameter for each object.

METHODS

new(%params)

The constructor. The following parameters are allowed, as keys of the %params hash:

logger

the logger object to use

directory

the directory to use for storing data (mandatory)

getDirectory

Returns the underlying directory for this storage.

has(%params)

Returns true if a saved data structure exists. The following arguments are allowed:

name

The file name to use for saving the data structure (mandatory).

save(%params)

Save given data structure. The following parameters are allowed, as keys of the %params hash:

name

The file name to use for saving the data structure (mandatory).

data

The data to be saved (mandatory).

restore(%params)

Restore a saved data structure. The following parameters are allowed, as keys of the %params hash:

name

The file name to use for saving the data structure (mandatory).

remove(%params)

Delete the file containing a seralized data structure for a given file name. The following parameters are allowed, as keys of the %params hash:

name

The file name used to save the data structure (mandatory).