Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*/
package io.trino.filesystem.encryption;

import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.ThreadLocalRandom;

import static java.util.Objects.requireNonNull;
Expand All @@ -38,4 +40,24 @@ public String toString()
// We intentionally overwrite toString to hide a key
return algorithm;
}

@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}

if (!(o instanceof EncryptionKey that)) {
return false;
}
return Objects.deepEquals(key, that.key)
&& Objects.equals(algorithm, that.algorithm);
}

@Override
public int hashCode()
{
return Objects.hash(Arrays.hashCode(key), algorithm);
}
}
53 changes: 48 additions & 5 deletions plugin/trino-spooling-filesystem/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
</properties>

<dependencies>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink</artifactId>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
Expand Down Expand Up @@ -143,6 +138,36 @@
<scope>provided</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>auth</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-core</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>regions</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>sdk-core</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>junit-extensions</artifactId>
Expand All @@ -166,5 +191,23 @@
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>localstack</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
package io.trino.spooling.filesystem;

import io.airlift.slice.Slice;
import io.azam.ulidj.ULID;
import io.trino.filesystem.Location;
import io.trino.filesystem.encryption.EncryptionKey;
import io.trino.spi.QueryId;
import io.trino.spi.protocol.SpooledSegmentHandle;
import io.trino.spi.protocol.SpoolingContext;
Expand All @@ -28,7 +28,7 @@
import static com.google.common.base.Verify.verify;
import static java.util.Objects.requireNonNull;

public record FileSystemSpooledSegmentHandle(@Override String encoding, @Override QueryId queryId, byte[] uuid, Optional<Slice> encryptionKey)
public record FileSystemSpooledSegmentHandle(@Override String encoding, @Override QueryId queryId, byte[] uuid, Optional<EncryptionKey> encryptionKey)
implements SpooledSegmentHandle
{
private static final String OBJECT_NAME_SEPARATOR = "::";
Expand All @@ -45,7 +45,7 @@ public static FileSystemSpooledSegmentHandle random(Random random, SpoolingConte
return random(random, context, expireAt, Optional.empty());
}

public static FileSystemSpooledSegmentHandle random(Random random, SpoolingContext context, Instant expireAt, Optional<Slice> encryptionKey)
public static FileSystemSpooledSegmentHandle random(Random random, SpoolingContext context, Instant expireAt, Optional<EncryptionKey> encryptionKey)
{
return new FileSystemSpooledSegmentHandle(
context.encoding(),
Expand Down
Loading