-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Environments API #152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
l-monninger
wants to merge
8
commits into
l-monninger/mtma-select-null-migration
Choose a base branch
from
l-monninger/environments-api
base: l-monninger/mtma-select-null-migration
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b36f125
chore: restructure environments; remove node and migrator distinction…
l-monninger f6ed894
feat: testing environment.
l-monninger 982d2bf
chore: structure box and provisioner environments.
l-monninger 11e92c4
chore: nullify unimplemented environments; demonstrate environment se…
l-monninger 2529fb5
docs: make it clearer this is the config for the null migration.
l-monninger a6defff
chore: machete.
l-monninger 66aec5a
chore: add missing deps required for build
andygolay 5599c72
Merge pull request #153 from movementlabsxyz/l-monninger/warn-unused
andygolay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,42 @@ | ||
[package] | ||
name = "mtma-box-environment" | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
license = { workspace = true } | ||
authors = { workspace = true } | ||
homepage = { workspace = true } | ||
publish = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
[dependencies] | ||
tokio = { workspace = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
clap = { workspace = true, features = ["derive"] } | ||
dotenv = { workspace = true } | ||
anyhow = { workspace = true } | ||
clap-markdown-ext = { workspace = true } | ||
thiserror = { workspace = true } | ||
orfile = { workspace = true } | ||
mtma-node-types = { workspace = true } | ||
mtma-migrator-types = { workspace = true } | ||
mtma-node-null-core = { workspace = true } | ||
aptos-db = { workspace = true } | ||
aptos-storage-interface = { workspace = true } | ||
aptos-config = { workspace = true } | ||
aptos-executor = { workspace = true } | ||
aptos-vm = { workspace = true } | ||
chrono = { workspace = true } | ||
walkdir = { workspace = true } | ||
uuid = { workspace = true } | ||
tracing = { workspace = true } | ||
aptos-framework-pre-l1-merge-release = { workspace = true } | ||
movement-signer = { workspace = true } | ||
movement-signer-loader = { workspace = true } | ||
hex = { workspace = true } | ||
mtma-types = { workspace = true } | ||
movement-core = { workspace = true } | ||
mtma-environment-types = { workspace = true } | ||
kestrel = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains hidden or 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,2 @@ | ||
# `mtma-box-environment` | ||
The environment which provides a [Migrator](/README.md#migrator) constructed via access to state on the current node. |
This file contains hidden or 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,7 @@ | ||
/// Contains the configuration structs and logic for the migration. | ||
pub mod config; | ||
/// Contains the logic for the migration. | ||
pub mod environment; | ||
|
||
pub use config::*; | ||
pub use environment::*; |
This file contains hidden or 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,28 @@ | ||
use crate::BoxEnvironment; | ||
use clap::Parser; | ||
use serde::{Deserialize, Serialize}; | ||
use std::fmt::Debug; | ||
|
||
/// Errors thrown when working with the [Config]. | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum EnvironmentConfigError { | ||
#[error("failed to build from config: {0}")] | ||
Build(#[source] Box<dyn std::error::Error + Send + Sync>), | ||
} | ||
|
||
/// The config for the [BoxEnvironment]. | ||
/// | ||
/// All fields should be easily statically encodable to a CLI argument. | ||
/// This is the frontend for the core API. | ||
#[derive(Parser, Debug, Serialize, Deserialize, Clone, Default)] | ||
#[clap(help_expected = true)] | ||
pub struct Config {} | ||
|
||
impl Config { | ||
/// Builds the [BoxEnvironment] struct from the config. | ||
/// | ||
/// Note: preserving faillibility here because we may add debug path configuration to the [BoxEnvironment] soon. | ||
pub fn build(&self) -> Result<BoxEnvironment, EnvironmentConfigError> { | ||
Ok(BoxEnvironment::new()) | ||
} | ||
} |
This file contains hidden or 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,30 @@ | ||
use mtma_environment_types::{EnvironmentError, Environmentish}; | ||
use mtma_migrator_types::migrator::MovementMigrator; | ||
use std::fmt::Debug; | ||
|
||
/// Errors thrown when using the [BoxEnvironment]. | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum BoxEnvironmentError { | ||
#[error("Testing Environment: failed with an internal error: {0}")] | ||
Internal(#[source] Box<dyn std::error::Error + Send + Sync>), | ||
} | ||
|
||
impl From<BoxEnvironmentError> for EnvironmentError { | ||
fn from(e: BoxEnvironmentError) -> Self { | ||
EnvironmentError::Internal(e.into()) | ||
} | ||
} | ||
|
||
pub struct BoxEnvironment {} | ||
|
||
impl BoxEnvironment { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl Environmentish for BoxEnvironment { | ||
async fn build_movement_migrator(&self) -> Result<MovementMigrator, EnvironmentError> { | ||
Err(BoxEnvironmentError::Internal(anyhow::anyhow!("not implemented").into()).into()) | ||
} | ||
} |
This file contains hidden or 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,2 @@ | ||
pub mod environment; | ||
pub use environment::*; |
This file contains hidden or 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,42 @@ | ||
[package] | ||
name = "mtma-provisioner-environment" | ||
version = { workspace = true } | ||
edition = { workspace = true } | ||
license = { workspace = true } | ||
authors = { workspace = true } | ||
homepage = { workspace = true } | ||
publish = { workspace = true } | ||
rust-version = { workspace = true } | ||
|
||
[dependencies] | ||
tokio = { workspace = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
clap = { workspace = true, features = ["derive"] } | ||
dotenv = { workspace = true } | ||
anyhow = { workspace = true } | ||
clap-markdown-ext = { workspace = true } | ||
thiserror = { workspace = true } | ||
orfile = { workspace = true } | ||
mtma-node-types = { workspace = true } | ||
mtma-migrator-types = { workspace = true } | ||
mtma-node-null-core = { workspace = true } | ||
aptos-db = { workspace = true } | ||
aptos-storage-interface = { workspace = true } | ||
aptos-config = { workspace = true } | ||
aptos-executor = { workspace = true } | ||
aptos-vm = { workspace = true } | ||
chrono = { workspace = true } | ||
walkdir = { workspace = true } | ||
uuid = { workspace = true } | ||
tracing = { workspace = true } | ||
aptos-framework-pre-l1-merge-release = { workspace = true } | ||
movement-signer = { workspace = true } | ||
movement-signer-loader = { workspace = true } | ||
hex = { workspace = true } | ||
mtma-types = { workspace = true } | ||
movement-core = { workspace = true } | ||
mtma-environment-types = { workspace = true } | ||
kestrel = { workspace = true } | ||
|
||
[lints] | ||
workspace = true |
This file contains hidden or 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,2 @@ | ||
# `mtma-provisioner-environment` | ||
The environment which provides a [Migrator](/README.md#migrator) constructed via a provisioner node. |
This file contains hidden or 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,7 @@ | ||
/// Contains the configuration structs and logic for the migration. | ||
pub mod config; | ||
/// Contains the logic for the migration. | ||
pub mod environment; | ||
|
||
pub use config::*; | ||
pub use environment::*; |
This file contains hidden or 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,28 @@ | ||
use crate::ProvisionerEnvironment; | ||
use clap::Parser; | ||
use serde::{Deserialize, Serialize}; | ||
use std::fmt::Debug; | ||
|
||
/// Errors thrown when working with the [Config]. | ||
#[derive(Debug, thiserror::Error)] | ||
pub enum EnvironmentConfigError { | ||
#[error("failed to build from config: {0}")] | ||
Build(#[source] Box<dyn std::error::Error + Send + Sync>), | ||
} | ||
|
||
/// The config for the [ProvisionerEnvironment]. | ||
/// | ||
/// All fields should be easily statically encodable to a CLI argument. | ||
/// This is the frontend for the core API. | ||
#[derive(Parser, Debug, Serialize, Deserialize, Clone, Default)] | ||
#[clap(help_expected = true)] | ||
pub struct Config {} | ||
|
||
impl Config { | ||
/// Builds the [ProvisionerEnvironment] struct from the config. | ||
/// | ||
/// Note: preserving faillibility here because we may add debug path configuration to the [ProvisionerEnvironment] soon. | ||
pub fn build(&self) -> Result<ProvisionerEnvironment, EnvironmentConfigError> { | ||
Ok(ProvisionerEnvironment::new()) | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.