changeset 49:8a287fd23f95

Fix some severely outdated documentation.
author Lewin Bormann <lbo@spheniscida.de>
date Mon, 12 Mar 2018 19:30:45 +0100
parents bbb2e76ee581
children 2247f47ea794
files src/error.rs src/lib.rs src/options.rs src/table_reader.rs
diffstat 4 files changed, 15 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/error.rs	Sun Mar 11 16:58:51 2018 +0100
+++ b/src/error.rs	Mon Mar 12 19:30:45 2018 +0100
@@ -27,7 +27,7 @@
 }
 
 /// Status encapsulates a `StatusCode` and an error message. It can be displayed, and also
-/// implements `Error`.
+/// implements `Error`. io::Error can be converted into Status.
 #[derive(Clone, Debug, PartialEq)]
 pub struct Status {
     pub code: StatusCode,
@@ -70,14 +70,6 @@
     }
 }
 
-/// LevelDB's result type
-pub type Result<T> = result::Result<T, Status>;
-
-/// err returns a new Status wrapped in a Result.
-pub fn err<T>(code: StatusCode, msg: &str) -> Result<T> {
-    Err(Status::new(code, msg))
-}
-
 impl From<io::Error> for Status {
     fn from(e: io::Error) -> Status {
         let c = match e.kind() {
@@ -106,3 +98,12 @@
         }
     }
 }
+
+/// The sstable result type.
+pub type Result<T> = result::Result<T, Status>;
+
+/// err returns a new Status wrapped in a Result.
+pub fn err<T>(code: StatusCode, msg: &str) -> Result<T> {
+    Err(Status::new(code, msg))
+}
+
--- a/src/lib.rs	Sun Mar 11 16:58:51 2018 +0100
+++ b/src/lib.rs	Mon Mar 12 19:30:45 2018 +0100
@@ -22,7 +22,7 @@
 
 pub use cmp::{Cmp, DefaultCmp};
 pub use error::{Result, Status, StatusCode};
-pub use options::Options;
+pub use options::{CompressionType, Options};
 pub use types::{current_key_val, SSIterator};
 pub use table_builder::TableBuilder;
 pub use table_reader::{Table, TableIterator};
--- a/src/options.rs	Sun Mar 11 16:58:51 2018 +0100
+++ b/src/options.rs	Mon Mar 12 19:30:45 2018 +0100
@@ -29,10 +29,8 @@
     }
 }
 
-/// Options contains general parameters for a LevelDB instance. Most of the names are
+/// Options contains general parameters for reading and writing SSTables. Most of the names are
 /// self-explanatory; the defaults are defined in the `Default` implementation.
-///
-/// Note: Compression is not yet implemented.
 #[derive(Clone)]
 pub struct Options {
     pub cmp: Rc<Box<Cmp>>,
--- a/src/table_reader.rs	Sun Mar 11 16:58:51 2018 +0100
+++ b/src/table_reader.rs	Mon Mar 12 19:30:45 2018 +0100
@@ -22,6 +22,7 @@
     Ok(Footer::decode(&buf))
 }
 
+/// `Table` is used for accessing SSTables.
 #[derive(Clone)]
 pub struct Table {
     file: Rc<Box<RandomAccess>>,
@@ -148,7 +149,8 @@
         return self.footer.meta_index.offset();
     }
 
-    /// Iterators read from the file; thus only one iterator can be borrowed (mutably) per scope
+    /// Returns an iterator over an SSTable. Iterators hold internal references to the table, so
+    /// make sure to let them expire when not needed anymore.
     pub fn iter(&self) -> TableIterator {
         let iter = TableIterator {
             current_block: None,