Release 1.1.0
With release 1.1.0, there comes a new set of features and improvements:
- Support sharing of files among one or multiple users (individual read / write permissions possible)
- New process framework speeding up the execution of the operations and enhancing the stability
- More advanced configuration and extension of the library possible
- Optimized model, removed unneeded objects in the DHT
- Per-file encryption instead of per-chunk encryption (less key generation)
- Caching of foreign public keys
- Many bug fixes
- Extended javadoc
The interfaces to create a node have slightly changed, allowing a more detailed peer configuration. Here's an example how to create a master and a 'normal' peer:
// master peer configuration
INetworkConfiguration masterConfig = NetworkConfiguration.create("masterID");
// node peer configuration with bootstrap address
INetworkConfiguration nodeConfig = NetworkConfiguration.create("nodeID", InetAddress.getByName("192.168.1.100"));
// default file configuration
IFileConfiguration defaultFileConfig = FileConfiguration.createDefault();
IH2HNode master = H2HNode.createNode(masterConfig, defaultFileConfig);
master.connect();
IH2HNode node = H2HNode.createNode(nodeConfig, defaultFileConfig);
node.connect();
Here's an example how to interact with the node:
UserCredentials userCredentials = new UserCredentials("user@hive2hive.com", "password", "1234");
// perform operations on the user management
IUserManager userManager = node.getUserManager();
IProcessComponent registerProcess = userManager.register(userCredentials);
// pause & resume the process
registerProcess.pause();
registerProcess.resume();
// attach a listener that are called when finished
registerProcess.attachListener(new IProcessComponentListener() {
@Override
public void onSucceeded() {
System.out.println("Successfully registered");
}
@Override
public void onFinished() {
// ignore
}
@Override
public void onFailed(RollbackReason reason) {
System.out.println("Failed! Reason: " + reason.getHint());
}
});
After a login, the file management can be used:
// for the login, the root folder must be specified
File root = new File(H2HConstants.DEFAULT_ROOT_PATH);
userManager.login(userCredentials, root.toPath());
// add a file
IFileManager fileManager = node.getFileManager();
IProcessComponent addProcess = fileManager.add(new File(root, "demo-file"));