new BranchType

pull/19/head
Niko PLP 7 months ago
parent c078be8924
commit dee89ebe7a
  1. 8
      Cargo.lock
  2. 11
      ng-net/src/app_protocol.rs
  3. 22
      ng-repo/src/types.rs

8
Cargo.lock generated

@ -3257,7 +3257,7 @@ checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54"
[[package]]
name = "nextgraph"
version = "0.1.0-preview.5"
version = "0.1.0-preview.6"
dependencies = [
"async-once-cell",
"async-std",
@ -3311,7 +3311,7 @@ dependencies = [
[[package]]
name = "ng-broker"
version = "0.1.0-preview.3"
version = "0.1.0-preview.6"
dependencies = [
"async-std",
"async-trait",
@ -3515,7 +3515,7 @@ dependencies = [
[[package]]
name = "ng-verifier"
version = "0.1.0-preview.5"
version = "0.1.0-preview.6"
dependencies = [
"async-std",
"async-trait",
@ -3538,7 +3538,7 @@ dependencies = [
[[package]]
name = "ng-wallet"
version = "0.1.0-preview.5"
version = "0.1.0-preview.6"
dependencies = [
"aes-gcm-siv",
"argon2",

@ -59,6 +59,8 @@ pub enum NgAccessV0 {
pub enum TargetBranchV0 {
Chat,
Stream,
Comments,
BackLinks,
Context,
Ontology,
BranchId(BranchId),
@ -79,14 +81,13 @@ pub enum NuriTargetV0 {
Group(String), // shortname of a Group
Repo(RepoId),
Identity(UserId),
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct NuriV0 {
pub identity: Option<UserId>, // None for personal identity
pub target: NuriTargetV0,
pub entire_store: bool, // If it is a store, will (try to) include all the docs belonging to the store
pub entire_store: bool, // If it is a store, will include all the docs belonging to the store
pub object: Option<ObjectId>, // used only for FileGet. // cannot be used for queries. only to download an object (file,commit..)
pub branch: Option<TargetBranchV0>, // if None, the main branch is chosen
@ -101,6 +102,7 @@ impl NuriV0 {
pub fn new_repo_target_from_string(repo_id_string: String) -> Result<Self, NgError> {
let repo_id: RepoId = repo_id_string.as_str().try_into()?;
Ok(Self {
identity: None,
target: NuriTargetV0::Repo(repo_id),
entire_store: false,
object: None,
@ -114,6 +116,7 @@ impl NuriV0 {
pub fn new_private_store_target() -> Self {
Self {
identity: None,
target: NuriTargetV0::PrivateStore,
entire_store: false,
object: None,
@ -126,6 +129,7 @@ impl NuriV0 {
}
pub fn new_entire_user_site() -> Self {
Self {
identity: None,
target: NuriTargetV0::UserSite,
entire_store: false,
object: None,
@ -149,6 +153,7 @@ impl NuriV0 {
let id = decode_id(j)?;
let key = decode_sym_key(k)?;
Ok(Self {
identity: None,
target: NuriTargetV0::PrivateStore,
entire_store: false,
object: Some(id),

@ -1344,10 +1344,17 @@ pub enum Branch {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum BranchType {
Main, // Main is also transactional
Chat,
Store,
Overlay,
User,
// special transactional branches
Chat,
Stream,
Comments,
BackLinks,
Context,
Ontology,
Transactional, // this could have been called OtherTransactional, but for the sake of simplicity, we use Transactional for any branch that is not the Main one.
Root, // only used for BranchInfo
//Unknown, // only used temporarily when loading a branch info from commits (Branch commit, then AddBranch commit)
@ -1360,12 +1367,17 @@ impl fmt::Display for BranchType {
"{}",
match self {
Self::Main => "Main",
Self::Chat => "Chat",
Self::Store => "Store",
Self::Overlay => "Overlay",
Self::User => "User",
Self::Transactional => "Transactional",
Self::Root => "Root",
Self::Chat => "Chat",
Self::Stream => "Stream",
Self::Comments => "Comments",
Self::BackLinks => "BackLinks",
Self::Context => "Context",
Self::Ontology => "Ontology",
//Self::Unknown => "==unknown==",
}
)
@ -1580,7 +1592,7 @@ impl RemovePermission {
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub enum RepoNamedItemV0 {
Branch(BranchId),
Commit(ObjectId),
Commit(ObjectRef),
}
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
@ -1597,7 +1609,7 @@ pub struct AddNameV0 {
/// the name. in case of conflict, the smallest Id is taken.
pub name: String,
/// A branch, commit or file
/// A branch or commit
pub item: RepoNamedItem,
/// Metadata
@ -1634,7 +1646,7 @@ pub enum RemoveName {
/// Adds a repo into the store branch.
///
/// The repo's `store` field should match the store
/// The repo's `store` field should match the destination store
/// DEPS to the previous AddRepo commit(s) if it is an update. in this case, repo_id of the referenced rootbranch definition(s) should match
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct AddRepoV0 {

Loading…
Cancel
Save