Skip to content

Commit bc2651f

Browse files
committed
Revert "chore: rename RoozVolume to VolumeBackedPath to better express the intent + refactor"
This reverts commit 21ba1cc.
1 parent a59a785 commit bc2651f

File tree

12 files changed

+128
-110
lines changed

12 files changed

+128
-110
lines changed

Cargo.lock

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::{
55
constants,
66
model::{
77
types::AnyError,
8-
volume::{VolumeBackedPath, RoozVolumeRole},
8+
volume::{RoozVolume, RoozVolumeRole},
99
},
1010
util::labels::Labels,
1111
};
@@ -22,7 +22,7 @@ impl<'a> ConfigApi<'a> {
2222
origin: &str,
2323
body: &str,
2424
) -> Result<(), AnyError> {
25-
let config_vol = VolumeBackedPath::config_data(
25+
let config_vol = RoozVolume::config_data(
2626
workspace_key,
2727
"/etc/rooz",
2828
Some(
@@ -57,7 +57,7 @@ impl<'a> ConfigApi<'a> {
5757
)
5858
.into(),
5959
Some(vec![
60-
VolumeBackedPath::workspace_config_read(workspace_key, "/etc/rooz").to_mount(None),
60+
RoozVolume::workspace_config_read(workspace_key, "/etc/rooz").to_mount(None),
6161
]),
6262
None,
6363
)
@@ -66,7 +66,7 @@ impl<'a> ConfigApi<'a> {
6666
}
6767

6868
pub async fn store_runtime(&self, workspace_key: &str, data: &str) -> Result<(), AnyError> {
69-
let config_vol = VolumeBackedPath::config_data(
69+
let config_vol = RoozVolume::config_data(
7070
workspace_key,
7171
"/etc/rooz",
7272
Some(

src/api/sidecar.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
constants,
99
model::{
1010
types::{AnyError, RunMode, RunSpec},
11-
volume::VolumeBackedPath,
11+
volume::RoozVolume,
1212
},
1313
util::labels::{self, Labels},
1414
};
@@ -54,16 +54,16 @@ impl<'a> WorkspaceApi<'a> {
5454
let mut ports = HashMap::<String, Option<String>>::new();
5555
RoozCfg::parse_ports(&mut ports, s.ports.clone());
5656

57-
let mut mounts = Vec::<VolumeBackedPath>::new();
57+
let mut mounts = Vec::<RoozVolume>::new();
5858

5959
let auto_mounts = s.mounts.as_ref().map(|mounts| {
6060
mounts
6161
.iter()
6262
.map(|mount| match mount {
6363
SidecarMount::Empty(mount) => {
64-
VolumeBackedPath::config_data(workspace_key, mount, None, None, None)
64+
RoozVolume::config_data(workspace_key, mount, None, None, None)
6565
}
66-
SidecarMount::Files { mount, files } => VolumeBackedPath::config_data(
66+
SidecarMount::Files { mount, files } => RoozVolume::config_data(
6767
workspace_key,
6868
mount,
6969
Some(files.clone()),
@@ -79,7 +79,7 @@ impl<'a> WorkspaceApi<'a> {
7979
}
8080

8181
let work_mount = if let Some(true) = s.mount_work {
82-
Some(vec![VolumeBackedPath::work(workspace_key, work_dir)])
82+
Some(vec![RoozVolume::work(workspace_key, work_dir)])
8383
} else {
8484
None
8585
};

src/api/system_config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::sync::OnceLock;
33
use crate::{
44
api::Api,
55
config::config::SystemConfig,
6-
model::{types::AnyError, volume::VolumeBackedPath},
6+
model::{types::AnyError, volume::RoozVolume},
77
};
88

99
impl<'a> Api<'a> {
@@ -15,7 +15,7 @@ impl<'a> Api<'a> {
1515
"ls /tmp/sys/rooz.config > /dev/null 2>&1 && cat /tmp/sys/rooz.config || echo ''"
1616
.into(),
1717
Some(vec![
18-
VolumeBackedPath::system_config_read("/tmp/sys").to_mount(None),
18+
RoozVolume::system_config_read("/tmp/sys").to_mount(None),
1919
]),
2020
None,
2121
)

src/api/volume.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::{
44
api::VolumeApi,
55
model::{
66
types::{AnyError, VolumeResult},
7-
volume::{VolumeBackedPath, RoozVolumeFile},
7+
volume::{RoozVolume, RoozVolumeFile},
88
},
99
util::labels::Labels,
1010
};
@@ -93,7 +93,7 @@ impl<'a> VolumeApi<'a> {
9393

9494
pub async fn ensure_mounts(
9595
&self,
96-
volumes: &Vec<VolumeBackedPath>,
96+
volumes: &Vec<RoozVolume>,
9797
tilde_replacement: Option<&str>,
9898
uid: Option<&str>,
9999
) -> Result<Vec<Mount>, AnyError> {
@@ -102,7 +102,7 @@ impl<'a> VolumeApi<'a> {
102102
let mount = self
103103
.ensure_mount(&v, tilde_replacement, v.labels.clone())
104104
.await?;
105-
if let VolumeBackedPath {
105+
if let RoozVolume {
106106
path,
107107
files: Some(files),
108108
..
@@ -119,7 +119,7 @@ impl<'a> VolumeApi<'a> {
119119

120120
async fn ensure_mount(
121121
&self,
122-
volume: &VolumeBackedPath,
122+
volume: &RoozVolume,
123123
tilde_replacement: Option<&str>,
124124
labels: Option<Labels>,
125125
) -> Result<Mount, AnyError> {

src/api/workspace/create.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ use crate::{
55
constants,
66
model::{
77
types::{AnyError, ContainerResult, RunMode, RunSpec, WorkSpec, WorkspaceResult},
8-
volume::VolumeBackedPath,
8+
volume::RoozVolume,
99
},
1010
util::ssh,
1111
};
1212

1313
impl<'a> WorkspaceApi<'a> {
1414
pub async fn create(&self, spec: &WorkSpec<'a>) -> Result<WorkspaceResult, AnyError> {
15-
let mut volumes = vec![VolumeBackedPath::work(spec.container_name, constants::WORK_DIR)];
15+
let mut volumes = vec![RoozVolume::work(spec.container_name, constants::WORK_DIR)];
1616

1717
let home_dir = format!("/home/{}", &spec.user);
1818
if let Some(home_from_image) = spec.home_from_image {
19-
let home_vol = VolumeBackedPath::home(spec.container_name.into(), &home_dir);
19+
let home_vol = RoozVolume::home(spec.container_name.into(), &home_dir);
2020
volumes.push(home_vol.clone());
2121
self.api
2222
.container
@@ -34,7 +34,7 @@ impl<'a> WorkspaceApi<'a> {
3434
log::debug!("Processing caches");
3535
let cache_vols = caches
3636
.iter()
37-
.map(|p| VolumeBackedPath::cache(p))
37+
.map(|p| RoozVolume::cache(p))
3838
.collect::<Vec<_>>();
3939

4040
for c in caches {

src/api/workspace/enter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use crate::{
1414
api::WorkspaceApi,
1515
config::{config::ConfigType, runtime::RuntimeConfig},
1616
constants::{self},
17-
model::{types::AnyError, volume::VolumeBackedPath},
17+
model::{types::AnyError, volume::RoozVolume},
1818
util::labels::Labels,
1919
};
2020

@@ -45,7 +45,7 @@ impl<'a> WorkspaceApi<'a> {
4545
working_dir: Option<&str>,
4646
shell: Option<Vec<&str>>,
4747
container_id: Option<&str>,
48-
volumes: Vec<VolumeBackedPath>,
48+
volumes: Vec<RoozVolume>,
4949
chown_uid: &str,
5050
root: bool,
5151
ephemeral: bool,

src/cmd/init.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
constants,
88
model::{
99
types::{AnyError, VolumeResult},
10-
volume::{VolumeBackedPath, RoozVolumeRole},
10+
volume::{RoozVolume, RoozVolumeRole},
1111
},
1212
util::{labels::Labels, ssh},
1313
};
@@ -47,7 +47,7 @@ impl<'a> InitApi<'a> {
4747
if spec.force {
4848
self.volume
4949
.ensure_mounts(
50-
&vec![VolumeBackedPath::system_config_init(
50+
&vec![RoozVolume::system_config_init(
5151
"/tmp/sys",
5252
SystemConfig {
5353
age_key: Some(age_key.to_string().expose_secret().to_string()),

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::{
2020
StopParams, TmpParams,
2121
},
2222
cmd::remote,
23-
model::{types::AnyError, volume::VolumeBackedPath},
23+
model::{types::AnyError, volume::RoozVolume},
2424
util::backend::ContainerBackend,
2525
};
2626

@@ -378,7 +378,7 @@ async fn main() -> Result<(), AnyError> {
378378
.await?;
379379
volume_api
380380
.ensure_mounts(
381-
&vec![VolumeBackedPath::system_config("/tmp/sys", config_string)],
381+
&vec![RoozVolume::system_config("/tmp/sys", config_string)],
382382
None,
383383
Some(constants::ROOT_UID),
384384
)

src/model/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::{
22
config::config::RoozCfg,
3-
model::volume::VolumeBackedPath,
3+
model::volume::RoozVolume,
44
util::{git::RootRepoCloneResult, labels::Labels},
55
};
66
use bollard::service::Mount;
@@ -141,7 +141,7 @@ pub struct OneShotResult {
141141
}
142142

143143
pub struct WorkspaceResult {
144-
pub volumes: Vec<VolumeBackedPath>,
144+
pub volumes: Vec<RoozVolume>,
145145
pub workspace_key: String,
146146
pub working_dir: String,
147147
pub orig_uid: String,

0 commit comments

Comments
 (0)