APISFTP store

SFTP store

Accesses a folder store over a SSH connection using SFTP.

Instance creation

my $sftpStore = CDS::SFTPStore->forUrl($url);

Instantiates a SFTP store for a url of the form:

sftp://HOST:PORT/PATH/TO/STORE

The port is optional, and defaults to 22.

my $sftpStore = CDS::SFTPStore->new($endPoint, $folder);

Instantiates a SFTP store. End point is the hostname or IP address to connect to, and folder denotes the path to the store folder on that server.

Store behavior

A SSH connection is opened with the first request, and all store requests are handled through that connection.

A store request typically results in several SFTP requests, involving several round trip times (RTTs). Hence, SFTP stores are not particularly efficient.

Administration

my @accountHashes = $sftpStore->accounts;

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

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

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

my $ok = $sftpStore->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.

The SFTP store is currently only implemented in Perl.