Skip to content
Merged
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 @@ -15,6 +15,8 @@
*/
package io.aklivity.zilla.runtime.engine.internal.registry;

import static java.util.stream.Collectors.toList;

import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -190,9 +192,14 @@ private EngineConfig parse(

engine = reader.read(configText);

final List<GuardConfig> guards = engine.namespaces.stream()
.map(n -> n.guards)
.flatMap(gs -> gs.stream())
.collect(toList());

for (NamespaceConfig namespace : engine.namespaces)
{
process(namespace, namespaceReadURL);
process(guards, namespace, namespaceReadURL);
}

if (config.verboseComposites())
Expand All @@ -212,6 +219,7 @@ private EngineConfig parse(
}

private void process(
List<GuardConfig> guards,
NamespaceConfig namespace,
Function<String, String> readURL)
{
Expand Down Expand Up @@ -291,14 +299,14 @@ private void process(
{
guarded.id = resolver.resolve(guarded.name);

LongPredicate authorizer = namespace.guards.stream()
LongPredicate authorizer = guards.stream()
.filter(g -> g.id == guarded.id)
.findFirst()
.map(g -> guardByType.apply(g.type))
.map(g -> g.verifier(EngineWorker::indexOfId, guarded))
.orElse(session -> false);

LongFunction<String> identifier = namespace.guards.stream()
LongFunction<String> identifier = guards.stream()
.filter(g -> g.id == guarded.id)
.findFirst()
.map(g -> guardByType.apply(g.type))
Expand Down Expand Up @@ -336,7 +344,7 @@ private void process(

for (NamespaceConfig composite : binding.composites)
{
process(composite, readURL);
process(guards, composite, readURL);
}

long affinity = tuning.affinity(binding.id);
Expand Down