forked from spring-attic/spring-data-aerospike
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support getHosts() and nameSpace() methods along with application.pro…
…perties (has precedence)
- Loading branch information
Showing
7 changed files
with
55 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 1 addition & 23 deletions
24
src/main/java/org/springframework/data/aerospike/config/AerospikeSettings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,31 @@ | ||
package org.springframework.data.aerospike.config; | ||
|
||
import com.aerospike.client.Host; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.util.StringUtils; | ||
|
||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.stream.Collectors; | ||
|
||
@Setter | ||
@Getter | ||
public class AerospikeSettings { | ||
|
||
// Hosts separated by ',' in form of <address>:<port> | ||
String hosts; | ||
// Namespace | ||
@Getter | ||
String namespace; | ||
// Enable scan operation | ||
@Getter | ||
boolean scansEnabled; | ||
// Send user defined key in addition to hash digest on both reads and writes | ||
@Getter | ||
boolean sendKey; | ||
// Create secondary indexes specified using `@Indexed` annotation on startup | ||
@Getter | ||
boolean createIndexesOnStartup; | ||
// Automatically refresh indexes cache every <N> seconds | ||
@Getter | ||
int indexCacheRefreshSeconds; | ||
// Automatically refresh cached server version every <N> seconds | ||
@Getter | ||
int serverVersionRefreshSeconds; | ||
// Limit amount of results returned by server. Non-positive value means no limit | ||
@Getter | ||
long queryMaxRecords; | ||
// Maximum batch size for batch write operations | ||
@Getter | ||
int batchWriteSize; | ||
// Define how @Id fields (primary keys) and Map keys are stored: false - always as String, | ||
// true - preserve original type if supported | ||
@Getter | ||
boolean keepOriginalKeyTypes; | ||
|
||
public Collection<Host> getHosts() { | ||
if (StringUtils.hasText(hosts)) return Arrays.stream(hosts.split(",")) | ||
.map(host -> host.split(":")) | ||
.map(hostArr -> new Host(hostArr[0], Integer.parseInt(hostArr[1]))) | ||
.collect(Collectors.toList()); | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters