comment
stringlengths
1
45k
method_body
stringlengths
23
281k
target_code
stringlengths
0
5.16k
method_body_after
stringlengths
12
281k
context_before
stringlengths
8
543k
context_after
stringlengths
8
543k
Agree, but I think that belongs in a different PR
void writeHeaderHeader(Writer w, CNode root) throws IOException { String [] namespaceList = generateCppNameSpace(root); String namespacePrint = generateCppNameSpaceString(namespaceList); String namespaceDefine = generateCppNameSpaceDefine(namespaceList); String className = getTypeName(root, false); String defineName = ...
w.write(indent + className + "(const " + vectorTypeDefs.get("vespalib::string") + " & __lines);\n");
void writeHeaderHeader(Writer w, CNode root) throws IOException { String [] namespaceList = generateCppNameSpace(root); String namespacePrint = generateCppNameSpaceString(namespaceList); String namespaceDefine = generateCppNameSpaceDefine(namespaceList); String className = getTypeName(root, false); String defineName = ...
class NoExceptSpecifier { private final boolean enabled; public NoExceptSpecifier(CNode node) { enabled = checkNode(node); } private static boolean checkNode(CNode node) { if (node instanceof InnerCNode) { for (CNode child: node.getChildren()) { if (child.isArray || child.isMap) { return false; } if (!checkNode(child))...
class NoExceptSpecifier { private final boolean enabled; public NoExceptSpecifier(CNode node) { enabled = checkNode(node); } private static boolean checkNode(CNode node) { if (node instanceof InnerCNode) { for (CNode child: node.getChildren()) { if (child.isArray || child.isMap) { return false; } if (!checkNode(child))...
Check that `pendingApprovals` contains `vespaTeam`?
public boolean hasPendingAccessRequests(TenantName tenantName) { var role = sshRole(tenantName); var pendingApprovals = vespaZmsClient.listPendingRoleApprovals(role); return !pendingApprovals.isEmpty(); }
return !pendingApprovals.isEmpty();
public boolean hasPendingAccessRequests(TenantName tenantName) { var role = sshRole(tenantName); var pendingApprovals = vespaZmsClient.listPendingRoleApprovals(role); return pendingApprovals.containsKey(vespaTeam); }
class AthenzAccessControlService implements AccessControlService { private static final String ALLOWED_OPERATOR_GROUPNAME = "vespa-team"; private static final String DATAPLANE_ACCESS_ROLENAME = "operator-data-plane"; private final String TENANT_DOMAIN_PREFIX = "vespa.tenant."; private final ZmsClient zmsClient; private...
class AthenzAccessControlService implements AccessControlService { private static final String ALLOWED_OPERATOR_GROUPNAME = "vespa-team"; private static final String DATAPLANE_ACCESS_ROLENAME = "operator-data-plane"; private final String TENANT_DOMAIN_PREFIX = "vespa.tenant"; private final ZmsClient zmsClient; private ...
Need to limit this API to tenant (administrators(?)) only in `controller-api` (PathGroup|Policy|RoleDefinition) Maybe consider ordering path arguments so that approve is before ssh, then we can limit access to all ../access/* APIs
private HttpResponse handlePUT(Path path, HttpRequest request) { if (path.matches("/application/v4/tenant/{tenant}")) return updateTenant(path.get("tenant"), request); if (path.matches("/application/v4/tenant/{tenant}/access/ssh/request")) return requestSshAccess(path.get("tenant"), request); if (path.matches("/applica...
if (path.matches("/application/v4/tenant/{tenant}/access/ssh/approve")) return approveAccessRequest(path.get("tenant"), request);
private HttpResponse handlePUT(Path path, HttpRequest request) { if (path.matches("/application/v4/tenant/{tenant}")) return updateTenant(path.get("tenant"), request); if (path.matches("/application/v4/tenant/{tenant}/access/request/ssh")) return requestSshAccess(path.get("tenant"), request); if (path.matches("/applica...
class ApplicationApiHandler extends AuditLoggingRequestHandler { private static final ObjectMapper jsonMapper = new ObjectMapper(); private final Controller controller; private final AccessControlRequests accessControlRequests; private final TestConfigSerializer testConfigSerializer; @Inject public ApplicationApiHandle...
class ApplicationApiHandler extends AuditLoggingRequestHandler { private static final ObjectMapper jsonMapper = new ObjectMapper(); private final Controller controller; private final AccessControlRequests accessControlRequests; private final TestConfigSerializer testConfigSerializer; @Inject public ApplicationApiHandle...
I'm not sure 5s is enough in all cases, but reindexing a few documents an additional itme should be harmless anyway.
public void deconstruct() { try { for (Reindexer reindexer : reindexers) reindexer.shutdown(); executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); curator.close(); if ( !executor.isShutdown() && ! executor.awaitTermination(5, TimeUnit.SECONDS)) log.log(WARNING, "Failed to shut down reindexing within ti...
executor.awaitTermination(5, TimeUnit.SECONDS);
public void deconstruct() { try { for (Reindexer reindexer : reindexers) reindexer.shutdown(); executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); curator.close(); if ( !executor.isShutdown() && ! executor.awaitTermination(5, TimeUnit.SECONDS)) log.log(WARNING, "Failed to shut down reindexing within ti...
class ReindexingMaintainer extends AbstractComponent { private static final Logger log = Logger.getLogger(Reindexing.class.getName()); private final Curator curator; private final List<Reindexer> reindexers; private final ScheduledExecutorService executor; @Inject public ReindexingMaintainer(@SuppressWarnings("unused")...
class ReindexingMaintainer extends AbstractComponent { private static final Logger log = Logger.getLogger(Reindexing.class.getName()); private final Curator curator; private final List<Reindexer> reindexers; private final ScheduledExecutorService executor; @Inject public ReindexingMaintainer(@SuppressWarnings("unused")...
Surprising choice of formatting. Consider adding newline/braces for multi-line if-body. 🙂
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
if (platformReadyAt.isEmpty() && revisionReadyAt.isEmpty()) switch (rollout) {
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
Oops.
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
if (platformReadyAt.isEmpty() && revisionReadyAt.isEmpty()) switch (rollout) {
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
Will do in next PPR :)
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
if (platformReadyAt.isEmpty() && revisionReadyAt.isEmpty()) switch (rollout) {
private List<Change> changes(JobId job, StepStatus step, Change change) { if (step.completedAt(change, Optional.of(job)).isPresent()) return List.of(); if (change.platform().isEmpty() || change.application().isEmpty() || change.isPinned()) return List.of(change); if ( step.completedAt(change.withoutApplication(), Opt...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
class DeploymentStatus { public static List<JobId> jobsFor(Application application, SystemName system) { if (DeploymentSpec.empty.equals(application.deploymentSpec())) return List.of(); return application.deploymentSpec().instances().stream() .flatMap(spec -> Stream.concat(Stream.of(systemTest, stagingTest), flatten(sp...
Consider putting assignment on separate line. I don't think I've ever seen an equals call that also assigns a variable. 😆
public Collection<ApplicationVersion> deployableVersions(boolean ascending) { Deque<ApplicationVersion> versions = new ArrayDeque<>(); String previousHash = ""; for (ApplicationVersion version : versions()) { if (previousHash.equals(previousHash = version.bundleHash().orElse("")) && version.bundleHash().isPresent()) co...
if (previousHash.equals(previousHash = version.bundleHash().orElse("")) && version.bundleHash().isPresent())
public Collection<ApplicationVersion> deployableVersions(boolean ascending) { Deque<ApplicationVersion> versions = new ArrayDeque<>(); String previousHash = ""; for (ApplicationVersion version : versions()) { if (version.bundleHash().isEmpty() || ! previousHash.equals(version.bundleHash().get())) { if (ascending) versi...
class Application { private final TenantAndApplicationId id; private final Instant createdAt; private final DeploymentSpec deploymentSpec; private final ValidationOverrides validationOverrides; private final Optional<ApplicationVersion> latestVersion; private final SortedSet<ApplicationVersion> versions; private final ...
class Application { private final TenantAndApplicationId id; private final Instant createdAt; private final DeploymentSpec deploymentSpec; private final ValidationOverrides validationOverrides; private final Optional<ApplicationVersion> latestVersion; private final SortedSet<ApplicationVersion> versions; private final ...
🙂
public DeploymentContext submit(ApplicationPackage applicationPackage, Optional<SourceRevision> sourceRevision, long salt) { var buffer = new ByteArrayOutputStream(); ZipStreamReader.transferAndWrite(buffer, new ByteArrayInputStream(applicationPackage.zippedContent()), "salt", new byte[]{ (byte) (salt >> 56), (byte) (s...
new byte[]{ (byte) (salt >> 56), (byte) (salt >> 48), (byte) (salt >> 40), (byte) (salt >> 32), (byte) (salt >> 24), (byte) (salt >> 16), (byte) (salt >> 8), (byte) salt });
public DeploymentContext submit(ApplicationPackage applicationPackage, Optional<SourceRevision> sourceRevision, long salt) { var buffer = new ByteArrayOutputStream(); ZipStreamReader.transferAndWrite(buffer, new ByteArrayInputStream(applicationPackage.zippedContent()), "salt", new byte[]{ (byte) (salt >> 56), (byte) (s...
class DeploymentContext { private final AtomicLong salt = new AtomicLong(); private static final Supplier<ApplicationPackage> applicationPackage = Suppliers.memoize(() -> new ApplicationPackageBuilder() .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .upgradePolicy("default") .region("us-cen...
class DeploymentContext { private final AtomicLong salt = new AtomicLong(); private static final Supplier<ApplicationPackage> applicationPackage = Suppliers.memoize(() -> new ApplicationPackageBuilder() .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .upgradePolicy("default") .region("us-cen...
I've seen it multiple places in the standard library 😬 But sure. It's just what felt natural writing. Maybe not the easiest thing to parse. though ... 😀
public Collection<ApplicationVersion> deployableVersions(boolean ascending) { Deque<ApplicationVersion> versions = new ArrayDeque<>(); String previousHash = ""; for (ApplicationVersion version : versions()) { if (previousHash.equals(previousHash = version.bundleHash().orElse("")) && version.bundleHash().isPresent()) co...
if (previousHash.equals(previousHash = version.bundleHash().orElse("")) && version.bundleHash().isPresent())
public Collection<ApplicationVersion> deployableVersions(boolean ascending) { Deque<ApplicationVersion> versions = new ArrayDeque<>(); String previousHash = ""; for (ApplicationVersion version : versions()) { if (version.bundleHash().isEmpty() || ! previousHash.equals(version.bundleHash().get())) { if (ascending) versi...
class Application { private final TenantAndApplicationId id; private final Instant createdAt; private final DeploymentSpec deploymentSpec; private final ValidationOverrides validationOverrides; private final Optional<ApplicationVersion> latestVersion; private final SortedSet<ApplicationVersion> versions; private final ...
class Application { private final TenantAndApplicationId id; private final Instant createdAt; private final DeploymentSpec deploymentSpec; private final ValidationOverrides validationOverrides; private final Optional<ApplicationVersion> latestVersion; private final SortedSet<ApplicationVersion> versions; private final ...
🙈
public DeploymentContext submit(ApplicationPackage applicationPackage, Optional<SourceRevision> sourceRevision, long salt) { var buffer = new ByteArrayOutputStream(); ZipStreamReader.transferAndWrite(buffer, new ByteArrayInputStream(applicationPackage.zippedContent()), "salt", new byte[]{ (byte) (salt >> 56), (byte) (s...
new byte[]{ (byte) (salt >> 56), (byte) (salt >> 48), (byte) (salt >> 40), (byte) (salt >> 32), (byte) (salt >> 24), (byte) (salt >> 16), (byte) (salt >> 8), (byte) salt });
public DeploymentContext submit(ApplicationPackage applicationPackage, Optional<SourceRevision> sourceRevision, long salt) { var buffer = new ByteArrayOutputStream(); ZipStreamReader.transferAndWrite(buffer, new ByteArrayInputStream(applicationPackage.zippedContent()), "salt", new byte[]{ (byte) (salt >> 56), (byte) (s...
class DeploymentContext { private final AtomicLong salt = new AtomicLong(); private static final Supplier<ApplicationPackage> applicationPackage = Suppliers.memoize(() -> new ApplicationPackageBuilder() .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .upgradePolicy("default") .region("us-cen...
class DeploymentContext { private final AtomicLong salt = new AtomicLong(); private static final Supplier<ApplicationPackage> applicationPackage = Suppliers.memoize(() -> new ApplicationPackageBuilder() .athenzIdentity(AthenzDomain.from("domain"), AthenzService.from("service")) .upgradePolicy("default") .region("us-cen...
We don't re-write historic runs, so this needs to stay, unless we start re-writing all of those regularly as well.
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
When do they expire?
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
This should dalso be updated, like the mail notification.
private void updateConsoleNotification(Run run) { NotificationSource source = NotificationSource.from(run.id()); Consumer<String> updater = msg -> controller.notificationsDb().setNotification(source, Notification.Type.deployment, Notification.Level.error, msg); switch (run.status()) { case aborted: return; case running...
if ( ! run.id().type().environment().isTest()) updater.accept("lack of capacity. Please contact the Vespa team to request more!");
private void updateConsoleNotification(Run run) { NotificationSource source = NotificationSource.from(run.id()); Consumer<String> updater = msg -> controller.notificationsDb().setNotification(source, Notification.Type.deployment, Notification.Level.error, msg); switch (run.status()) { case aborted: return; case running...
class InternalStepRunner implements StepRunner { private static final Logger logger = Logger.getLogger(InternalStepRunner.class.getName()); static final NodeResources DEFAULT_TESTER_RESOURCES = new NodeResources(1, 4, 50, 0.3, NodeResources.DiskSpeed.any); static final NodeResources DEFAULT_TESTER_RESOURCES_AWS = new N...
class InternalStepRunner implements StepRunner { private static final Logger logger = Logger.getLogger(InternalStepRunner.class.getName()); static final NodeResources DEFAULT_TESTER_RESOURCES = new NodeResources(1, 4, 50, 0.3, NodeResources.DiskSpeed.any); static final NodeResources DEFAULT_TESTER_RESOURCES_AWS = new N...
When they're more than 65 runs old, or somehting, and they're also no longer the "first failing" or "lasts successful" run. Potentially never. I guess we should re-write these runs ...
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
I can do that in a differnet PR.
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
Never mind I'm just bad at reading code. We update these as well.
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
Thanks. I'll remove the date for now.
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
case "outOfCapacity" : return nodeAllocationFailure;
static RunStatus runStatusOf(String status) { switch (status) { case "running" : return running; case "outOfCapacity" : return nodeAllocationFailure; case "nodeAllocationFailure" : return nodeAllocationFailure; case "endpointCertificateTimeout" : return endpointCertificateTimeout; c...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
class RunSerializer { private static final String stepsField = "steps"; private static final String stepDetailsField = "stepDetails"; private static final String startTimeField = "startTime"; private static final String applicationField = "id"; private static final String jobTypeField = "type"; private static final Str...
For console it's better to have no value rather than wrong value
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
availableObject.setLong("at", available.buildTime().orElse(Instant.EPOCH).toEpochMilli());
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
Is `at` needed at all here? Same for available platforms
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
availableObject.setLong("at", available.buildTime().orElse(Instant.EPOCH).toEpochMilli());
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
It's not used. Didn' tknow it consosle wante dit for desserialisation, but I guess not then :)
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
availableObject.setLong("at", available.buildTime().orElse(Instant.EPOCH).toEpochMilli());
static HttpResponse overviewResponse(Controller controller, TenantAndApplicationId id, URI baseUriForDeployments) { Application application = controller.applications().requireApplication(id); DeploymentStatus status = controller.jobController().deploymentStatus(application); Slime slime = new Slime(); Cursor responseOb...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
class JobControllerApiHandlerHelper { /** * @return Response with all job types that have recorded runs for the application _and_ the status for the last run of that type */ static HttpResponse jobTypeResponse(Controller controller, ApplicationId id, URI baseUriForJobs) { Slime slime = new Slime(); Cursor responseObjec...
A connection is valid until it fails (you can start using it while it connects). What we would like to test here is that the connection transitions into the CONNECTED state. We could consider adding an 'isConnected' function that checks for CONNECTED state while holding the lock (side note: isValid should also take the...
public void testConnect() throws ListenFailedException { Test.Orb server = new Test.Orb(new Transport()); Test.Orb client = new Test.Orb(new Transport()); Acceptor acceptor = server.listen(new Spec(0)); Target target = client.connect(new Spec("localhost", acceptor.port())); for (int i = 0; i < 100; i++) { if (targe...
if (target.isValid()) {
public void testConnect() throws ListenFailedException { Test.Orb server = new Test.Orb(new Transport()); Test.Orb client = new Test.Orb(new Transport()); Acceptor acceptor = server.listen(new Spec(0)); Connection target = (Connection) client.connect(new Spec("localhost", acceptor.port())); for (int i = 0; i < 100;...
class ConnectTest { @org.junit.Test }
class ConnectTest { @org.junit.Test }
I added a synchronized isConnected() method on the connection. In addition I used the Connection directly to avoid adding the interface to the Target, and used isConnected/isClosed instead of isValid. Both isValid and isClosed should have been synchronized, but they are used intensively in frequently called methods. I...
public void testConnect() throws ListenFailedException { Test.Orb server = new Test.Orb(new Transport()); Test.Orb client = new Test.Orb(new Transport()); Acceptor acceptor = server.listen(new Spec(0)); Target target = client.connect(new Spec("localhost", acceptor.port())); for (int i = 0; i < 100; i++) { if (targe...
if (target.isValid()) {
public void testConnect() throws ListenFailedException { Test.Orb server = new Test.Orb(new Transport()); Test.Orb client = new Test.Orb(new Transport()); Acceptor acceptor = server.listen(new Spec(0)); Connection target = (Connection) client.connect(new Spec("localhost", acceptor.port())); for (int i = 0; i < 100;...
class ConnectTest { @org.junit.Test }
class ConnectTest { @org.junit.Test }
Missing space around +
public void addSchemaFromReader(NamedReader reader) { try { addSchemaFromStringWithFileName(IOUtils.readAll(reader.getReader()), reader.getName()); } catch (java.io.IOException ex) { throw new IllegalArgumentException("Failed reading from " + reader.getName() + ": " + ex.getMessage()); } catch (ParseException ex) { thr...
throw new IllegalArgumentException("Failed parsing schema from " + reader.getName() + ": "+ex.getMessage());
public void addSchemaFromReader(NamedReader reader) { try { addSchemaFromStringWithFileName(IOUtils.readAll(reader.getReader()), reader.getName()); } catch (java.io.IOException ex) { throw new IllegalArgumentException("Failed reading from " + reader.getName() + ": " + ex.getMessage()); } catch (ParseException ex) { thr...
class IntermediateCollection { private final DeployLogger deployLogger; private final ModelContext.Properties modelProperties; private Map<String, ParsedSchema> parsedSchemas = new HashMap<>(); IntermediateCollection() { this.deployLogger = new BaseDeployLogger(); this.modelProperties = new TestProperties(); } public I...
class IntermediateCollection { private final DeployLogger deployLogger; private final ModelContext.Properties modelProperties; private Map<String, ParsedSchema> parsedSchemas = new HashMap<>(); IntermediateCollection() { this.deployLogger = new BaseDeployLogger(); this.modelProperties = new TestProperties(); } public I...
policy name should follow role name
public void setPreapprovedAccess(TenantName tenantName, boolean preapprovedAccess) { var role = sshRole(tenantName); var policyName = "lambda-synchronizer"; var action = "update_members"; var approverRole = new AthenzRole(role.domain(), "vespa-access-approver"); if (preapprovedAccess) { vespaZmsClient.addPolicyRule(rol...
var policyName = "lambda-synchronizer";
public void setPreapprovedAccess(TenantName tenantName, boolean preapprovedAccess) { vespaZmsClient.ifPresentOrElse( zms -> { var role = sshRole(tenantName); var policyName = "vespa-access-requester"; var action = "update_members"; var approverRole = new AthenzRole(role.domain(), "vespa-access-approver"); if (preapprov...
class AthenzAccessControlService implements AccessControlService { private static final String ALLOWED_OPERATOR_GROUPNAME = "vespa-team"; private static final String DATAPLANE_ACCESS_ROLENAME = "operator-data-plane"; private final String TENANT_DOMAIN_PREFIX = "vespa.tenant"; private final ZmsClient zmsClient; private ...
class AthenzAccessControlService implements AccessControlService { private static final String ALLOWED_OPERATOR_GROUPNAME = "vespa-team"; private static final String DATAPLANE_ACCESS_ROLENAME = "operator-data-plane"; private final String TENANT_DOMAIN_PREFIX = "vespa.tenant"; private final ZmsClient zmsClient; private ...
Same here.
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("FuzzyItem [fuzzyQuery=").append(fuzzyQuery).append("]"); return builder.toString(); }
builder.append("FuzzyItem [fuzzyQuery=").append(fuzzyQuery).append("]");
public String toString() { StringBuilder builder = new StringBuilder(); builder.append("FuzzyItem [term=").append(term).append("]"); return builder.toString(); }
class FuzzyItem extends TermItem { private String fuzzyQuery; public FuzzyItem(String indexName, boolean isFromQuery, String fuzzyQuery) { super(indexName, isFromQuery, null); setValue(fuzzyQuery); } @Override public void setValue(String value) { this.fuzzyQuery = value; } @Override public String getRawWord() { return ...
class FuzzyItem extends TermItem { private String term; public FuzzyItem(String indexName, boolean isFromQuery, String term) { super(indexName, isFromQuery, null); setValue(term); } @Override public void setValue(String value) { this.term = value; } @Override public String getRawWord() { return stringValue(); } @Overri...
```suggestion @Override protected void encodeThis(ByteBuffer buffer) { ```
protected void encodeThis(ByteBuffer buffer) { super.encodeThis(buffer); putString(getIndexedString(), buffer); }
super.encodeThis(buffer);
protected void encodeThis(ByteBuffer buffer) { super.encodeThis(buffer); putString(getIndexedString(), buffer); }
class FuzzyItem extends TermItem { private String fuzzyQuery; public FuzzyItem(String indexName, boolean isFromQuery, String fuzzyQuery) { super(indexName, isFromQuery, null); setValue(fuzzyQuery); } @Override public void setValue(String value) { this.fuzzyQuery = value; } @Override public String getRawWord() { return ...
class FuzzyItem extends TermItem { private String term; public FuzzyItem(String indexName, boolean isFromQuery, String term) { super(indexName, isFromQuery, null); setValue(term); } @Override public void setValue(String value) { this.term = value; } @Override public String getRawWord() { return stringValue(); } @Overri...
```suggestion userQuery.trace("Field '" + field + "' is an attribute, 'contains' will only match exactly (unless fuzzy is used)", 2); ```
private Item buildTermSearch(OperatorNode<ExpressionOperator> ast) { assertHasOperator(ast, ExpressionOperator.CONTAINS); String field = getIndex(ast.getArgument(0)); if (userQuery != null && indexFactsSession.getIndex(field).isAttribute()) { userQuery.trace("Field '" + field + "' is an attribute, 'contains' will only ...
userQuery.trace("Field '" + field + "' is an attribute, 'contains' will only match exactly (unless fuzzy query is used)", 2);
private Item buildTermSearch(OperatorNode<ExpressionOperator> ast) { assertHasOperator(ast, ExpressionOperator.CONTAINS); String field = getIndex(ast.getArgument(0)); if (userQuery != null && indexFactsSession.getIndex(field).isAttribute()) { userQuery.trace("Field '" + field + "' is an attribute, 'contains' will only ...
class PrefixExpander extends IndexNameExpander { private final String prefix; public PrefixExpander(String prefix) { this.prefix = prefix + "."; } @Override public String expand(String leaf) { return prefix + leaf; } }
class PrefixExpander extends IndexNameExpander { private final String prefix; public PrefixExpander(String prefix) { this.prefix = prefix + "."; } @Override public String expand(String leaf) { return prefix + leaf; } }
@freva I assume adding compile version to dev versions won't break any UIs?
public void deploy(ApplicationId id, JobType type, Optional<Version> platform, ApplicationPackage applicationPackage, boolean dryRun) { controller.applications().lockApplicationOrThrow(TenantAndApplicationId.from(id), application -> { if ( ! application.get().instances().containsKey(id.instance())) application = contro...
applicationPackage.compileVersion(),
public void deploy(ApplicationId id, JobType type, Optional<Version> platform, ApplicationPackage applicationPackage, boolean dryRun) { controller.applications().lockApplicationOrThrow(TenantAndApplicationId.from(id), application -> { if ( ! application.get().instances().containsKey(id.instance())) application = contro...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private final TesterCloud cloud; private final JobMetrics metric; private final AtomicRefere...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private final TesterCloud cloud; private final JobMetrics metric; private final AtomicRefere...
Should be fine :+1:
public void deploy(ApplicationId id, JobType type, Optional<Version> platform, ApplicationPackage applicationPackage, boolean dryRun) { controller.applications().lockApplicationOrThrow(TenantAndApplicationId.from(id), application -> { if ( ! application.get().instances().containsKey(id.instance())) application = contro...
applicationPackage.compileVersion(),
public void deploy(ApplicationId id, JobType type, Optional<Version> platform, ApplicationPackage applicationPackage, boolean dryRun) { controller.applications().lockApplicationOrThrow(TenantAndApplicationId.from(id), application -> { if ( ! application.get().instances().containsKey(id.instance())) application = contro...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private final TesterCloud cloud; private final JobMetrics metric; private final AtomicRefere...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private final TesterCloud cloud; private final JobMetrics metric; private final AtomicRefere...
Ok!
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
throw new UnsupportedOperationException("URI type is not supported");
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
L601 to 604 doesn't seem to do anything since `wanted` is never read?
public List<SummaryField> getSummaryFields(ImmutableSDField field) { List<SummaryField> summaryFields = inherited.isPresent() ? requireInherited().getSummaryFields(field) : new java.util.ArrayList<>(); for (DocumentSummary documentSummary : summaries.values()) { for (SummaryField summaryField : documentSummary.getSumma...
boolean wanted = true;
public List<SummaryField> getSummaryFields(ImmutableSDField field) { List<SummaryField> summaryFields = inherited.isPresent() ? requireInherited().getSummaryFields(field) : new java.util.ArrayList<>(); for (DocumentSummary documentSummary : summaries.values()) { for (SummaryField summaryField : documentSummary.getSumma...
class defined by this search definition, or null if no summary with this name is defined. * The default summary, named "default" is always present. */ public DocumentSummary getSummary(String name) { var summary = summaries.get(name); if (summary != null) return summary; if (inherited.isEmpty()) return null; return req...
class defined by this search definition, or null if no summary with this name is defined. * The default summary, named "default" is always present. */ public DocumentSummary getSummary(String name) { var summary = summaries.get(name); if (summary != null) return summary; if (inherited.isEmpty()) return null; return req...
oops, fixed. `wanted` is now used.
public List<SummaryField> getSummaryFields(ImmutableSDField field) { List<SummaryField> summaryFields = inherited.isPresent() ? requireInherited().getSummaryFields(field) : new java.util.ArrayList<>(); for (DocumentSummary documentSummary : summaries.values()) { for (SummaryField summaryField : documentSummary.getSumma...
boolean wanted = true;
public List<SummaryField> getSummaryFields(ImmutableSDField field) { List<SummaryField> summaryFields = inherited.isPresent() ? requireInherited().getSummaryFields(field) : new java.util.ArrayList<>(); for (DocumentSummary documentSummary : summaries.values()) { for (SummaryField summaryField : documentSummary.getSumma...
class defined by this search definition, or null if no summary with this name is defined. * The default summary, named "default" is always present. */ public DocumentSummary getSummary(String name) { var summary = summaries.get(name); if (summary != null) return summary; if (inherited.isEmpty()) return null; return req...
class defined by this search definition, or null if no summary with this name is defined. * The default summary, named "default" is always present. */ public DocumentSummary getSummary(String name) { var summary = summaries.get(name); if (summary != null) return summary; if (inherited.isEmpty()) return null; return req...
Can't you have a map where the value is a struct?
private void actuallyMakeStructFields() { if (doneStructFields) return; if (getFirstStructOrMapRecursive() == null) { doneStructFields = true; return; } var sdoc = repoDocType; var dataType = getDataType(); java.util.function.BiConsumer<String, DataType> supplyStructField = (fieldName, fieldType) -> { if (structFields....
private void actuallyMakeStructFields() { if (doneStructFields) return; if (getFirstStructOrMapRecursive() == null) { doneStructFields = true; return; } var sdoc = repoDocType; var dataType = getDataType(); java.util.function.BiConsumer<String, DataType> supplyStructField = (fieldName, fieldType) -> { if (structFields....
class SDField extends Field implements TypedKey, FieldOperationContainer, ImmutableSDField { /** Use this field for modifying index-structure, even if it doesn't have any indexing code */ private boolean indexStructureField = false; /** The indexing statements to be applied to this value during indexing */ private Scri...
class SDField extends Field implements TypedKey, FieldOperationContainer, ImmutableSDField { /** Use this field for modifying index-structure, even if it doesn't have any indexing code */ private boolean indexStructureField = false; /** The indexing statements to be applied to this value during indexing */ private Scri...
> Can't you have a map where the value is a struct? yes, that works already - it's two levels of SDField, one taking the upper code path (for map) and one inside (for struct) the lower one.
private void actuallyMakeStructFields() { if (doneStructFields) return; if (getFirstStructOrMapRecursive() == null) { doneStructFields = true; return; } var sdoc = repoDocType; var dataType = getDataType(); java.util.function.BiConsumer<String, DataType> supplyStructField = (fieldName, fieldType) -> { if (structFields....
private void actuallyMakeStructFields() { if (doneStructFields) return; if (getFirstStructOrMapRecursive() == null) { doneStructFields = true; return; } var sdoc = repoDocType; var dataType = getDataType(); java.util.function.BiConsumer<String, DataType> supplyStructField = (fieldName, fieldType) -> { if (structFields....
class SDField extends Field implements TypedKey, FieldOperationContainer, ImmutableSDField { /** Use this field for modifying index-structure, even if it doesn't have any indexing code */ private boolean indexStructureField = false; /** The indexing statements to be applied to this value during indexing */ private Scri...
class SDField extends Field implements TypedKey, FieldOperationContainer, ImmutableSDField { /** Use this field for modifying index-structure, even if it doesn't have any indexing code */ private boolean indexStructureField = false; /** The indexing statements to be applied to this value during indexing */ private Scri...
You should require that all Numbers in a range are of the same type. And you should encode the type in the metadata.
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range range : so...
for (Range range : sortedRanges()) {
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range<Type> range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range<Type...
class Range { final Number start; final Number end; Range(Number start, Number end) { this.start = start; this.end = end; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Range range = (Range) o; return start.equals(range.start) && end....
class NumberEncoder<Type extends Number> { static NumberEncoder<Integer> UNIFORM_INTEGER = new NumberEncoder<>(0, ByteBuffer::putInt); static NumberEncoder<Long> UNIFORM_LONG = new NumberEncoder<>(1, ByteBuffer::putLong); static NumberEncoder<Double> UNIFORM_DOUBLE = new Numb...
Encode the number based on the type. Integers are not doubles.
void encodeTerms(ByteBuffer buffer) { for (Range range : sortedRanges()) { buffer.putDouble(range.start.doubleValue()); buffer.putDouble(range.end.doubleValue()); } }
buffer.putDouble(range.start.doubleValue());
void encodeTerms(ByteBuffer buffer) { for (Range<Type> range : sortedRanges()) { encoder.serializer.accept(buffer, range.start); encoder.serializer.accept(buffer, range.end); } }
class Range { final Number start; final Number end; Range(Number start, Number end) { this.start = start; this.end = end; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Range range = (Range) o; return start.equals(range.start) && end....
class NumberEncoder<Type extends Number> { static NumberEncoder<Integer> UNIFORM_INTEGER = new NumberEncoder<>(0, ByteBuffer::putInt); static NumberEncoder<Long> UNIFORM_LONG = new NumberEncoder<>(1, ByteBuffer::putLong); static NumberEncoder<Double> UNIFORM_DOUBLE = new Numb...
You should also leave room to specify how the numbers are encoded. There might be smarter ways to encode numbers based on their distribution.
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range range : so...
for (Range range : sortedRanges()) {
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range<Type> range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range<Type...
class Range { final Number start; final Number end; Range(Number start, Number end) { this.start = start; this.end = end; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Range range = (Range) o; return start.equals(range.start) && end....
class NumberEncoder<Type extends Number> { static NumberEncoder<Integer> UNIFORM_INTEGER = new NumberEncoder<>(0, ByteBuffer::putInt); static NumberEncoder<Long> UNIFORM_LONG = new NumberEncoder<>(1, ByteBuffer::putLong); static NumberEncoder<Double> UNIFORM_DOUBLE = new Numb...
Added type argument, with support for int, long and double. Also added dynamic selection of integer compression, which can be extended later.
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range range : so...
for (Range range : sortedRanges()) {
Item asCompositeItem() { OrItem root = new OrItem(); if (startIndex.equals(endIndex)) { for (Range<Type> range : sortedRanges()) { root.addItem(new IntItem(new com.yahoo.prelude.query.Limit(range.start, startInclusive), new com.yahoo.prelude.query.Limit(range.end, endInclusive), startIndex)); } } else { for (Range<Type...
class Range { final Number start; final Number end; Range(Number start, Number end) { this.start = start; this.end = end; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Range range = (Range) o; return start.equals(range.start) && end....
class NumberEncoder<Type extends Number> { static NumberEncoder<Integer> UNIFORM_INTEGER = new NumberEncoder<>(0, ByteBuffer::putInt); static NumberEncoder<Long> UNIFORM_LONG = new NumberEncoder<>(1, ByteBuffer::putLong); static NumberEncoder<Double> UNIFORM_DOUBLE = new Numb...
Done.
void encodeTerms(ByteBuffer buffer) { for (Range range : sortedRanges()) { buffer.putDouble(range.start.doubleValue()); buffer.putDouble(range.end.doubleValue()); } }
buffer.putDouble(range.start.doubleValue());
void encodeTerms(ByteBuffer buffer) { for (Range<Type> range : sortedRanges()) { encoder.serializer.accept(buffer, range.start); encoder.serializer.accept(buffer, range.end); } }
class Range { final Number start; final Number end; Range(Number start, Number end) { this.start = start; this.end = end; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Range range = (Range) o; return start.equals(range.start) && end....
class NumberEncoder<Type extends Number> { static NumberEncoder<Integer> UNIFORM_INTEGER = new NumberEncoder<>(0, ByteBuffer::putInt); static NumberEncoder<Long> UNIFORM_LONG = new NumberEncoder<>(1, ByteBuffer::putLong); static NumberEncoder<Double> UNIFORM_DOUBLE = new Numb...
When combining collectors in this way it can help readability to assign them to a variable when you create them and use that later. It makes the code less noisy and gives the collector a semantic name.
private Collection<ResourceSnapshot> createResourceSnapshotsFromNodes(ZoneId zoneId, List<Node> nodes) { return nodes.stream() .filter(this::unlessNodeOwnerIsSystemApplication) .filter(this::isNodeStateMeterable) .filter(this::isClusterTypeMeterable) .collect(Collectors.groupingBy(node -> node.owner().get(), Collectors...
))
private Collection<ResourceSnapshot> createResourceSnapshotsFromNodes(ZoneId zoneId, List<Node> nodes) { return nodes.stream() .filter(this::unlessNodeOwnerIsSystemApplication) .filter(this::isNodeStateMeterable) .filter(this::isClusterTypeMeterable) .collect(Collectors.groupingBy(node -> node.owner().get(), groupSnaps...
class ResourceMeterMaintainer extends ControllerMaintainer { /** * Checks if the node is in some state where it is in active use by the tenant, * and not transitioning out of use, in a failed state, etc. */ private static final Set<Node.State> METERABLE_NODE_STATES = EnumSet.of( Node.State.reserved, Node.State.active, ...
class ResourceMeterMaintainer extends ControllerMaintainer { /** * Checks if the node is in some state where it is in active use by the tenant, * and not transitioning out of use, in a failed state, etc. */ private static final Set<Node.State> METERABLE_NODE_STATES = EnumSet.of( Node.State.reserved, Node.State.active, ...
Hehe, no XD
public void testDeployComplicatedDeploymentSpec() { String complicatedDeploymentSpec = "<deployment version='1.0' athenz-domain='domain' athenz-service='service'>\n" + " <parallel>\n" + " <instance id='instance' athenz-service='in-service'>\n" + " <staging />\n" + " <prod>\n" + " ...
public void testDeployComplicatedDeploymentSpec() { String complicatedDeploymentSpec = "<deployment version='1.0' athenz-domain='domain' athenz-service='service'>\n" + " <parallel>\n" + " <instance id='instance' athenz-service='in-service'>\n" + " <staging />\n" + " <prod>\n" + " ...
class DeploymentTriggerTest { private final DeploymentTester tester = new DeploymentTester(); @Test public void testTriggerFailing() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .upgradePolicy("default") .region("us-west-1") .build(); var app = tester.newDeploymentContext().submit(applicati...
class DeploymentTriggerTest { private final DeploymentTester tester = new DeploymentTester(); @Test public void testTriggerFailing() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .upgradePolicy("default") .region("us-west-1") .build(); var app = tester.newDeploymentContext().submit(applicati...
Mhm.
public void testDeployComplicatedDeploymentSpec() { String complicatedDeploymentSpec = "<deployment version='1.0' athenz-domain='domain' athenz-service='service'>\n" + " <parallel>\n" + " <instance id='instance' athenz-service='in-service'>\n" + " <staging />\n" + " <prod>\n" + " ...
assertEquals(Change.empty(), app1.instance().change());
public void testDeployComplicatedDeploymentSpec() { String complicatedDeploymentSpec = "<deployment version='1.0' athenz-domain='domain' athenz-service='service'>\n" + " <parallel>\n" + " <instance id='instance' athenz-service='in-service'>\n" + " <staging />\n" + " <prod>\n" + " ...
class DeploymentTriggerTest { private final DeploymentTester tester = new DeploymentTester(); @Test public void testTriggerFailing() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .upgradePolicy("default") .region("us-west-1") .build(); var app = tester.newDeploymentContext().submit(applicati...
class DeploymentTriggerTest { private final DeploymentTester tester = new DeploymentTester(); @Test public void testTriggerFailing() { ApplicationPackage applicationPackage = new ApplicationPackageBuilder() .upgradePolicy("default") .region("us-west-1") .build(); var app = tester.newDeploymentContext().submit(applicati...
I removed this use from Factory.
private boolean matchesInner(String pathSpec) { values.clear(); String[] specElements = pathSpec.split("/"); boolean matchPrefix = false; if (specElements.length > 1 && specElements[specElements.length-1].equals("{*}")) { matchPrefix = true; specElements = Arrays.copyOf(specElements, specElements.length-1); } if (match...
boolean matchPrefix = false;
private boolean matchesInner(String pathSpec) { values.clear(); String[] specElements = splitAbsolutePath(pathSpec, Function.identity()); boolean matchPrefix = false; if (specElements.length > 1 && specElements[specElements.length-1].equals("{*}")) { matchPrefix = true; specElements = Arrays.copyOf(specElements, specEl...
class Path { private final String pathString; private final String[] elements; private final Map<String, String> values = new HashMap<>(); private String rest = ""; public Path(URI uri) { this.pathString = uri.getRawPath(); this.elements = Stream.of(this.pathString.split("/")) .map(part -> URLDecoder.decode(part, Stand...
class Path { private final String pathString; private final String[] elements; private final Map<String, String> values = new HashMap<>(); private String rest = ""; public Path(URI uri) { this.pathString = requireNormalized(uri).getRawPath(); this.elements = splitAbsolutePath(pathString, (part) -> URLDecoder.decode(par...
Less magic in a small number
public Result search(Query query, Execution execution) { try { if (query.getHttpRequest().getProperty(DefaultProperties.GROUPING_GLOBAL_MAX_GROUPS.toString()) != null) { throw new IllegalInputException(DefaultProperties.GROUPING_GLOBAL_MAX_GROUPS + " must be specified in a query profile."); } String reqParam = query.pr...
grpRequest.setDefaultPrecisionFactor(query.properties().getDouble(PARAM_DEFAULT_PRECISION_FACTOR, 0.0));
public Result search(Query query, Execution execution) { try { if (query.getHttpRequest().getProperty(GROUPING_GLOBAL_MAX_GROUPS.toString()) != null) { throw new IllegalInputException(GROUPING_GLOBAL_MAX_GROUPS + " must be specified in a query profile."); } String reqParam = query.properties().getString(PARAM_REQUEST);...
class GroupingQueryParser extends Searcher { public static final String SELECT_PARAMETER_PARSING = "SelectParameterParsing"; public static final CompoundName PARAM_CONTINUE = new CompoundName("continue"); public static final CompoundName PARAM_REQUEST = new CompoundName(Select.SELECT); public static final CompoundName ...
class GroupingQueryParser extends Searcher { public static final String SELECT_PARAMETER_PARSING = "SelectParameterParsing"; public static final CompoundName PARAM_CONTINUE = new CompoundName("continue"); public static final CompoundName PARAM_REQUEST = new CompoundName(Select.SELECT); public static final CompoundName ...
Why not use vespajlib Path and you get this for free?
public FileNode(String stringVal) { super(true); this.value = new FileReference(ReferenceNode.stripQuotes(stringVal)); if (Path.of(value.value()).normalize().startsWith("..")) throw new IllegalArgumentException("path may not start with '..', but got: " + value.value()); }
if (Path.of(value.value()).normalize().startsWith(".."))
public FileNode(String stringVal) { super(true); this.value = new FileReference(ReferenceNode.stripQuotes(stringVal)); if (Path.of(value.value()).normalize().startsWith("..")) throw new IllegalArgumentException("path may not start with '..', but got: " + value.value()); }
class FileNode extends LeafNode<FileReference> { public FileNode() { } public FileReference value() { return value; } @Override public String getValue() { return value.value(); } @Override public String toString() { return (value == null) ? "(null)" : '"' + getValue() + '"'; } @Override protected boolean doSetValue(Str...
class FileNode extends LeafNode<FileReference> { public FileNode() { } public FileReference value() { return value; } @Override public String getValue() { return value.value(); } @Override public String toString() { return (value == null) ? "(null)" : '"' + getValue() + '"'; } @Override protected boolean doSetValue(Str...
This module didn't already depend on that. I guess I could have changed instead, but I opted for this.
public FileNode(String stringVal) { super(true); this.value = new FileReference(ReferenceNode.stripQuotes(stringVal)); if (Path.of(value.value()).normalize().startsWith("..")) throw new IllegalArgumentException("path may not start with '..', but got: " + value.value()); }
if (Path.of(value.value()).normalize().startsWith(".."))
public FileNode(String stringVal) { super(true); this.value = new FileReference(ReferenceNode.stripQuotes(stringVal)); if (Path.of(value.value()).normalize().startsWith("..")) throw new IllegalArgumentException("path may not start with '..', but got: " + value.value()); }
class FileNode extends LeafNode<FileReference> { public FileNode() { } public FileReference value() { return value; } @Override public String getValue() { return value.value(); } @Override public String toString() { return (value == null) ? "(null)" : '"' + getValue() + '"'; } @Override protected boolean doSetValue(Str...
class FileNode extends LeafNode<FileReference> { public FileNode() { } public FileReference value() { return value; } @Override public String getValue() { return value.value(); } @Override public String toString() { return (value == null) ? "(null)" : '"' + getValue() + '"'; } @Override protected boolean doSetValue(Str...
Did this work? If so I guess we need to verify nobody are doing it ...
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
It would be better to use this as a path below here, and check the below using elements().size()
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
Path.fromString(fileName);
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
But we already support this?
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
throw new UnsupportedOperationException("URI type is not supported");
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
No, but here we permit(ted) `/` if the path is absolute, but then we deny absolute paths further down, which is just nonsense.
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
No? The only thing I can find that calls this code is ONNX-models, but they also explicitly throw if the type is URI ...
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
throw new UnsupportedOperationException("URI type is not supported");
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
No: ```java System.err.println(Path.fromString("").elements()); System.err.println(Path.fromString("a").elements()); System.err.println(Path.fromString("/").elements()); System.err.println(Path.fromString("a/").elements()); System.err.println(Path.fromString("/a").elements()); ...
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
Path.fromString(fileName);
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
Yes, all those with size()==1 would be interpreted as the file "a" which is safe, but ok.
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
Path.fromString(fileName);
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
Yes, absolute are fine, but what about "myExpressions/expr1.expression"?
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
I *think* it's not supported but one of us should be sure they verified it ...
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
It's definitely not supported. The previous code threw on this. Not sure _why_ it's not supported, though.
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
It's better to support as little as possible :-)
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
fileName + "' in a different directory, which is not supported.");
private Reader openRankingExpressionReader(String expName, String expression) { if (!expression.startsWith("file:")) return new StringReader(expression); String fileName = extractFileName(expression); Path.fromString(fileName); if (fileName.contains("/")) throw new IllegalArgumentException("In " + name() + ", " + expNa...
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
class MutateOperation { public enum Phase { on_match, on_first_phase, on_second_phase, on_summary} final Phase phase; final String attribute; final String operation; public MutateOperation(Phase phase, String attribute, String operation) { this.phase = phase; this.attribute = attribute; this.operation = operation; } }
I was wrong 😭
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
throw new UnsupportedOperationException("URI type is not supported");
public FileReference addUri(String uri, Path path) { throw new UnsupportedOperationException("URI type is not supported"); /* TODO: this needs to be super-restricted if the config server should ever do this. try (TmpDir tmp = new TmpDir()) { return addFile(download(uri, tmp.dir, path.getRelative())); } catch (IOExcepti...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
class ApplicationFileManager implements AddFileInterface { private final File applicationDir; private final FileDirectory fileDirectory; ApplicationFileManager(File applicationDir, FileDirectory fileDirectory) { this.applicationDir = applicationDir; this.fileDirectory = fileDirectory; } @Override public FileReference a...
Perhaps it's this file that should be deleted?
public void require_that_valid_tar_application_can_be_unpacked() throws IOException { File outFile = createTarFile(); try (CompressedApplicationInputStream unpacked = streamFromTarGz(outFile)) { File outApp = unpacked.decompress(); assertTestApp(outApp); } }
File outFile = createTarFile();
public void require_that_valid_tar_application_can_be_unpacked() throws IOException { File outFile = createTarFile(); try (CompressedApplicationInputStream unpacked = streamFromTarGz(outFile)) { File outApp = unpacked.decompress(); assertTestApp(outApp); } }
class CompressedApplicationInputStreamTest { private static void writeFileToTar(ArchiveOutputStream taos, File file) throws IOException { taos.putArchiveEntry(taos.createArchiveEntry(file, file.getName())); ByteStreams.copy(new FileInputStream(file), taos); taos.closeArchiveEntry(); } private static File createArchiveF...
class CompressedApplicationInputStreamTest { private static void writeFileToTar(ArchiveOutputStream taos, File file) throws IOException { taos.putArchiveEntry(taos.createArchiveEntry(file, file.getName())); ByteStreams.copy(new FileInputStream(file), taos); taos.closeArchiveEntry(); } private static File createArchiveF...
Yes, it should just use a junit-managed temp dir. I'll fix it in a future PR.
public void require_that_valid_tar_application_can_be_unpacked() throws IOException { File outFile = createTarFile(); try (CompressedApplicationInputStream unpacked = streamFromTarGz(outFile)) { File outApp = unpacked.decompress(); assertTestApp(outApp); } }
File outFile = createTarFile();
public void require_that_valid_tar_application_can_be_unpacked() throws IOException { File outFile = createTarFile(); try (CompressedApplicationInputStream unpacked = streamFromTarGz(outFile)) { File outApp = unpacked.decompress(); assertTestApp(outApp); } }
class CompressedApplicationInputStreamTest { private static void writeFileToTar(ArchiveOutputStream taos, File file) throws IOException { taos.putArchiveEntry(taos.createArchiveEntry(file, file.getName())); ByteStreams.copy(new FileInputStream(file), taos); taos.closeArchiveEntry(); } private static File createArchiveF...
class CompressedApplicationInputStreamTest { private static void writeFileToTar(ArchiveOutputStream taos, File file) throws IOException { taos.putArchiveEntry(taos.createArchiveEntry(file, file.getName())); ByteStreams.copy(new FileInputStream(file), taos); taos.closeArchiveEntry(); } private static File createArchiveF...
Can't this return false instead of true, when the code point is out of range? That would save the check for isValidCodePoint. And ... I'd assume this method is intended to do exactly what you do with the `isHighSurrogate(highSurrogate(codePoint))`?
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
if ( ! isTextCharAboveUsAscii(codePoint)) return false;
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Can be simplifed to `mails.getOrDefault(recipient, List.of())`.
public List<Mail> inbox(String recipient) { if (!mails.containsKey(recipient)) { return List.of(); } return mails.get(recipient); }
return mails.get(recipient);
public List<Mail> inbox(String recipient) { return mails.getOrDefault(recipient, List.of()); }
class MockMailer implements Mailer { public final Map<String, List<Mail>> mails = new HashMap<>(); @Override public void send(Mail mail) { for (String recipient : mail.recipients()) { mails.putIfAbsent(recipient, new ArrayList<>()); mails.get(recipient).add(mail); } } @Override public String user() { return "user"; } @...
class MockMailer implements Mailer { public final Map<String, List<Mail>> mails = new HashMap<>(); public final boolean blackhole; public MockMailer() { this(false); } MockMailer(boolean blackhole) { this.blackhole = blackhole; } public static MockMailer blackhole() { return new MockMailer(true); } @Override public voi...
Nit: Assign to result of `Objects.requireNonNull`.
public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; }
this.mailer = mailer;
public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); }
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public void dispatch(Notification notification) { var tenant = curatorDb.readTenant(notification.source().tenant()); tenant.stream().forEach(t -> { if (t instanc...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public void dispatch(Notification notification) { var tenant = curatorDb.readTenant(notification.source().tenant()); tenant.stream().forEach(t -> { if (t instanc...
This should throw instead so that sending notifications for unknown contact types doesn't fail silently.
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: log.fine("Unknown TenantContac...
}
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: throw new IllegalArgumentExcep...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; } public void dispatch(Notification notification) { var t...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); } public ...
You got it right half the places!
private static void validateTextString(String id) { if ( ! Text.isValidTextString(id)) { throw new IllegalArgumentException("Unparseable id '" + id + "': Contains illegal code point 0x" + Integer.toHexString(Text.validateTextString(id).getAsInt()).toUpperCase()); } }
if ( ! Text.isValidTextString(id)) {
private static void validateTextString(String id) { if ( ! Text.isValidTextString(id)) { throw new IllegalArgumentException("Unparseable id '" + id + "': Contains illegal code point 0x" + Integer.toHexString(Text.validateTextString(id).getAsInt()).toUpperCase()); } }
class IdString { public boolean hasDocType() { return false; } public String getDocType() { return ""; } public boolean hasGroup() { return false; } public boolean hasNumber() { return false; } public long getNumber() { return 0; } public String getGroup() { return ""; } public enum Scheme { id } private final Scheme s...
class IdString { public boolean hasDocType() { return false; } public String getDocType() { return ""; } public boolean hasGroup() { return false; } public boolean hasNumber() { return false; } public long getNumber() { return 0; } public String getGroup() { return ""; } public enum Scheme { id } private final Scheme s...
Any reason to not use `Text.format`?
private Mail mailOf(Notification n, Collection<String> recipients) { var subject = new Formatter().format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name()); var body = new StringBuilder(); body.append("Source: ").append(n.source().toString()).append("\n") .append("\n") .append(Strin...
var subject = new Formatter().format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name());
private Mail mailOf(Notification n, Collection<String> recipients) { var subject = Text.format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name()); var body = new StringBuilder(); body.append("Source: ").append(n.source().toString()).append("\n") .append("\n") .append(String.join("\n"...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; } public void dispatch(Notification notification) { var t...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); } public ...
I was a bit back and forth on that. Throwing here will also block a notification being persisted to zookeeper. Is that OK? We can alternatively move the dispatch to after the ZK transaction has been committed. But that again can lead to lost mails..
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: log.fine("Unknown TenantContac...
}
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: throw new IllegalArgumentExcep...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; } public void dispatch(Notification notification) { var t...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); } public ...
Me not knowing about it. Changed.
private Mail mailOf(Notification n, Collection<String> recipients) { var subject = new Formatter().format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name()); var body = new StringBuilder(); body.append("Source: ").append(n.source().toString()).append("\n") .append("\n") .append(Strin...
var subject = new Formatter().format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name());
private Mail mailOf(Notification n, Collection<String> recipients) { var subject = Text.format("[%s] Vespa Notification for %s", n.level().toString().toUpperCase(), n.type().name()); var body = new StringBuilder(); body.append("Source: ").append(n.source().toString()).append("\n") .append("\n") .append(String.join("\n"...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; } public void dispatch(Notification notification) { var t...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); } public ...
Sending can fail for other reasons too, i.e. the mailer service being unavailable. So it's better that sending the notification happens after the write and outside the write lock. Log an error if it fails. If lost emails becomes a problem we should create a queue for them, and a separate maintainer that consumes it (a...
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: log.fine("Unknown TenantContac...
}
private void dispatch(Notification notification, TenantContacts.Type type, Collection<? extends TenantContacts.Contact> contacts) { switch (type) { case EMAIL: dispatch(notification, contacts.stream().map(c -> (TenantContacts.EmailContact) c).collect(Collectors.toList())); break; default: throw new IllegalArgumentExcep...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = curatorDb; this.mailer = mailer; } public void dispatch(Notification notification) { var t...
class Notifier { private final CuratorDb curatorDb; private final Mailer mailer; private static final Logger log = Logger.getLogger(Notifier.class.getName()); public Notifier(CuratorDb curatorDb, Mailer mailer) { this.curatorDb = Objects.requireNonNull(curatorDb); this.mailer = Objects.requireNonNull(mailer); } public ...
```suggestion return 1.0; ```
protected double maintain() { if (controller().system().equals(SystemName.PublicCd)) { tombstoneNonePlanTenants(); } moveInactiveTenantsToNonePlan(); return 1; }
return 1;
protected double maintain() { if (controller().system().equals(SystemName.PublicCd)) { tombstoneNonePlanTenants(); } moveInactiveTenantsToNonePlan(); return 1.0; }
class CloudTrialExpirer extends ControllerMaintainer { private static final Logger log = Logger.getLogger(CloudTrialExpirer.class.getName()); private static final Duration loginExpiry = Duration.ofDays(14); private final ListFlag<String> extendedTrialTenants; public CloudTrialExpirer(Controller controller, Duration int...
class CloudTrialExpirer extends ControllerMaintainer { private static final Logger log = Logger.getLogger(CloudTrialExpirer.class.getName()); private static final Duration loginExpiry = Duration.ofDays(14); private final ListFlag<String> extendedTrialTenants; public CloudTrialExpirer(Controller controller, Duration int...
(That may of course not be the case ... but what is that method used for, if this isn't the case?)
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
if ( ! isTextCharAboveUsAscii(codePoint)) return false;
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
From javadoc: ```If isSupplementaryCodePoint(x) is true, then isHighSurrogate(highSurrogate(x)) and toCodePoint(highSurrogate(x), lowSurrogate(x)) == x are also always true.```
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
&& ! Character.isLowSurrogate(Character.lowSurrogate(codePoint))) return false;
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Agree that isValidCodePoint can be removed when inverting the last return value in isTextCharacter.
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
if ( ! isTextCharAboveUsAscii(codePoint)) return false;
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
So that means that surrogate check in the else can be skipped ?
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
&& ! Character.isLowSurrogate(Character.lowSurrogate(codePoint))) return false;
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
This doesn't gain anything?
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
int length = string.length();
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
No, not in benchmark. Change is intentional to see if it effects inconsistent JIT compilation, which sometimes leaves all the String.functions here non inlined. Here, even non-optimized we should see it being called fewer times than codePointAt().
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; i++; } else if (codePoint < Character.MIN_SURROGATE) { i++; } else { if ( ! isTextCharA...
int length = string.length();
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Also, codepoint < MIN_SURROGATE is never true while the below is false, since the MIN_SURROGATE is 0xD800, which is less than the first thing checked below (0xFDD0).
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveUsAscii(codepoint); }
: (codepoint < Character.MIN_SURROGATE) || isTextCharAboveUsAscii(codepoint);
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Same applies here. This is contained in the isTextCharAboveUsAscii.
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint < Character.MIN_SURROGATE) { } else { if ( ! isTextCharAboveUsAsci...
} else if (codePoint < Character.MIN_SURROGATE) {
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Well, I suppose it's possible that branching to a different method on this if test could be beneficial for the JIT? You know this better than me :)
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint < Character.MIN_SURROGATE) { } else { if ( ! isTextCharAboveUsAsci...
} else if (codePoint < Character.MIN_SURROGATE) {
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Well it is now a sthe below check is MAX_HIGH_SURROGATE.
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveUsAscii(codepoint); }
: (codepoint < Character.MIN_SURROGATE) || isTextCharAboveUsAscii(codepoint);
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
No currently.
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint < Character.MIN_SURROGATE) { } else { if ( ! isTextCharAboveUsAsci...
} else if (codePoint < Character.MIN_SURROGATE) {
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
The main reason for branching here is that you then do not need the isBmp check below to check if you need an extra i++ in the range [0x80, 0xD800>
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint < Character.MIN_SURROGATE) { } else { if ( ! isTextCharAboveUsAsci...
} else if (codePoint < Character.MIN_SURROGATE) {
public static boolean isValidTextString(String string) { int length = string.length(); for (int i = 0; i < length; ) { int codePoint = string.codePointAt(i); if (codePoint < 0x80) { if ( ! allowedAsciiChars[codePoint]) return false; } else if (codePoint >= Character.MIN_SURROGATE) { if ( ! isTextCharAboveMinSurrogate(c...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Doesn't this now fail all leading surrogates? They're `> MIN_SURROGATE` and `< MAX_HIGH_SURROGATE`, but what you _want_ to check is that it's either not a leading surrogate, or that it is a leading surrogate followed by a trailing one.
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
: (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint);
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Never mind, this is actually correct, because you only get these code points when the string is invalid. Ok, so perhaps baking this into the `isTextCharAboveMinSurrogate` would be better?
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
: (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint);
public static boolean isTextCharacter(int codepoint) { return (codepoint < 0x80) ? allowedAsciiChars[codepoint] : (codepoint < Character.MIN_SURROGATE) || isTextCharAboveMinSurrogate(codepoint); }
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
I suggest creating a helper function for this (e.g. applyRankingSettings() / considerApplyRankingSettings()) and use that in deriveAttribute() as well to ensure we handle this the same way in both code paths.
private void deriveAttributeAsArrayType(ImmutableSDField field) { if (field.isImportedField()) { deriveImportedAttributes(field); return; } Attribute attribute = field.getAttributes().get(field.getName()); if (attribute != null) { Ranking ranking = field.getRanking(); if (ranking != null && ranking.isFilter()) { attrib...
Ranking ranking = field.getRanking();
private void deriveAttributeAsArrayType(ImmutableSDField field) { if (field.isImportedField()) { deriveImportedAttributes(field); return; } Attribute attribute = field.getAttributes().get(field.getName()); if (attribute != null) { applyRanking(field, attribute); attributes.put(attribute.getName(), attribute.convertToAr...
class AttributeFields extends Derived implements AttributesConfig.Producer { public enum FieldSet {ALL, FAST_ACCESS} private Map<String, Attribute> attributes = new java.util.LinkedHashMap<>(); private Map<String, Attribute> importedAttributes = new java.util.LinkedHashMap<>(); /** Whether this has any position attribu...
class AttributeFields extends Derived implements AttributesConfig.Producer { public enum FieldSet {ALL, FAST_ACCESS} private Map<String, Attribute> attributes = new java.util.LinkedHashMap<>(); private Map<String, Attribute> importedAttributes = new java.util.LinkedHashMap<>(); /** Whether this has any position attribu...
Correct, but it should return true.... I guess
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) < 0xFFFE; }
if (codepoint >= 0x10FFFE) return false;
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint < 0x10000) return true; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) <...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
I have a case now with a host and node in AWS. Both are parked, with allocations, and with wantToDeprovision. DynamicProvisioningMaintainer refuses to deprovision the host because it contains a node with an allocation. To get around this an operator needs to: * Remove wantToDeprovision on node, otherwise the next st...
public Node deallocate(Node node, Agent agent, String reason, NestedTransaction transaction) { if (parkOnDeallocationOf(node, agent)) { return park(node.hostname(), false, agent, reason, transaction); } else { Node.State toState = Node.State.dirty; if (node.state() == Node.State.parked && node.status().wantToDeprovisio...
if (node.state() == Node.State.parked && node.status().wantToDeprovision()) {
public Node deallocate(Node node, Agent agent, String reason, NestedTransaction transaction) { if (parkOnDeallocationOf(node, agent)) { return park(node.hostname(), false, agent, reason, transaction); } else { Node.State toState = Node.State.dirty; if (node.state() == Node.State.parked && node.status().wantToDeprovisio...
class Nodes { private static final Logger log = Logger.getLogger(Nodes.class.getName()); private final CuratorDatabaseClient db; private final Zone zone; private final Clock clock; private final Orchestrator orchestrator; public Nodes(CuratorDatabaseClient db, Zone zone, Clock clock, Orchestrator orchestrator) { this.z...
class Nodes { private static final Logger log = Logger.getLogger(Nodes.class.getName()); private final CuratorDatabaseClient db; private final Zone zone; private final Clock clock; private final Orchestrator orchestrator; public Nodes(CuratorDatabaseClient db, Zone zone, Clock clock, Orchestrator orchestrator) { this.z...
![image](https://user-images.githubusercontent.com/16574012/162068895-5d6214b4-ef17-46a7-8d85-9b422d721230.png)
DocumentId id() { return new DocumentId("id:" + requireNonNull(path.get("namespace")) + ":" + requireNonNull(path.get("documentType")) + ":" + group.map(Group::docIdPart).orElse("") + ":" + String.join("/", requireNonNull(path.getRest()).segments())); }
":" + String.join("/", requireNonNull(path.getRest()).segments()));
DocumentId id() { return new DocumentId("id:" + requireNonNull(path.get("namespace")) + ":" + requireNonNull(path.get("documentType")) + ":" + group.map(Group::docIdPart).orElse("") + ":" + String.join("/", requireNonNull(path.getRest()).segments())); }
class DocumentPath { private final Path path; private final String rawPath; private final Optional<Group> group; DocumentPath(Path path, String rawPath) { this.path = requireNonNull(path); this.rawPath = requireNonNull(rawPath); this.group = Optional.ofNullable(path.get("number")).map(unsignedLongParser::parse).map(Gro...
class DocumentPath { private final Path path; private final String rawPath; private final Optional<Group> group; DocumentPath(Path path, String rawPath) { this.path = requireNonNull(path); this.rawPath = requireNonNull(rawPath); this.group = Optional.ofNullable(path.get("number")).map(unsignedLongParser::parse).map(Gro...
```suggestion if (codepoint < 0x10000) return false; if (codepoint >= 0x10FFFE) return false; ```
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) < 0xFFFE; }
if (codepoint >= 0x10FFFE) return false;
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint < 0x10000) return true; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) <...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Like so
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) < 0xFFFE; }
if (codepoint >= 0x10FFFE) return false;
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint < 0x10000) return true; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) <...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
Haha, yes.
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) < 0xFFFE; }
if (codepoint >= 0x10FFFE) return false;
private static boolean isTextCharAboveMinSurrogate(int codepoint) { if (codepoint <= Character.MAX_HIGH_SURROGATE) return false; if (codepoint < 0xFDD0) return true; if (codepoint <= 0xFDDF) return false; if (codepoint < 0x10000) return true; if (codepoint >= 0x10FFFE) return false; return (codepoint & 0xffff) <...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
class Text { private static final boolean[] allowedAsciiChars = new boolean[0x80]; static { allowedAsciiChars[0x0] = false; allowedAsciiChars[0x1] = false; allowedAsciiChars[0x2] = false; allowedAsciiChars[0x3] = false; allowedAsciiChars[0x4] = false; allowedAsciiChars[0x5] = false; allowedAsciiChars[0x6] = false; allo...
`concurrent_mutations` and `test_and_set_failed` metrics do not need to be included, as they cannot happen for read-only operations
private static Set<Metric> getStorageMetrics() { Set<Metric> metrics = new LinkedHashSet<>(); metrics.add(new Metric("vds.datastored.alldisks.docs.average")); metrics.add(new Metric("vds.datastored.alldisks.bytes.average")); metrics.add(new Metric("vds.visitor.allthreads.averagevisitorlifetime.sum.max")); metrics.add(n...
metrics.add(new Metric("vds.distributor.visitor.sum.failures.test_and_set_failed.rate"));
private static Set<Metric> getStorageMetrics() { Set<Metric> metrics = new LinkedHashSet<>(); metrics.add(new Metric("vds.datastored.alldisks.docs.average")); metrics.add(new Metric("vds.datastored.alldisks.bytes.average")); metrics.add(new Metric("vds.visitor.allthreads.averagevisitorlifetime.sum.max")); metrics.add(n...
class VespaMetricSet { public static final MetricSet vespaMetricSet = new MetricSet("vespa", getVespaMetrics(), singleton(defaultVespaMetricSet)); private static Set<Metric> getVespaMetrics() { Set<Metric> metrics = new LinkedHashSet<>(); metrics.addAll(getSearchNodeMetrics()); metrics.addAll(getStorageMetrics()); metr...
class VespaMetricSet { public static final MetricSet vespaMetricSet = new MetricSet("vespa", getVespaMetrics(), singleton(defaultVespaMetricSet)); private static Set<Metric> getVespaMetrics() { Set<Metric> metrics = new LinkedHashSet<>(); metrics.addAll(getSearchNodeMetrics()); metrics.addAll(getStorageMetrics()); metr...
non-nullity asserted already, some lines up
public Endpoint in(SystemName system) { if (system.isPublic() && routingMethod != RoutingMethod.exclusive) { throw new IllegalArgumentException("Public system only supports routing method " + RoutingMethod.exclusive); } if (routingMethod.isDirect() && !port.isDefault()) { throw new IllegalArgumentException("Routing met...
instance,
public Endpoint in(SystemName system) { if (system.isPublic() && routingMethod != RoutingMethod.exclusive) { throw new IllegalArgumentException("Public system only supports routing method " + RoutingMethod.exclusive); } if (routingMethod.isDirect() && !port.isDefault()) { throw new IllegalArgumentException("Routing met...
class EndpointBuilder { private final TenantAndApplicationId application; private final Optional<InstanceName> instance; private Scope scope; private List<Target> targets; private ClusterSpec.Id cluster; private EndpointId endpointId; private Port port; private RoutingMethod routingMethod = RoutingMethod.sharedLayer4; ...
class EndpointBuilder { private final TenantAndApplicationId application; private final Optional<InstanceName> instance; private Scope scope; private List<Target> targets; private ClusterSpec.Id cluster; private EndpointId endpointId; private Port port; private RoutingMethod routingMethod = RoutingMethod.sharedLayer4; ...
Ah, never mind this commit—I read that boolean inverted. This was correct after all. This was fixed later, when I rewrite this to also update the revision history.
public void finish(RunId id) throws TimeoutException { List<Lock> locks = new ArrayList<>(); try { Run unlockedRun = run(id).get(); for (Step step : report.allPrerequisites(unlockedRun.steps().keySet())) locks.add(curator.lock(id.application(), id.type(), step)); locked(id, run -> { if (run.status() == reset) { for (St...
controller.jobController().runs(id.job()).values().stream()
public void finish(RunId id) throws TimeoutException { List<Lock> locks = new ArrayList<>(); try { Run unlockedRun = run(id).get(); for (Step step : report.allPrerequisites(unlockedRun.steps().keySet())) locks.add(curator.lock(id.application(), id.type(), step)); locked(id, run -> { if (run.status() == reset) { for (St...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private final TesterCloud cloud; private final JobMetrics metric; private final AtomicRefere...
class JobController { public static final Duration maxHistoryAge = Duration.ofDays(60); private static final Logger log = Logger.getLogger(JobController.class.getName()); private final int historyLength; private final Controller controller; private final CuratorDb curator; private final BufferedLogStore logs; private f...
```suggestion devRevisions.put(job, revisionsFromSlime(devRevisionsObject.field(versionsField), job)); ```
private RevisionHistory revisionsFromSlime(Inspector prodVersionsArray, Inspector devVersionsArray, TenantAndApplicationId id) { List<ApplicationVersion> revisions = revisionsFromSlime(prodVersionsArray, null); Map<JobId, List<ApplicationVersion>> devRevisions = new HashMap<>(); devVersionsArray.traverse((ArrayTraverse...
devRevisions.put(jobIdFromSlime(id, devRevisionsObject), revisionsFromSlime(devRevisionsObject.field(versionsField), job));
private RevisionHistory revisionsFromSlime(Inspector prodVersionsArray, Inspector devVersionsArray, TenantAndApplicationId id) { List<ApplicationVersion> revisions = revisionsFromSlime(prodVersionsArray, null); Map<JobId, List<ApplicationVersion>> devRevisions = new HashMap<>(); devVersionsArray.traverse((ArrayTraverse...
class ApplicationSerializer { private static final String idField = "id"; private static final String createdAtField = "createdAt"; private static final String deploymentSpecField = "deploymentSpecField"; private static final String validationOverridesField = "validationOverrides"; private static final String instances...
class ApplicationSerializer { private static final String idField = "id"; private static final String createdAtField = "createdAt"; private static final String deploymentSpecField = "deploymentSpecField"; private static final String validationOverridesField = "validationOverrides"; private static final String instances...
Isn't it better to keep Collections-unmodifiableList here? This will make a copy each time the code checks whether this list is non-empty etc.
public List<Integer> getOrderByIndexes() { return List.copyOf(orderByIdx); }
return List.copyOf(orderByIdx);
public List<Integer> getOrderByIndexes() { return List.copyOf(orderByIdx); }
class Group extends Identifiable { public static final int classId = registerClass(0x4000 + 90, Group.class); private static final ObjectPredicate REF_LOCATOR = new RefLocator(); private List<Integer> orderByIdx = List.of(); private List<ExpressionNode> orderByExp = List.of(); private List<AggregationResult> aggregatio...
class Group extends Identifiable { public static final int classId = registerClass(0x4000 + 90, Group.class); private static final ObjectPredicate REF_LOCATOR = new RefLocator(); private List<Integer> orderByIdx = List.of(); private List<ExpressionNode> orderByExp = List.of(); private List<AggregationResult> aggregatio...
For the `List.of()` variants, this doesn't actually copy, but all large lists will be copied, indeed.
public List<Integer> getOrderByIndexes() { return List.copyOf(orderByIdx); }
return List.copyOf(orderByIdx);
public List<Integer> getOrderByIndexes() { return List.copyOf(orderByIdx); }
class Group extends Identifiable { public static final int classId = registerClass(0x4000 + 90, Group.class); private static final ObjectPredicate REF_LOCATOR = new RefLocator(); private List<Integer> orderByIdx = List.of(); private List<ExpressionNode> orderByExp = List.of(); private List<AggregationResult> aggregatio...
class Group extends Identifiable { public static final int classId = registerClass(0x4000 + 90, Group.class); private static final ObjectPredicate REF_LOCATOR = new RefLocator(); private List<Integer> orderByIdx = List.of(); private List<ExpressionNode> orderByExp = List.of(); private List<AggregationResult> aggregatio...
(((\(✘෴✘)/)))
GroupListBuilder getOrCreateChildList(int tag, boolean ranked) { int index = tag + 1; if (childLists == null || index >= childLists.length) { int reservedSize = (((index + 1) + (CHILDLIST_SIZE_INCREMENTS -1))/CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS; childLists = (childLists == null) ? new GroupListBuilde...
int index = tag + 1;
GroupListBuilder getOrCreateChildList(int tag, boolean ranked) { int index = tag + 1; if (childLists == null || index >= childLists.length) { int minSize = index + 1; int reservedSize = ((minSize + (CHILDLIST_SIZE_INCREMENTS - 1))/CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS; childLists = (childLists == null)...
class GroupBuilder { private static final int CHILDLIST_SIZE_INCREMENTS = 4; boolean [] results = new boolean[8]; GroupListBuilder [] childLists; int childCount = 0; final ResultId resultId; final com.yahoo.searchlib.aggregation.Group group; final boolean stable; GroupBuilder(ResultId resultId, com.yahoo.searchlib.aggr...
class GroupBuilder { private static final int CHILDLIST_SIZE_INCREMENTS = 4; boolean [] results = new boolean[8]; GroupListBuilder [] childLists; int childCount = 0; final ResultId resultId; final com.yahoo.searchlib.aggregation.Group group; final boolean stable; GroupBuilder(ResultId resultId, com.yahoo.searchlib.aggr...
```suggestion int reservedSize = ((index + CHILDLIST_SIZE_INCREMENTS) / CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS; ```
GroupListBuilder getOrCreateChildList(int tag, boolean ranked) { int index = tag + 1; if (childLists == null || index >= childLists.length) { int reservedSize = (((index + 1) + (CHILDLIST_SIZE_INCREMENTS -1))/CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS; childLists = (childLists == null) ? new GroupListBuilde...
int reservedSize = (((index + 1) + (CHILDLIST_SIZE_INCREMENTS -1))/CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS;
GroupListBuilder getOrCreateChildList(int tag, boolean ranked) { int index = tag + 1; if (childLists == null || index >= childLists.length) { int minSize = index + 1; int reservedSize = ((minSize + (CHILDLIST_SIZE_INCREMENTS - 1))/CHILDLIST_SIZE_INCREMENTS) * CHILDLIST_SIZE_INCREMENTS; childLists = (childLists == null)...
class GroupBuilder { private static final int CHILDLIST_SIZE_INCREMENTS = 4; boolean [] results = new boolean[8]; GroupListBuilder [] childLists; int childCount = 0; final ResultId resultId; final com.yahoo.searchlib.aggregation.Group group; final boolean stable; GroupBuilder(ResultId resultId, com.yahoo.searchlib.aggr...
class GroupBuilder { private static final int CHILDLIST_SIZE_INCREMENTS = 4; boolean [] results = new boolean[8]; GroupListBuilder [] childLists; int childCount = 0; final ResultId resultId; final com.yahoo.searchlib.aggregation.Group group; final boolean stable; GroupBuilder(ResultId resultId, com.yahoo.searchlib.aggr...