use btreemap instead of indexmap

to establish canonical lock ordering
This commit is contained in:
Aiden McClelland
2021-09-27 17:19:58 -06:00
committed by Aiden McClelland
parent a28f6ca5e2
commit 1a86f393d6
22 changed files with 228 additions and 156 deletions

View File

@@ -1,9 +1,9 @@
use std::borrow::Cow;
use std::collections::BTreeMap;
use std::ffi::{OsStr, OsString};
use std::net::Ipv4Addr;
use std::path::PathBuf;
use indexmap::IndexMap;
use serde::{Deserialize, Serialize};
use serde_json::Value;
@@ -26,7 +26,7 @@ pub struct DockerAction {
#[serde(default)]
pub args: Vec<String>,
#[serde(default)]
pub mounts: IndexMap<VolumeId, PathBuf>,
pub mounts: BTreeMap<VolumeId, PathBuf>,
#[serde(default)]
pub io_format: Option<IoFormat>,
#[serde(default)]

View File

@@ -1,9 +1,10 @@
use std::collections::BTreeMap;
use std::path::Path;
use std::str::FromStr;
use anyhow::anyhow;
use clap::ArgMatches;
use indexmap::{IndexMap, IndexSet};
use indexmap::IndexSet;
use patch_db::HasModel;
use rpc_toolkit::command;
use serde::{Deserialize, Serialize};
@@ -13,9 +14,7 @@ use crate::config::{Config, ConfigSpec};
use crate::context::RpcContext;
use crate::id::{Id, InvalidId};
use crate::s9pk::manifest::PackageId;
use crate::util::{
display_serializable, parse_stdin_deserializable, IoFormat, ValuePrimative, Version,
};
use crate::util::{display_serializable, parse_stdin_deserializable, IoFormat, Version};
use crate::volume::Volumes;
use crate::{Error, ResultExt};
@@ -23,7 +22,7 @@ pub mod docker;
// TODO: create RPC endpoint that looks up the appropriate action and calls `execute`
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize)]
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize)]
pub struct ActionId<S: AsRef<str> = String>(Id<S>);
impl FromStr for ActionId {
type Err = InvalidId;
@@ -70,7 +69,7 @@ where
}
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct Actions(pub IndexMap<ActionId, Action>);
pub struct Actions(pub BTreeMap<ActionId, Action>);
#[derive(Debug, Serialize, Deserialize)]
#[serde(tag = "version")]