Skip to content

0.3 - Redunda Data Storage

Pre-release
Pre-release
Compare
Choose a tag to compare
@FelixSFD FelixSFD released this 22 Mar 11:41
· 26 commits to master since this release

Introduces Redunda's data storage ( #7 )

With the data storage, your bot can sync files across multiple instances. This can for example be useful for lists of opted-in users.

How to sync files

Automatic synchronization

Get the DataService

You can easily get the DataService with the same API-key as PingService:

DataService redundaData = redunda.buildDataService();

Track files for syncing

Each file that should be automatically synchronized needs to be tracked:

redundaData.trackFile("./myFile");

Note: You should not use absolute paths and a path should not contain the String _slash_.

Start synchronizing

The automatic sync can be started like this:

redundaData.syncAndStart();

This will call syncFiles() synchronously (for proper initialization of your bot) and then start the background thread. Alternatively, you can use start() if you don't need the files on launch.

If you don't want to sync automatically in background, you can just call syncFiles().

Upload and download files manually

If you don't want to sync automatically, you can call the methods for uploading and downloading by yourself. They are the same as syncFiles() uses. Please have a look at the documentation for more information.