Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into python-table-defini…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
devinrsmith committed Aug 15, 2024
2 parents 13b3cf0 + c74e570 commit 835c2fc
Show file tree
Hide file tree
Showing 108 changed files with 3,458 additions and 1,023 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
java-version: '11'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-submission.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
cat gradle.properties
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@v3
uses: gradle/actions/dependency-submission@v4
env:
# Dependencies derived from :server-jetty-app runtimeClasspath get a "runtime" scope and everything else gets
# a "development" scope. Ideally, gradle would be able to pass along the finer dependency details (for
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/docs-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -201,7 +201,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
java-version: '11'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down Expand Up @@ -357,7 +357,7 @@ jobs:
java-version: '11'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-check-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
java-version: '22'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly-image-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
java-version: '11'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/nightly-publish-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ concurrency:
jobs:
nightly-publish:
runs-on: ubuntu-24.04
if: ${{ github.repository_owner == 'deephaven' }}

steps:
- name: Checkout
Expand All @@ -32,7 +33,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quick-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
java-version: '11'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Set JAVA_HOME
run: echo "JAVA_HOME=${{ steps.setup-java-11.outputs.path }}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag-base-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
java-version: '17'

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4

- name: Setup Crane
if: ${{ startsWith(github.ref, 'refs/heads/release/v') }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.Path;
import java.util.*;
import java.util.stream.Stream;

Expand Down Expand Up @@ -111,15 +110,9 @@ public InputStream getInputStream(final SeekableByteChannel channel, final int s
}

@Override
public SeekableByteChannel getWriteChannel(@NotNull final Path path, final boolean append) throws IOException {
final String pathKey = path.toAbsolutePath().toString();
final ChannelType channelType = append ? ChannelType.WriteAppend : ChannelType.Write;
final KeyedObjectHashMap<String, PerPathPool> channelPool = channelPools.get(channelType);
final CachedChannel result = tryGetPooledChannel(pathKey, channelPool);
return result == null
? new CachedChannel(wrappedProvider.getWriteChannel(path, append), channelType, pathKey)
: result.position(append ? result.size() : 0); // The seek isn't really necessary for append; will be at
// end no matter what.
public final CompletableOutputStream getOutputStream(@NotNull final URI uri, final int bufferSizeHint)
throws IOException {
return wrappedProvider.getOutputStream(uri, bufferSizeHint);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
package io.deephaven.util.channel;

import java.io.IOException;
import java.io.OutputStream;

/**
* An {@link OutputStream} that can be marked as done, completed, or rolled back.
* <p>
* The {@link #done()} method is used to flush all buffered data to the underlying storage, {@link #complete()} to
* finalize the write operation, and {@link #rollback()} to cancel the write. Closing this output stream without calling
* complete will not flush data to the underlying storage.
* <p>
* One usage pattern can be like this:
*
* <pre>
* try (final CompletableOutputStream outputStream = CreateCompletableOutputStream()) {
* try {
* IOUtils.copy(inputStream, outputStream);
* outputStream.done(); // Optional; use this to flush buffered data without completing the stream
* outputStream.complete();
* } catch (IOException e) {
* outputStream.rollback();
* }
* }
* </pre>
*/
public abstract class CompletableOutputStream extends OutputStream {

/**
* Flush all buffered data to the underlying storage. This is optional and should be called after the user is done
* writing to the output stream. All writes to the output stream after calling this method will lead to an
* {@link IOException}.
*/
public abstract void done() throws IOException;

/**
* Flush all buffered data and save all written data to the underlying storage. This method should be called after
* the user is done writing to the output stream. All writes to the output stream after calling this method will
* lead to an {@link IOException}.
*/
public abstract void complete() throws IOException;

/**
* Try to roll back any data written to the underlying storage, reverting back to the original state before opening
* this stream. This is an optional operation, as some implementations may not be able to support it.
*/
public abstract void rollback() throws IOException;
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.io.InputStream;
import java.net.URI;
import java.nio.channels.SeekableByteChannel;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Stream;

import static io.deephaven.base.FileUtils.convertToURI;
Expand Down Expand Up @@ -92,11 +90,17 @@ SeekableByteChannel getReadChannel(@NotNull SeekableChannelContext channelContex
*/
InputStream getInputStream(SeekableByteChannel channel, int sizeHint) throws IOException;

default SeekableByteChannel getWriteChannel(@NotNull final String path, final boolean append) throws IOException {
return getWriteChannel(Paths.get(path), append);
}
/**
* Creates a {@link CompletableOutputStream} to write to the given URI.
*
* @param uri the URI to write to
* @param bufferSizeHint the number of bytes the caller expects to buffer before flushing
* @return the output stream
* @throws IOException if an IO exception occurs
* @see CompletableOutputStream
*/
CompletableOutputStream getOutputStream(@NotNull final URI uri, int bufferSizeHint) throws IOException;

SeekableByteChannel getWriteChannel(@NotNull Path path, boolean append) throws IOException;

/**
* Returns a stream of URIs, the elements of which are the entries in the directory. The listing is non-recursive.
Expand Down
Loading

0 comments on commit 835c2fc

Please sign in to comment.