-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
05875 query workflow improvements (#5971)
Signed-off-by: Michael Heinrichs <netopyr@users.noreply.github.com>
- Loading branch information
Showing
19 changed files
with
505 additions
and
387 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/info/CurrentPlatformStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.spi.info; | ||
|
||
import com.swirlds.common.system.PlatformStatus; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
/** | ||
* Provides the current platform status. | ||
*/ | ||
public interface CurrentPlatformStatus { | ||
|
||
/** | ||
* Returns the current platform status. | ||
* | ||
* @return the current platform status | ||
*/ | ||
@NonNull | ||
PlatformStatus get(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
hedera-node/hedera-app-spi/src/main/java/com/hedera/node/app/spi/info/NodeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.spi.info; | ||
|
||
import com.swirlds.common.system.address.AddressBook; | ||
|
||
/** | ||
* Summarizes useful information about the nodes in the {@link AddressBook} from the Platform. In | ||
* the future, there may be events that require re-reading the book; but at present nodes may treat | ||
* the initializing book as static. | ||
*/ | ||
public interface NodeInfo { | ||
|
||
/** | ||
* Convenience method to check if this node is zero-stake. | ||
* | ||
* @return whether this node has zero stake. | ||
*/ | ||
boolean isSelfZeroStake(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
hedera-node/hedera-app/src/main/java/com/hedera/node/app/info/InfoDaggerModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.info; | ||
|
||
import com.hedera.node.app.spi.info.CurrentPlatformStatus; | ||
import com.hedera.node.app.spi.info.NetworkInfo; | ||
import com.hedera.node.app.spi.info.NodeInfo; | ||
import dagger.Module; | ||
import dagger.Provides; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import javax.inject.Singleton; | ||
|
||
/** A Dagger module for facilities in the {@link com.hedera.node.app.info} package. */ | ||
@Module | ||
public interface InfoDaggerModule { | ||
|
||
@Provides | ||
@Singleton | ||
static CurrentPlatformStatus provideCurrentPlatformStatus( | ||
@NonNull final com.hedera.node.app.service.mono.context.CurrentPlatformStatus delegate) { | ||
return new MonoCurrentPlatformStatus(delegate); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
static NetworkInfo provideNetworkInfo(@NonNull final com.hedera.node.app.service.mono.config.NetworkInfo delegate) { | ||
return new MonoNetworkInfo(delegate); | ||
} | ||
|
||
@Provides | ||
@Singleton | ||
static NodeInfo provideNodeInfo(@NonNull final com.hedera.node.app.service.mono.context.NodeInfo delegate) { | ||
return new MonoNodeInfo(delegate); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
hedera-node/hedera-app/src/main/java/com/hedera/node/app/info/MonoCurrentPlatformStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.info; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import com.hedera.node.app.spi.info.CurrentPlatformStatus; | ||
import com.swirlds.common.system.PlatformStatus; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
/** | ||
* Implementation of {@link CurrentPlatformStatus} that delegates to the mono-service. | ||
*/ | ||
public class MonoCurrentPlatformStatus implements CurrentPlatformStatus { | ||
|
||
private final com.hedera.node.app.service.mono.context.CurrentPlatformStatus delegate; | ||
|
||
/** | ||
* Constructs a {@link MonoCurrentPlatformStatus} with the given delegate. | ||
* | ||
* @param delegate the delegate | ||
* @throws NullPointerException if {@code delegate} is {@code null} | ||
*/ | ||
public MonoCurrentPlatformStatus(@NonNull com.hedera.node.app.service.mono.context.CurrentPlatformStatus delegate) { | ||
this.delegate = requireNonNull(delegate); | ||
} | ||
|
||
@Override | ||
@NonNull | ||
public PlatformStatus get() { | ||
final var status = delegate.get(); | ||
return status != null ? status : PlatformStatus.STARTING_UP; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
hedera-node/hedera-app/src/main/java/com/hedera/node/app/info/MonoNetworkInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.info; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import com.hedera.node.app.spi.info.NetworkInfo; | ||
import com.hedera.pbj.runtime.io.buffer.Bytes; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
/** | ||
* Implementation of {@link NetworkInfo} that delegates to the mono-service. | ||
*/ | ||
public class MonoNetworkInfo implements NetworkInfo { | ||
|
||
private final com.hedera.node.app.service.mono.config.NetworkInfo delegate; | ||
|
||
/** | ||
* Constructs a {@link MonoNetworkInfo} with the given delegate. | ||
* | ||
* @param delegate the delegate | ||
* @throws NullPointerException if {@code delegate} is {@code null} | ||
*/ | ||
public MonoNetworkInfo(@NonNull com.hedera.node.app.service.mono.config.NetworkInfo delegate) { | ||
this.delegate = requireNonNull(delegate); | ||
} | ||
|
||
@Override | ||
@NonNull | ||
public Bytes ledgerId() { | ||
final var ledgerId = delegate.ledgerId(); | ||
return ledgerId != null ? Bytes.wrap(ledgerId.toByteArray()) : Bytes.EMPTY; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
hedera-node/hedera-app/src/main/java/com/hedera/node/app/info/MonoNodeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2023 Hedera Hashgraph, LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.hedera.node.app.info; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import com.hedera.node.app.spi.info.NodeInfo; | ||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
|
||
/** | ||
* Implementation of {@link NodeInfo} that delegates to the mono-service. | ||
*/ | ||
public class MonoNodeInfo implements NodeInfo { | ||
|
||
private final com.hedera.node.app.service.mono.context.NodeInfo delegate; | ||
|
||
/** | ||
* Constructs a {@link MonoNodeInfo} with the given delegate. | ||
* | ||
* @param delegate the delegate | ||
* @throws NullPointerException if {@code delegate} is {@code null} | ||
*/ | ||
public MonoNodeInfo(@NonNull com.hedera.node.app.service.mono.context.NodeInfo delegate) { | ||
this.delegate = requireNonNull(delegate); | ||
} | ||
|
||
@Override | ||
public boolean isSelfZeroStake() { | ||
return delegate.isSelfZeroStake(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.