mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
Feature/new registry (#2612)
* wip * overhaul boot process * wip: new registry * wip * wip * wip * wip * wip * wip * os registry complete * ui fixes * fixes * fixes * more fixes * fix merkle archive
This commit is contained in:
@@ -5,6 +5,7 @@ use futures::future::BoxFuture;
|
||||
use futures::{Future, FutureExt};
|
||||
use imbl_value::InternedString;
|
||||
|
||||
use crate::db::model::Database;
|
||||
use crate::prelude::*;
|
||||
use crate::Error;
|
||||
|
||||
@@ -56,9 +57,12 @@ where
|
||||
fn new() -> Self;
|
||||
fn semver(&self) -> emver::Version;
|
||||
fn compat(&self) -> &'static emver::VersionRange;
|
||||
fn up(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
fn down(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
fn commit(&self, db: &PatchDb) -> impl Future<Output = Result<(), Error>> + Send {
|
||||
fn up(&self, db: &TypedPatchDb<Database>) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
fn down(&self, db: &TypedPatchDb<Database>) -> impl Future<Output = Result<(), Error>> + Send;
|
||||
fn commit(
|
||||
&self,
|
||||
db: &TypedPatchDb<Database>,
|
||||
) -> impl Future<Output = Result<(), Error>> + Send {
|
||||
async {
|
||||
let semver = self.semver().into();
|
||||
let compat = self.compat().clone();
|
||||
@@ -80,7 +84,7 @@ where
|
||||
fn migrate_to<V: VersionT>(
|
||||
&self,
|
||||
version: &V,
|
||||
db: &PatchDb,
|
||||
db: &TypedPatchDb<Database>,
|
||||
) -> impl Future<Output = Result<(), Error>> + Send {
|
||||
async {
|
||||
match self.semver().cmp(&version.semver()) {
|
||||
@@ -93,7 +97,7 @@ where
|
||||
fn migrate_from_unchecked<'a, V: VersionT>(
|
||||
&'a self,
|
||||
version: &'a V,
|
||||
db: &'a PatchDb,
|
||||
db: &'a TypedPatchDb<Database>,
|
||||
) -> BoxFuture<'a, Result<(), Error>> {
|
||||
async {
|
||||
let previous = Self::Previous::new();
|
||||
@@ -118,7 +122,7 @@ where
|
||||
fn rollback_to_unchecked<'a, V: VersionT>(
|
||||
&'a self,
|
||||
version: &'a V,
|
||||
db: &'a PatchDb,
|
||||
db: &'a TypedPatchDb<Database>,
|
||||
) -> BoxFuture<'a, Result<(), Error>> {
|
||||
async {
|
||||
let previous = Self::Previous::new();
|
||||
@@ -192,7 +196,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn init(db: &PatchDb) -> Result<(), Error> {
|
||||
pub async fn init(db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
let version = Version::from_util_version(
|
||||
db.peek()
|
||||
.await
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
use emver::VersionRange;
|
||||
|
||||
use super::VersionT;
|
||||
use crate::db::model::Database;
|
||||
use crate::prelude::*;
|
||||
use crate::version::Current;
|
||||
|
||||
@@ -30,10 +31,10 @@ impl VersionT for Version {
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use emver::VersionRange;
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_3_5, VersionT};
|
||||
use crate::db::model::Database;
|
||||
use crate::prelude::*;
|
||||
|
||||
const V0_3_5_1: emver::Version = emver::Version::new(0, 3, 5, 1);
|
||||
@@ -20,10 +21,10 @@ impl VersionT for Version {
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use emver::VersionRange;
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_3_5_1, VersionT};
|
||||
use crate::db::model::Database;
|
||||
use crate::prelude::*;
|
||||
|
||||
const V0_3_5_2: emver::Version = emver::Version::new(0, 3, 5, 2);
|
||||
@@ -20,10 +21,10 @@ impl VersionT for Version {
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use emver::VersionRange;
|
||||
|
||||
use super::v0_3_5::V0_3_0_COMPAT;
|
||||
use super::{v0_3_5_1, VersionT};
|
||||
use crate::db::model::Database;
|
||||
use crate::prelude::*;
|
||||
|
||||
const V0_3_6: emver::Version = emver::Version::new(0, 3, 6, 0);
|
||||
@@ -20,10 +21,10 @@ impl VersionT for Version {
|
||||
fn compat(&self) -> &'static VersionRange {
|
||||
&V0_3_0_COMPAT
|
||||
}
|
||||
async fn up(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn up(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Err(Error::new(eyre!("unimplemented"), ErrorKind::Unknown))
|
||||
}
|
||||
async fn down(&self, _db: &PatchDb) -> Result<(), Error> {
|
||||
async fn down(&self, _db: &TypedPatchDb<Database>) -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user