feat: Move the store to private.

This commit is contained in:
J H
2024-03-12 11:58:13 -06:00
parent 1f47abf195
commit ba325b1581
5 changed files with 31 additions and 31 deletions

View File

@@ -186,18 +186,30 @@ pub enum RevisionsRes {
#[serde(rename_all = "kebab-case")]
#[command(rename_all = "kebab-case")]
pub struct CliDumpParams {
#[arg(long = "include-private", short = 'p')]
#[serde(default)]
include_private: bool,
path: Option<PathBuf>,
}
#[instrument(skip_all)]
async fn cli_dump(
ctx: CliContext,
CliDumpParams { path }: CliDumpParams,
CliDumpParams {
path,
include_private,
}: CliDumpParams,
) -> Result<Dump, RpcError> {
let dump = if let Some(path) = path {
PatchDb::open(path).await?.dump(&ROOT).await
} else {
from_value::<Dump>(ctx.call_remote("db.dump", imbl_value::json!({})).await?)?
from_value::<Dump>(
ctx.call_remote(
"db.dump",
imbl_value::json!({ "include-private":include_private }),
)
.await?,
)?
};
Ok(dump)
@@ -216,14 +228,11 @@ pub async fn dump(
ctx: RpcContext,
DumpParams { include_private }: DumpParams,
) -> Result<Dump, Error> {
Ok(ctx
.db
.dump(&if include_private {
ROOT
} else {
PUBLIC.borrowed()
})
.await)
Ok(if include_private {
ctx.db.dump(&ROOT).await
} else {
ctx.db.dump(&PUBLIC).await
})
}
#[instrument(skip_all)]

View File

@@ -120,6 +120,7 @@ impl Database {
sessions: Sessions::new(),
notifications: Notifications::new(),
cifs: CifsTargets::new(),
package_stores: BTreeMap::new(),
}, // TODO
})
}
@@ -149,6 +150,8 @@ pub struct Private {
pub sessions: Sessions,
pub notifications: Notifications,
pub cifs: CifsTargets,
#[serde(default)]
pub package_stores: BTreeMap<PackageId, Value>,
}
#[derive(Debug, Deserialize, Serialize, HasModel)]
@@ -513,7 +516,6 @@ pub struct InstalledPackageInfo {
pub current_dependencies: CurrentDependencies,
pub interface_addresses: InterfaceAddressMap,
pub hosts: HostInfo,
pub store: Value,
pub store_exposed_ui: Vec<ExposedUI>,
pub store_exposed_dependents: Vec<JsonPointer>,
}