Skip to content

Commit

Permalink
Release datarouter 0.0.125
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavbheda committed Jun 1, 2024
1 parent 7d2cb75 commit fd7590a
Show file tree
Hide file tree
Showing 463 changed files with 11,986 additions and 4,659 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ These libraries can be used individually without importing the whole framework.
- Map, Sorted, Indexed, Blob, Tally storage
- [gcp-spanner](datarouter-spanner/README.md)
- Map, Sorted, Indexed, Blob, Tally storage
- [hbase](datarouter-hbase/README.md)
- Map, Sorted storage
- [gcp-bigtable-hbase](datarouter-gcp-bigtable-hbase/README.md)
- [gcp-bigtable](datarouter-gcp-bigtable/README.md)
- Map, Sorted storage
#### Caches
- [memcached](datarouter-memcached/README.md)
Expand Down
2 changes: 1 addition & 1 deletion datarouter-auth-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datarouter-auth-web is a framework that brings in users and apikey accounts to d
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-auth-web</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-auth-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import io.datarouter.httpclient.security.DefaultCsrfGenerator;
import io.datarouter.httpclient.security.SecurityParameters;
import io.datarouter.web.security.CsrfValidationResult;
import io.datarouter.web.security.CsrfValidator;
import io.datarouter.web.security.DefaultCsrfValidator;
import io.datarouter.web.util.http.RequestTool;
Expand All @@ -35,7 +36,7 @@
public class DatarouterAccountCsrfValidator implements CsrfValidator{
private static final Logger logger = LoggerFactory.getLogger(DatarouterAccountCsrfValidator.class);

private final Long requestTimeoutMs;
private final Duration requestTimeout;
private final String apiKeyFieldName;
private final DatarouterAccountCredentialService datarouterAccountCredentialService;

Expand All @@ -50,40 +51,33 @@ public static class DatarouterAccountCsrfValidatorFactory{
*/
@Deprecated
public DatarouterAccountCsrfValidator create(Long requestTimeoutMs){
return create(requestTimeoutMs, SecurityParameters.API_KEY);
return create(Duration.ofMillis(requestTimeoutMs), SecurityParameters.API_KEY);
}

public DatarouterAccountCsrfValidator create(Duration requestTimeout){
return create(requestTimeout.toMillis(), SecurityParameters.API_KEY);
return create(requestTimeout, SecurityParameters.API_KEY);
}

public DatarouterAccountCsrfValidator create(Long requestTimeoutMs, String apiKeyFieldName){
public DatarouterAccountCsrfValidator create(Duration requestTimeoutMs, String apiKeyFieldName){
return new DatarouterAccountCsrfValidator(requestTimeoutMs, apiKeyFieldName,
datarouterAccountCredentialService);
}

}

private DatarouterAccountCsrfValidator(Long requestTimeoutMs,
private DatarouterAccountCsrfValidator(Duration requestTimeout,
String apiKeyFieldName,
DatarouterAccountCredentialService datarouterAccountApiKeyService){
this.requestTimeoutMs = requestTimeoutMs;
this.requestTimeout = requestTimeout;
this.apiKeyFieldName = apiKeyFieldName;
this.datarouterAccountCredentialService = datarouterAccountApiKeyService;
}

@Override
public boolean check(HttpServletRequest request){
public CsrfValidationResult check(HttpServletRequest request){
return getCsrfValidatorForAccountWithApiKey(request)
.map(csrfValidator -> csrfValidator.check(request))
.orElse(false);
}

@Override
public Long getRequestTimeMs(HttpServletRequest request){
return getCsrfValidatorForAccountWithApiKey(request)
.map(csrfValidator -> csrfValidator.getRequestTimeMs(request))
.orElse(null);
.orElse(new CsrfValidationResult(false, "no account found for the given apiKey"));
}

private Optional<DefaultCsrfValidator> getCsrfValidatorForAccountWithApiKey(HttpServletRequest request){
Expand All @@ -94,7 +88,7 @@ private Optional<DefaultCsrfValidator> getCsrfValidatorForAccountWithApiKey(Http
}
return optionalSecretKey
.map(secretKey -> (Supplier<String>)() -> secretKey)
.map(secretKey -> new DefaultCsrfValidator(new DefaultCsrfGenerator(secretKey), requestTimeoutMs));
.map(secretKey -> new DefaultCsrfValidator(new DefaultCsrfGenerator(secretKey), requestTimeout));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,6 @@ public Mav updateCallerType(
+ callerType.get());
}

private static class Html{

public static DivTag makeContent(HtmlForm htmlForm){
var form = Bootstrap4FormHtml.render(htmlForm)
.withClass("card card-body bg-light");
return div(
h2("Datarouter Account Caller Type Updater"),
form,
br())
.withClass("container mt-3");
}

}

private void updateCallerType(String accountName, String callerType){
DatarouterAccount account = accountDao.get(new DatarouterAccountKey(accountName));
String perviousCallerType = Optional.ofNullable(account.getCallerType())
Expand All @@ -129,4 +115,18 @@ private void updateCallerType(String accountName, String callerType){
changelogRecorder.record(dto);
}

private static class Html{

public static DivTag makeContent(HtmlForm htmlForm){
var form = Bootstrap4FormHtml.render(htmlForm)
.withClass("card card-body bg-light");
return div(
h2("Datarouter Account Caller Type Updater"),
form,
br())
.withClass("container mt-3");
}

}

}
2 changes: 1 addition & 1 deletion datarouter-auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datarouter-auth is a framework that brings in users and apikey accounts to datar
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-auth</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
4 changes: 2 additions & 2 deletions datarouter-auth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down Expand Up @@ -81,7 +81,7 @@
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-email</artifactId>
<version>0.0.124</version>
<version>${datarouter-version}</version>
</dependency>
<dependency>
<groupId>io.datarouter</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public static String getUrlInRequestContext(HttpServletRequest request, String p

public static void logSamlObject(String callsite, SAMLObject object){
if(object == null){
logger.debug(callsite + " - SAMLObject is null");
logger.debug("{} - SAMLObject is null", callsite);
return;
}

Expand All @@ -352,7 +352,7 @@ public static void logSamlObject(String callsite, SAMLObject object){
out.marshall(object);
element = object.getDOM();
}catch(MarshallingException e){
logger.error(callsite + " - Failed to marshall SAMLObject", e);
logger.error("{} - Failed to marshall SAMLObject", callsite, e);
return;
}
}
Expand All @@ -363,9 +363,9 @@ public static void logSamlObject(String callsite, SAMLObject object){
DOMSource source = new DOMSource(element);
transformer.transform(source, result);
String xmlString = result.getWriter().toString();
logger.debug(callsite + " - " + xmlString);
logger.debug("{} - {}", callsite, xmlString);
}catch(TransformerException e){
logger.error(callsite + " - Failed to log SAML object.", e);
logger.error("{} - Failed to log SAML object.", callsite, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ protected String getDefaultUserGroupId(){
private void checkAndWarnOverride(String key, Map<String,Set<Role>> configurableRoleGroups){
Objects.requireNonNull(key, "Super and default role group IDs must be defined.");
if(configurableRoleGroups.containsKey(key)){
logger.warn("ConfigurableRoleGroups uses a reserved role group ID, which will be ignored. Override "
+ "getSuperUserGroupId or getDefaultUserGroupId to use this role group ID: " + key);
logger.warn("ConfigurableRoleGroups uses a reserved role group ID, which will be ignored. Override"
+ " getSuperUserGroupId or getDefaultUserGroupId to use this role group ID: {}", key);
}
}

Expand Down
2 changes: 1 addition & 1 deletion datarouter-auto-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ datarouter-auto-config is a tool that can be used to do any type of automatic co
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-auto-config</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-auto-config/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-elb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datarouter-aws-elb provides tools to monitor amazon's elastic-load-balancer conf
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-aws-elb</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-elb/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-memcached/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datarouter-aws-memcached uses the elasticache-java-cluster-client to talk to Ama
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-aws-memcached</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-memcached/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-rds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ datarouter-aws-rds provides tools to monitor amazon's relational-database-servic
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-aws-elb</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-rds/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ private DivTag makeAuroraClientsTable(String header, Collection<DnsHostEntryDto>
.withColumn("Hostname", DnsHostEntryDto::getHostname)
.withColumn("Cluster hostname", DnsHostEntryDto::getClusterHostname)
.withColumn("Cluster name", DnsHostEntryDto::getClusterName)
.withColumn("Replcation role", DnsHostEntryDto::getReplicationRole)
.withColumn("Replication role", DnsHostEntryDto::getReplicationRole)
.withColumn("Instance hostname", DnsHostEntryDto::getInstanceHostname)
.withColumn("IP", DnsHostEntryDto::getIp)
.withHtmlColumn("X", row -> {
Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ It supports uploading using an `OutputStream` or `BufferedWriter` of unpredictab
<dependency>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-aws-s3</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion datarouter-aws-s3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.datarouter</groupId>
<artifactId>datarouter-parent</artifactId>
<version>0.0.124</version>
<version>0.0.125</version>
<relativePath>../datarouter-parent</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,6 @@ public void multithreadUpload(

/*---------- data write bytes multipart Scanner ---------*/

private record MultithreadUploadPartNumberAndData(
int number,
InputStreamAndLength data){
}

/**
* Allows the caller to provide full parts, avoiding a memory copy. Not usually needed for normal usage.
*/
Expand All @@ -273,6 +268,11 @@ public void multithreadUpload(
}
}

private record MultithreadUploadPartNumberAndData(
int number,
InputStreamAndLength data){
}

/*----------- data write bytes multipart sub-ops ----------*/

public String createMultipartUploadRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.datarouter.aws.s3.DatarouterS3Client;
import io.datarouter.aws.s3.S3Limits;
import io.datarouter.bytes.ByteLength;
import io.datarouter.storage.blob.DatarouterBlobVacuumResult;
import io.datarouter.storage.file.BucketAndKey;
import io.datarouter.storage.file.BucketAndKeys;
import io.datarouter.storage.file.BucketAndPrefix;
Expand All @@ -48,7 +49,7 @@ public DatarouterS3Vacuum(
this.logEachObject = logEachObject;
}

public DatarouterS3VacuumResult vacuum(){
public DatarouterBlobVacuumResult vacuum(){
var numObjectsConsidered = new AtomicLong();
var numObjectsDeleted = new AtomicLong();
var numBytesConsidered = new AtomicLong();
Expand All @@ -73,11 +74,13 @@ public DatarouterS3VacuumResult vacuum(){
numObjectsDeleted.incrementAndGet();
numBytesDeleted.addAndGet(s3Object.size());
})
.map(s3Object -> new BucketAndKey(bucketAndPrefix.bucket(), s3Object.key()))
.map(s3Object -> BucketAndKey.withoutBlobStorageCompatibilityValidation(
bucketAndPrefix.bucket(),
s3Object.key()))
.batch(S3Limits.MAX_DELETE_MULTI_KEYS)
.map(BucketAndKeys::fromIndividualKeys)
.forEach(s3Client::deleteMulti);
return new DatarouterS3VacuumResult(
return new DatarouterBlobVacuumResult(
bucketAndPrefix,
cutOffTime,
numObjectsConsidered.get(),
Expand Down
Loading

0 comments on commit fd7590a

Please sign in to comment.