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
5 changes: 5 additions & 0 deletions .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ jobs:
run: |
mvn test

- name: Maven Test with transient-nio2
run: |
# TODO: run other test classes
mvn test -Ds3proxy.test.conf=s3proxy-transient-nio2.conf -Dtest=AwsSdkTest

- name: Install Azurite
run: npx --yes --loglevel info azurite --version
- name: Start Azurite
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ Maven Central hosts S3Proxy artifacts and the wiki has
* rackspace-cloudfiles-uk and rackspace-cloudfiles-us
* s3 (all implementations)
* transient (in-memory storage)
* transient-nio2 (in-memory storage, preview)

See the wiki for [examples of configurations](https://github.com/gaul/s3proxy/wiki/Storage-backend-examples).

Expand Down
5 changes: 5 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,11 @@
<artifactId>guava</artifactId>
<version>32.0.0-jre</version>
</dependency>
<dependency>
<groupId>com.google.jimfs</groupId>
<artifactId>jimfs</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/gaul/s3proxy/Quirks.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ final class Quirks {
"filesystem",
"google-cloud-storage",
"openstack-swift",
"transient"
"transient",
"transient-nio2"
);

/** Blobstores with opaque ETags. */
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/gaul/s3proxy/S3ProxyHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2265,7 +2265,11 @@ private void handleCompleteMultipartUpload(HttpServletRequest request,
String uploadId) throws IOException, S3Exception {
BlobMetadata metadata;
PutOptions options;
if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType(
if ("transient-nio2".equals(getBlobStoreType(blobStore))) {
// TODO: transient-nio2 does not yet support blob access
metadata = blobStore.blobMetadata(containerName, uploadId);
options = new PutOptions();
} else if (Quirks.MULTIPART_REQUIRES_STUB.contains(getBlobStoreType(
blobStore))) {
metadata = blobStore.blobMetadata(containerName, uploadId);
BlobAccess access = blobStore.getBlobAccess(containerName,
Expand Down
80 changes: 80 additions & 0 deletions src/main/java/org/gaul/s3proxy/nio2blob/Nio2BlobApiMetadata.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright 2014-2024 Andrew Gaul <andrew@gaul.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gaul.s3proxy.nio2blob;

import java.net.URI;
import java.util.Properties;
import java.util.Set;

import org.jclouds.blobstore.BlobStoreContext;
import org.jclouds.reflect.Reflection2;
import org.jclouds.rest.internal.BaseHttpApiMetadata;

public final class Nio2BlobApiMetadata extends BaseHttpApiMetadata {
public Nio2BlobApiMetadata() {
this(builder());
}

protected Nio2BlobApiMetadata(Builder builder) {
super(builder);
}

private static Builder builder() {
return new Builder();
}

@Override
public Builder toBuilder() {
return builder().fromApiMetadata(this);
}

public static Properties defaultProperties() {
return BaseHttpApiMetadata.defaultProperties();
}

// Fake API client
private interface Nio2BlobClient {
}

public static final class Builder
extends BaseHttpApiMetadata.Builder<Nio2BlobClient, Builder> {
protected Builder() {
super(Nio2BlobClient.class);
id("transient-nio2")
.name("NIO.2 Blobstore")
.identityName("Account Name")
.credentialName("Access Key")
.defaultEndpoint("http://localhost/")
.documentation(URI.create(
"http://www.jclouds.org/documentation/userguide" +
"/blobstore-guide"))
.defaultProperties(Nio2BlobApiMetadata.defaultProperties())
.view(Reflection2.typeToken(BlobStoreContext.class))
.defaultModules(Set.of(Nio2BlobStoreContextModule.class));
}

@Override
public Nio2BlobApiMetadata build() {
return new Nio2BlobApiMetadata(this);
}

@Override
protected Builder self() {
return this;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright 2014-2024 Andrew Gaul <andrew@gaul.org>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.gaul.s3proxy.nio2blob;

import java.util.Properties;

import com.google.auto.service.AutoService;

import org.jclouds.providers.ProviderMetadata;
import org.jclouds.providers.internal.BaseProviderMetadata;

/**
* Implementation of org.jclouds.types.ProviderMetadata for NIO.2 filesystems.
*/
@AutoService(ProviderMetadata.class)
public final class Nio2BlobProviderMetadata extends BaseProviderMetadata {
public Nio2BlobProviderMetadata() {
super(builder());
}

public Nio2BlobProviderMetadata(Builder builder) {
super(builder);
}

public static Builder builder() {
return new Builder();
}

@Override
public Builder toBuilder() {
return builder().fromProviderMetadata(this);
}

public static Properties defaultProperties() {
Properties properties = new Properties();
// TODO: filesystem basedir
return properties;
}
public static final class Builder extends BaseProviderMetadata.Builder {
protected Builder() {
id("transient-nio2")
.name("NIO.2 filesystem blobstore")
.apiMetadata(new Nio2BlobApiMetadata())
.endpoint("https://127.0.0.1") // TODO:
.defaultProperties(
Nio2BlobProviderMetadata.defaultProperties());
}

@Override
public Nio2BlobProviderMetadata build() {
return new Nio2BlobProviderMetadata(this);
}

@Override
public Builder fromProviderMetadata(
ProviderMetadata in) {
super.fromProviderMetadata(in);
return this;
}
}
}
Loading