Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
a370a7b
WIP reconfigure only changed namespaces
attilakreiner May 31, 2024
3757300
WIP watch resources
attilakreiner Jun 5, 2024
c02e5c4
WIP refactoring watch resources
attilakreiner Jun 5, 2024
8fcae70
WIP refactoring 2
attilakreiner Jun 5, 2024
96f070e
WIP fix
attilakreiner Jun 6, 2024
df0b998
WIP EngineConfigWatcher
attilakreiner Jun 6, 2024
c0a554f
WIP ResourceResolver
attilakreiner Jun 6, 2024
b726267
WIP fix ResourceResolver
attilakreiner Jun 6, 2024
9c2cbbe
fix indentation
attilakreiner Jun 10, 2024
abb923f
fix EngineManager method names
attilakreiner Jun 10, 2024
b9355c6
rm ResourceResolver
attilakreiner Jun 10, 2024
c58ebc9
WIP EngineManager addResources
attilakreiner Jun 10, 2024
2285123
Revert "WIP reconfigure only changed namespaces"
attilakreiner Jun 11, 2024
39f34d0
fix EngineConfigWatcher addResources
attilakreiner Jun 11, 2024
b482fac
Merge branch 'develop' into config-reload
attilakreiner Jun 11, 2024
fd17488
Merge branch 'develop' into config-reload
attilakreiner Jun 13, 2024
b6c2ff2
Merge branch 'develop' into config-reload
attilakreiner Jun 14, 2024
2da3603
WIP readPath resolvePath readLocation
attilakreiner Jun 11, 2024
c85bdc1
WIP filesystem-http
attilakreiner Jun 5, 2024
ab94dac
WIP
attilakreiner Jun 18, 2024
22a2d03
fix
attilakreiner Jun 18, 2024
dfe9610
Merge branch 'develop' into config-reload
attilakreiner Jun 18, 2024
e4cf407
fix
attilakreiner Jun 18, 2024
df172d8
fix EngineConfiguration configPath
attilakreiner Jun 19, 2024
bef04ad
WIP fix
attilakreiner Jun 19, 2024
3177c80
WIP hfs 1
attilakreiner Jun 20, 2024
2a217f8
WIP hfs uri
attilakreiner Jun 20, 2024
4f5737a
WIP hfs resolveSibling
attilakreiner Jun 20, 2024
6395780
WIP hfs rm timeout
attilakreiner Jun 20, 2024
54a2b87
WIP hfs revert send
attilakreiner Jun 20, 2024
a5d0a39
WIP hfs HP readBody resolveBody
attilakreiner Jun 20, 2024
f19e623
WIP hfs HP readBody etag
attilakreiner Jun 20, 2024
a8a4015
WIP hfs HP
attilakreiner Jun 20, 2024
c2efe21
WIP hfs ignore AppIT
attilakreiner Jun 20, 2024
873b5e1
WIP hfs fix AppIT
attilakreiner Jun 20, 2024
c166431
WIP hfs watchBody 1
attilakreiner Jun 20, 2024
0c0f7f4
WIP hfs watchBody 2
attilakreiner Jun 20, 2024
31b420c
WIP hfs watchBody 3
attilakreiner Jun 21, 2024
d3109f7
WIP hfs watchBody 4
attilakreiner Jun 21, 2024
3198b10
WIP hfs watchBody 5
attilakreiner Jun 21, 2024
ef2d377
WIP hfs watchBody 6
attilakreiner Jun 21, 2024
8f982fe
WIP hfs getPath
attilakreiner Jun 21, 2024
50c8792
WIP hfs watchBody 7
attilakreiner Jun 21, 2024
71231a9
WIP fix
attilakreiner Jun 21, 2024
7535666
Remove BindingConfig.readLocation
jfallows Jun 26, 2024
e7c6c56
No watch event needed for identical response body
jfallows Jun 26, 2024
5423718
Handle status 204 with null body and infer delay for optional prefer …
jfallows Jun 26, 2024
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
Prev Previous commit
Next Next commit
WIP hfs 1
  • Loading branch information
attilakreiner committed Jun 20, 2024
commit 3177c8043a94c9fbf672c3e6fde28592001bcfb9
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;

public abstract class HttpBaseFileSystemProvider extends FileSystemProvider
public abstract class AbstractHttpFileSystemProvider extends FileSystemProvider
{
private static final Duration TIMEOUT = Duration.ofSeconds(5);
private static final HttpClient HTTP_CLIENT = HttpClient.newBuilder()
Expand Down Expand Up @@ -119,6 +119,7 @@ public InputStream newInputStream(
Path path,
OpenOption... options)
{
// TODO: Ati - chk if path is http/s -> cast it to HttpPath
return new ByteArrayInputStream(resolveBody(path));
}

Expand Down Expand Up @@ -155,6 +156,7 @@ public SeekableByteChannel newByteChannel(
Set<? extends OpenOption> options,
FileAttribute<?>... attrs)
{
// TODO: Ati - chk if path is http/s -> cast it to HttpPath
return new ReadOnlyByteArrayChannel(resolveBody(path));
}

Expand Down Expand Up @@ -314,19 +316,30 @@ private void checkUri(
}
}

// TODO: Ati - this should be the new resolveBody
/*private byte[] resolveBody(
Path path)
//HttpPath path)
{
// TODO: Ati - this should delegate the call to HttpPath path.resolveBody()
return readBody(path);
}*/

// TODO: Ati - remove this
private byte[] resolveBody(
Path path)
{
byte[] body;
HttpFileSystem fileSystem = fileSystems.get(path.toUri());
//HttpFileSystem fileSystem = fileSystems.get(path.toUri());
HttpFileSystem fileSystem = (HttpFileSystem) path.getFileSystem();
if (fileSystem != null && fileSystem.body() != null)
{
System.out.println("HBFSP resolveBody fs.body"); // TODO: Ati
System.out.println("AHFSP resolveBody fs.body"); // TODO: Ati
body = fileSystem.body();
}
else
{
System.out.println("HBFSP resolveBody readBody"); // TODO: Ati
System.out.println("AHFSP resolveBody readBody"); // TODO: Ati
body = readBody(path);
}
return body;
Expand All @@ -343,17 +356,17 @@ private static byte[] readBody(
.uri(path.toUri())
.timeout(TIMEOUT)
.build();
System.out.println("HBFSP readBody path " + path + " request " + request); // TODO: Ati
System.out.println("AHFSP readBody path " + path + " request " + request); // TODO: Ati
HttpResponse<byte[]> response = HTTP_CLIENT.send(request, HttpResponse.BodyHandlers.ofByteArray());
System.out.println("HBFSP readBody response.body " + new String(response.body())); // TODO: Ati
System.out.println("AHFSP readBody response.body " + new String(response.body())); // TODO: Ati
if (response.statusCode() == HTTP_OK)
{
body = response.body();
}
}
catch (Exception ex)
{
System.out.println("HBFSP readBody exception " + ex); // TODO: Ati
System.out.println("AHFSP readBody exception " + ex); // TODO: Ati
rethrowUnchecked(ex);
}
return body;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,26 @@
import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.WatchService;
import java.nio.file.attribute.UserPrincipalLookupService;
import java.nio.file.spi.FileSystemProvider;
import java.util.Set;

public class HttpFileSystem extends FileSystem
public final class HttpFileSystem extends FileSystem
{
public static final String SEPARATOR = "/";

private final HttpBaseFileSystemProvider provider;
private final URI uri;
private final AbstractHttpFileSystemProvider provider;
private final URI root;

private byte[] body;
private byte[] body; // TODO: Ati - body should be moved from HFS to HttpPath

HttpFileSystem(
HttpBaseFileSystemProvider provider,
URI uri)
AbstractHttpFileSystemProvider provider,
URI root)
{
this.provider = provider;
this.uri = uri;
this.body = null;
this.root = root;
this.body = null; // TODO: Ati - body should be moved from HFS to HttpPath
}

@Override
Expand All @@ -55,7 +54,7 @@ public FileSystemProvider provider()
@Override
public void close()
{
provider.closeFileSystem(uri);
provider.closeFileSystem(root);
}

@Override
Expand Down Expand Up @@ -129,21 +128,27 @@ public UserPrincipalLookupService getUserPrincipalLookupService()
}

@Override
public WatchService newWatchService()
//public WatchService newWatchService()
public HttpWatchService newWatchService()
{
return new HttpWatchService(this);
//return new HttpWatchService(this);
HttpWatchService service = new HttpWatchService(this);
service.start();
return service;
}

URI baseUri()
{
return this.uri;
return this.root;
}

// TODO: Ati - body should be moved from HFS to HttpPath
byte[] body()
{
return body;
}

// TODO: Ati - body should be moved from HFS to HttpPath
void body(
byte[] body)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
*/
package io.aklivity.zilla.runtime.filesystem.http;

public class HttpFileSystemProvider extends HttpBaseFileSystemProvider
public final class HttpFileSystemProvider extends AbstractHttpFileSystemProvider
{
public static final String SCHEME = "http";
private static final String SCHEME = "http";

@Override
public final String getScheme()
public String getScheme()
{
return SCHEME;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
*/
package io.aklivity.zilla.runtime.filesystem.http;

import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;
import static java.util.Objects.requireNonNull;
import static org.agrona.LangUtil.rethrowUnchecked;

Expand All @@ -23,7 +22,6 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.FileSystem;
import java.nio.file.LinkOption;
import java.nio.file.Path;
import java.nio.file.ProviderMismatchException;
Expand All @@ -37,10 +35,12 @@ public class HttpPath implements Path
{
private final HttpFileSystem fs;
private final URL url;
//private final URI location;

HttpPath(
HttpFileSystem fs,
URL url)
//URI location)
{
if (!fs.provider().getScheme().equals(url.getProtocol()))
{
Expand All @@ -50,8 +50,15 @@ public class HttpPath implements Path
this.url = url;
}

HttpPath()
{
this.fs = null;
this.url = null;
}

@Override
public FileSystem getFileSystem()
//public FileSystem getFileSystem()
public HttpFileSystem getFileSystem()
{
return fs;
}
Expand Down Expand Up @@ -154,6 +161,7 @@ public Path resolveSibling(
Path other)
{
return resolveSibling(other.toString());
//return fs.resolveSibling(this, other);
}

@Override
Expand All @@ -164,6 +172,8 @@ public Path resolveSibling(
try
{
path = new HttpPath(fs, new URL(fs.baseUri().toURL(), other));
//path = new HttpPath(fs, fs.baseUri().resolve(URI.create(other))); // TODO: Ati - test
// return fs.resolveSibling(this, other); // TODO: Ati - this should be here
}
catch (Exception ex)
{
Expand Down Expand Up @@ -225,17 +235,6 @@ public WatchKey register(
{
throw new ProviderMismatchException();
}
for (WatchEvent.Kind<?> event : events)
{
if (!event.equals(ENTRY_MODIFY))
{
throw new IllegalArgumentException("Only ENTRY_MODIFY event kind is supported");
}
}
if (modifiers.length > 0)
{
throw new IllegalArgumentException("Modifiers are not supported");
}
return ((HttpWatchService) watcher).register(this, events, modifiers);
}

Expand Down
Loading