Skip to content

Commit

Permalink
Merge pull request #318 from iExecBlockchainComputing/hotfix/get-tagg…
Browse files Browse the repository at this point in the history
…ed-wp-orders

Add `getTaggedWorkerpoolOrders` methods
  • Loading branch information
mcornaton authored Apr 12, 2022
2 parents 561691e + 71cd31e commit b7329a2
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=5.9.2
version=5.9.3
nexusUser=
nexusPassword=
26 changes: 24 additions & 2 deletions src/main/java/com/iexec/common/sdk/marketplace/Marketplace.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,31 @@ public interface Marketplace {

public List<WorkerpoolMarketOrder> getWorkerpoolOrders();

public Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrder(String workerpoolAddress);
public Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrderByWorkerpoolAddress(String workerpoolAddress);

public List<WorkerpoolMarketOrder> getWorkerpoolOrders(String workerpoolAddress);
/**
* @deprecated Use {@link Marketplace#getOneWorkerpoolOrderByWorkerpoolAddress(String)} instead.
*/
@Deprecated(forRemoval = true)
default Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrder(String workerpoolAddress) {
return getOneWorkerpoolOrderByWorkerpoolAddress(workerpoolAddress);
}

public List<WorkerpoolMarketOrder> getWorkerpoolOrdersByWorkerpoolAddress(String workerpoolAddress);

/**
* @deprecated Use {@link Marketplace#getWorkerpoolOrdersByWorkerpoolAddress(String)} instead.
*/
@Deprecated(forRemoval = true)
default List<WorkerpoolMarketOrder> getWorkerpoolOrders(String workerpoolAddress) {
return getWorkerpoolOrdersByWorkerpoolAddress(workerpoolAddress);
}

List<WorkerpoolMarketOrder> getWorkerpoolOrdersByTag(String tag);

Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrderByWorkerpoolAddressAndTag(String workerpoolAddress, String tag);

List<WorkerpoolMarketOrder> getWorkerpoolOrdersByWorkerpoolAddressAndTag(String workerpoolAddress, String tag);

public Optional<AppMarketOrder> getOneAppOrder(String appAddress);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,46 @@ public List<WorkerpoolMarketOrder> getWorkerpoolOrders() {
}

@Override
public Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrder(String workerpoolAddress) {
return getWorkerpoolOrders(workerpoolAddress)
public Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrderByWorkerpoolAddress(String workerpoolAddress) {
return getWorkerpoolOrdersByWorkerpoolAddress(workerpoolAddress)
.stream()
.findFirst();
}

@Override
public List<WorkerpoolMarketOrder> getWorkerpoolOrders(String workerpoolAddress) {
public List<WorkerpoolMarketOrder> getWorkerpoolOrdersByWorkerpoolAddress(String workerpoolAddress) {
MPQueryParams queryParams = MPQueryParams.builder()
.workerpool(workerpoolAddress)
.build();
return getOrders(OrderType.WORKERPOOL, queryParams);
}

@Override
public List<WorkerpoolMarketOrder> getWorkerpoolOrdersByTag(String tag) {
final MPQueryParams queryParams = MPQueryParams.builder()
.minTag(tag)
.maxTag(tag)
.build();
return getOrders(OrderType.WORKERPOOL, queryParams);
}

@Override
public Optional<WorkerpoolMarketOrder> getOneWorkerpoolOrderByWorkerpoolAddressAndTag(String workerpoolAddress, String tag) {
return getWorkerpoolOrdersByWorkerpoolAddressAndTag(workerpoolAddress, tag)
.stream()
.findFirst();
}

@Override
public List<WorkerpoolMarketOrder> getWorkerpoolOrdersByWorkerpoolAddressAndTag(String workerpoolAddress, String tag) {
MPQueryParams queryParams = MPQueryParams.builder()
.workerpool(workerpoolAddress)
.minTag(tag)
.maxTag(tag)
.build();
return getOrders(OrderType.WORKERPOOL, queryParams);
}

@Override
public Optional<AppMarketOrder> getOneAppOrder(String appAddress) {
return getAppOrders(appAddress)
Expand Down

0 comments on commit b7329a2

Please sign in to comment.