The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Convos::Core::Backend::File - Backend for storing object to file

DESCRIPTION

Convos::Core::Backend::File contains methods which is useful for objects that want to be persisted to disk or store state to disk.

Where is data stored

CONVOS_HOME can be set to specify the root location for where to save data from objects. The default directory on *nix systems is something like this:

  $HOME/.local/share/convos/

$HOME is figured out from "my_home" in File::HomeDir.

Directory structure

  $CONVOS_HOME/
  $CONVOS_HOME/joe@example.com/                                 # one directory per user
  $CONVOS_HOME/joe@example.com/user.json                        # user settings
  $CONVOS_HOME/joe@example.com/irc-freenode/connection.json     # connection settings
  $CONVOS_HOME/joe@example.com/irc-freenode/2015/02.log         # connection log
  $CONVOS_HOME/joe@example.com/irc-freenode/2015/10/marcus.log  # dialog log
  $CONVOS_HOME/joe@example.com/irc-freenode/2015/12/#convos.log # dialog log

Notes about the structure:

  • Easy to delete a user and all associated data.

  • Easy to delete a connection and all associated data.

  • One log file per month should not cause too big files.

  • Hard to delete a dialog thread. Ex: all dialogs with "marcus".

  • Hard to search for messages between connections for a given date.

ATTRIBUTES

Convos::Core::Backend::File inherits all attributes from Convos::Core::Backend and implements the following new ones.

home

See "home" in Convos::Core.

METHODS

Convos::Core::Backend::File inherits all methods from Convos::Core::Backend and implements the following new ones.

connections

See "connections" in Convos::Core::Backend.

delete_object

See "delete_object" in Convos::Core::Backend.

load_object

See "load_object" in Convos::Core::Backend.

messages

See "messages" in Convos::Core::Backend.

notifications

See "notifications" in Convos::Core::Backend.

save_object

See "save_object" in Convos::Core::Backend.

users

See "users" in Convos::Core::Backend.

AUTHOR

Jan Henning Thorsen - jhthorsen@cpan.org