-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: DatabaseMetadata -> InstanceData
- Loading branch information
Showing
12 changed files
with
160 additions
and
133 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,53 @@ | ||
use anyhow::{Result, bail}; | ||
use anyhow::{bail, Result}; | ||
|
||
pub trait PackageManager { | ||
/// Get the location of the package manager's binary on the filesystem. | ||
pub fn getManagerLocation(&self) -> Result<PathBuf> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/** | ||
* Get the location of the package manager's binary on the filesystem. | ||
* | ||
* @return The package manager's file path | ||
* @throws Exception | ||
*/ | ||
public abstract Path getManagerLocation() throws Exception; | ||
|
||
/** | ||
* Get the package manager's version string. | ||
* | ||
* @return The local version | ||
* @throws Exception | ||
*/ | ||
public abstract String getManagerVersion() throws Exception; | ||
/// Get the package manager's version string. | ||
pub async fn getManagerVersion(&self) -> Result<String> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/** | ||
* Remove old packages from the local package cache. | ||
* | ||
* @throws Exception | ||
*/ | ||
public abstract void clean() throws Exception; | ||
/// Remove old packages from the local package cache. | ||
pub async fn clean() -> Result<()> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/** | ||
* Get all currently installed packages. | ||
* | ||
* @return All locally installed packages | ||
* @throws Exception | ||
*/ | ||
public abstract List<Package> getInstalled() throws Exception; | ||
/// Get all currently installed packages. | ||
pub async fn getInstalled() -> Result<Vec<Package>> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/** | ||
* Gather advanced metadata for the given package. | ||
* | ||
* @param name The package name | ||
* @return The package metadata | ||
* @throws Exception | ||
*/ | ||
public abstract Package getMetadata(String name) throws Exception; | ||
/// Gather advanced metadata for the given package. | ||
pub async fn getMetadata(name: String) -> Result<Package> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/** | ||
* Get all packages that are currently outdated. | ||
* | ||
* @return All packages that have a newer version available | ||
* @throws Exception | ||
*/ | ||
public abstract List<Package> getOutdated() throws Exception; | ||
/// Get all packages that are currently outdated. | ||
pub async fn getOutdated() -> Result<Vec<Package>> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/// Install the given packages onto the local system. | ||
pub async fn install(packages: Vec<String>) -> Result<()> { | ||
todo!("Not implemented"); | ||
} | ||
/// Install the given packages onto the local system. | ||
pub async fn install(packages: Vec<String>) -> Result<()> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/// Synchronize the local package database with all remote repositories. | ||
pub async fn refresh() -> Result<()> { | ||
todo!("Not implemented"); | ||
} | ||
/// Synchronize the local package database with all remote repositories. | ||
pub async fn refresh() -> Result<()> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/// Remove the given packages from the local system. | ||
pub async fn remove(packages: Vec<String>) -> Result<()> { | ||
todo!("Not implemented"); | ||
/// Remove the given packages from the local system. | ||
pub async fn remove(packages: Vec<String>) -> Result<()> { | ||
bail!("Not implemented"); | ||
} | ||
|
||
/// Upgrade the given packages to the latest available version. | ||
pub async fn upgrade(packages: Vec<String>) -> Result<()> { | ||
todo!("Not implemented"); | ||
bail!("Not implemented"); | ||
} | ||
} |
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,21 @@ | ||
use tokio::process::Child; | ||
|
||
pub struct ShellSession { | ||
pub data: ShellSessionData, | ||
pub process: Child, | ||
} | ||
|
||
impl StreamSource<ShellSessionOutputEvent> for ShellSession { | ||
async fn emit(&self) -> ShellSessionOutputEvent {} | ||
} | ||
|
||
impl StreamSink<ShellSessionInputEvent> for ShellSession { | ||
async fn accept(&self, event: ShellSessionInputEvent) -> Result<ShellSessionOutputEvent> {} | ||
} | ||
|
||
impl Drop for ShellSession { | ||
fn drop(&mut self) { | ||
debug!("Killing child process"); | ||
self.process.kill() | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#[cfg(feature = "layer-desktop")] | ||
pub mod desktop; | ||
#[cfg(feature = "layer-packages")] | ||
#[cfg(feature = "layer-package")] | ||
pub mod package; |
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
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
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
Oops, something went wrong.