Skip to content

Commit

Permalink
IUntillDbStorageApi: updates (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniilSolovyov and sda authored Apr 18, 2024
1 parent 31a34ca commit d6294ad
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import com.untill.driver.IDriverContext;
import com.untill.driver.untillapi.IUntillApi;

import java.util.List;

/**
* UntillAPI allows to write/read data bytes to/from DB by driver configuration GUID and key.
*
Expand Down Expand Up @@ -49,6 +51,15 @@ public interface IUntillDbStorageApi extends IUntillApi {
*/
byte[] read(String configurationGuid, String key);

/**
* Returns the list of the data entries, written by any of the driver instances in network (same driverId!)
*
* @param thisConfigurationGuid driver configuration GUID
* @param key data key
* @return list of {@link StorageItem storage items}
*/
List<StorageItem> readFromAllConfigs(String thisConfigurationGuid, String key);

/**
* Write data bytes by driver configuration GUID and key
*
Expand All @@ -57,4 +68,14 @@ public interface IUntillDbStorageApi extends IUntillApi {
* @param data data bytes
*/
void write(String configurationGuid, String key, byte[] data);

/**
* Write data bytes by driver configuration GUID and key with expiry date
*
* @param configurationGuid driver configuration GUID
* @param key data key
* @param data data bytes
* @param expiryDate unix timestamp in milliseconds
*/
void write(String configurationGuid, String key, byte[] data, long expiryDate);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.untill.driver.untillapi.dbstorage;

public class StorageItem {
/**
* Driver configuration GUID
*/
private String configurationGuid;
/**
* Data bytes
*/
private byte[] data;

public String getConfigurationGuid() {
return configurationGuid;
}

public void setConfigurationGuid(String configurationGuid) {
this.configurationGuid = configurationGuid;
}

public byte[] getData() {
return data;
}

public void setData(byte[] data) {
this.data = data;
}
}

0 comments on commit d6294ad

Please sign in to comment.