-
Notifications
You must be signed in to change notification settings - Fork 70
Support remote zilla configuration with change detection #1071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
a370a7b
3757300
c02e5c4
8fcae70
96f070e
df0b998
c0a554f
b726267
9c2cbbe
abb923f
b9355c6
c58ebc9
2285123
39f34d0
b482fac
fd17488
b6c2ff2
2da3603
c85bdc1
ab94dac
22a2d03
dfe9610
e4cf407
df172d8
bef04ad
3177c80
2a217f8
4f5737a
6395780
54a2b87
a5d0a39
f19e623
a8a4015
c2efe21
873b5e1
c166431
0c0f7f4
31b420c
d3109f7
3198b10
ef2d377
8f982fe
50c8792
71231a9
7535666
e7c6c56
5423718
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,14 +16,13 @@ | |||||
| package io.aklivity.zilla.runtime.engine; | ||||||
|
|
||||||
| import static io.aklivity.zilla.runtime.engine.internal.layouts.metrics.HistogramsLayout.BUCKETS; | ||||||
| import static java.nio.charset.StandardCharsets.UTF_8; | ||||||
| import static java.util.concurrent.Executors.newFixedThreadPool; | ||||||
| import static java.util.stream.Collectors.toList; | ||||||
| import static org.agrona.LangUtil.rethrowUnchecked; | ||||||
|
|
||||||
| import java.io.InputStream; | ||||||
| import java.net.URL; | ||||||
| import java.net.URLConnection; | ||||||
| import java.nio.file.Files; | ||||||
| import java.nio.file.Path; | ||||||
| import java.util.ArrayList; | ||||||
| import java.util.Collection; | ||||||
| import java.util.List; | ||||||
|
|
@@ -80,7 +79,7 @@ public final class Engine implements Collector, AutoCloseable | |||||
| private final AtomicInteger nextTaskId; | ||||||
| private final ThreadFactory factory; | ||||||
|
|
||||||
| private final URL configURL; | ||||||
| private final Path configPath; | ||||||
| private final List<EngineWorker> workers; | ||||||
| private final boolean readonly; | ||||||
| private final EngineConfiguration config; | ||||||
|
|
@@ -149,7 +148,7 @@ public final class Engine implements Collector, AutoCloseable | |||||
| for (int workerIndex = 0; workerIndex < workerCount; workerIndex++) | ||||||
| { | ||||||
| EngineWorker worker = | ||||||
| new EngineWorker(config, tasks, labels, errorHandler, tuning::affinity, bindings, exporters, | ||||||
| new EngineWorker(config, tasks, labels, errorHandler, tuning::affinity, this::resolvePath, bindings, exporters, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Move |
||||||
| guards, vaults, catalogs, models, metricGroups, this, this::supplyEventReader, | ||||||
| eventFormatterFactory, workerIndex, readonly, this::process); | ||||||
| workers.add(worker); | ||||||
|
|
@@ -178,7 +177,7 @@ public final class Engine implements Collector, AutoCloseable | |||||
| final Map<String, Guard> guardsByType = guards.stream() | ||||||
| .collect(Collectors.toMap(g -> g.name(), g -> g)); | ||||||
|
|
||||||
| this.configURL = config.configURL(); | ||||||
| this.configPath = config.configPath(); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like |
||||||
| EngineManager manager = new EngineManager( | ||||||
| schemaTypes, | ||||||
| bindingsByType::get, | ||||||
|
|
@@ -192,8 +191,9 @@ public final class Engine implements Collector, AutoCloseable | |||||
| context, | ||||||
| config, | ||||||
| extensions, | ||||||
| this.configURL, | ||||||
| this::readURL); | ||||||
| this.configPath, | ||||||
| this::readPath, | ||||||
| this::readLocation); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. None of these need to be passed to Only |
||||||
|
|
||||||
| this.bindings = bindings; | ||||||
| this.tasks = tasks; | ||||||
|
|
@@ -285,18 +285,13 @@ public static EngineBuilder builder() | |||||
| return new EngineBuilder(); | ||||||
| } | ||||||
|
|
||||||
| private String readURL( | ||||||
| String location) | ||||||
| private String readPath( | ||||||
| Path path) | ||||||
| { | ||||||
| String result; | ||||||
| try | ||||||
| { | ||||||
| URL url = new URL(configURL, location); | ||||||
| URLConnection connection = url.openConnection(); | ||||||
| try (InputStream input = connection.getInputStream()) | ||||||
| { | ||||||
| result = new String(input.readAllBytes(), UTF_8); | ||||||
| } | ||||||
| result = Files.readString(path); | ||||||
| } | ||||||
| catch (Exception ex) | ||||||
| { | ||||||
|
|
@@ -305,6 +300,18 @@ private String readURL( | |||||
| return result; | ||||||
| } | ||||||
|
|
||||||
| public Path resolvePath( | ||||||
| String location) | ||||||
| { | ||||||
| return configPath.resolveSibling(location); | ||||||
| } | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method implementation should move to Note: |
||||||
|
|
||||||
| private String readLocation( | ||||||
| String location) | ||||||
| { | ||||||
| return readPath(resolvePath(location)); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's remove We should no longer need |
||||||
| } | ||||||
|
|
||||||
| private Thread newTaskThread( | ||||||
| Runnable r) | ||||||
| { | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ public class BindingConfig | |
| public transient long id; | ||
| public transient long entryId; | ||
| public transient ToLongFunction<String> resolveId; | ||
| public transient Function<String, String> readURL; | ||
| public transient Function<String, String> readLocation; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it possible to remove this completely? |
||
|
|
||
| public transient long vaultId; | ||
| public transient String qvault; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to get rid of
composite.readURL/composite.readLocationentirely?