Skip to content
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

Move cmd out of ax-core #615

Merged
merged 36 commits into from
Dec 12, 2023
Merged

Move cmd out of ax-core #615

merged 36 commits into from
Dec 12, 2023

Conversation

jmg-duarte
Copy link
Contributor

No description provided.

@jmg-duarte jmg-duarte changed the base branch from master to dev November 30, 2023 16:35
Copy link
Contributor

@Kelerchian Kelerchian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fine + some remarks

}

// NOTE(duarte): there has to be a better way of doing this
impl TryFrom<&Option<KeyPathWrapper>> for AxPrivateKey {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather use a custom function for this instead of TryFrom, since the implementation detail involves a side effect with a particular path default_user_identity_path.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this implementation is not ideal but this is quite pervasive in the code base and this is already a big change 🤔

/// Linux $XDG_CONFIG_HOME or $HOME/.config /home/alice/.config
/// macOS $HOME/Library/Application Support /Users/Alice/Library/Application Support
/// Windows {FOLDERID_RoamingAppData} C:\Users\Alice\AppData\Roaming
fn get_data_dir() -> ActyxOSResult<PathBuf> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better in util, but overall,
I think ax-core shouldn't care about paths at all, and this better be put in ax, consequently default loading mechanism shouldn't be written inside ax-core, instead it should be supplied by ax e.g. via dependency-injection

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to reply. I don't think addressing this right now is pertinent, though I agree. Both this and the previous issue you outlined are relevant but a bit outside the scope of this PR. Should we open an issue?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely. There's no need to fix this in this PR

#618
I created the issue.

use std::net::ToSocketAddrs;

#[derive(Debug, Clone)]
pub struct Authority {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we unify this with PortOrHostPort? Absence of the host part means a different thing depending on context (binding to INADDR_ANY or connecting to localhost, for example).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That might be the case but I lack the knowledge to reply. We can review this together though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, reading the code more carefully we might unify it, but it doesn’t really fit very well: Authority describes how to reach an admin port, including multiaddr usage (e.g. for relaying), while PortOrHostPort describes a specific (set of) TCP/IP SocketAddr to bind a service to (i.e. multiaddr isn’t relevant).

So I’d say we leave it as is.

path.0
.to_str()
.and_then(|s| s.parse::<AxPrivateKey>().ok())
.ok_or(ActyxOSError::internal(""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I recall where this is used, but it feels suspicious that we erase the error message and replace it by a meaningless one

rust/actyx/ax/tests/version_compat.rs Show resolved Hide resolved
@jmg-duarte jmg-duarte merged commit da13399 into dev Dec 12, 2023
9 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/cmd branch December 12, 2023 19:27
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants