APIFolder store

Folder store

An implementation of the folder store specification.

Instance creation

FolderStore folderStore = FolderStore.forUrl(folder);
my $folderStore = CDS::FolderStore->forUrl($url);

Instantiates a folder store for a url of the form:

file:///PATH/TO/STORE
FolderStore folderStore = new FolderStore(folder);
my $folderStore = CDS::FolderStore->new($folder);

Instantiates a folder store for a folder (File object)(local filesystem path).

Store behavior

Each store request results in one or more file system operations.

Administration

boolean success = folderStore.createIfNecessary();
my $success = $folderStore->createIfNecessary;

Initializes an empty store in the store folder, unless this has been done before. The store folder itself must exist and be writable.

The return value tells whether the store exists when the function returns, independently of whether is has been created, or already existed.

my @accountHashes = $folderStore->accounts;

Returns the list of accounts. Each account is a hash.

my $ok = $folderStore->addAccount($accountHash);

Adds an account by creating its account and (empty) box folders.

my $ok = $folderStore->removeAccount($accountHash);

Removes an account and deletes its boxes.

Removal is done in two steps: the account folder is first renamed to ".deleted-RANDOMSEQUENCE", and then removed. If removal fails, an obsolete ".deleted-RANDOMSEQUENCE" folder will remain, which can safely be removed manually by an administrator.

my $ok = $folderStore->checkPermissions($logger);

Checks, and optionally fixes POSIX permissions of this store. This traverses all objects and accounts of the store, and may therefore take some time.

For logger examples, see

The folder store is currently only implemented in Java and Perl.

See also