chiark / gitweb /
bundles: Sort out private/public types etc.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 May 2021 20:50:22 +0000 (21:50 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 4 May 2021 21:01:58 +0000 (22:01 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bundles.rs

index 293e2c74888a32f1d5d9ce55709a08cc4c4512eb..17e4d3a2e2c036db389f0db1cddca19c545c4865 100644 (file)
@@ -35,16 +35,6 @@ pub struct InstanceBundles {
   bundles: Vec<Option<Note>>,
 }
 
-//---------- private definitions ----------
-
-const BUNDLES_MAX: Index = Index(64);
-
-#[derive(Debug,Clone,Serialize,Deserialize)]
-pub struct Note {
-  pub kind: Kind,
-  pub state: State,
-}
-
 #[derive(Debug,Clone,Serialize,Deserialize)]
 pub enum State {
   Uploading,
@@ -54,16 +44,20 @@ pub enum State {
 
 #[derive(Debug,Clone,Serialize,Deserialize)]
 pub struct Loaded {
-  meta: BundleMeta,
+  pub meta: BundleMeta,
 }
 
+/// returned by start_upload
 pub struct Uploading {
   instance: Arc<InstanceName>,
   id: Id,
   file: DigestWrite<BufWriter<fs::File>>,
 }
 
-type BadBundle = String; // todo: make this a newtype
+#[derive(Debug,Copy,Clone,Error)]
+#[error("{0}")]
+#[repr(transparent)]
+pub struct NotBundle(&'static str);
 
 #[derive(Error,Debug)]
 pub enum LoadError {
@@ -71,12 +65,18 @@ pub enum LoadError {
   IE(#[from] IE),
 }
 display_as_debug!{LoadError}
-use LoadError as LE;
 
-#[derive(Debug,Copy,Clone,Error)]
-#[error("{0}")]
-#[repr(transparent)]
-pub struct NotBundle(&'static str);
+//---------- private definitions ----------
+
+const BUNDLES_MAX: Index = Index(64);
+
+#[derive(Debug,Clone,Serialize,Deserialize)]
+struct Note {
+  pub kind: Kind,
+  pub state: State,
+}
+
+pub type BadBundle = String;
 
 #[derive(Error,Debug)]
 enum IncorporateError {
@@ -84,6 +84,8 @@ enum IncorporateError {
   #[error("{0}")] IE(#[from] IE),
 }
 
+use LoadError as LE;
+
 //---------- straightformward impls ----------
 
 impl From<Index> for usize {