Skip to content

Commit 16a6d82

Browse files
committed
Documented swimos_rocks_store.
1 parent 037b263 commit 16a6d82

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

runtime/swimos_rocks_store/src/lib.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
//! RocksDB Persistence
16+
//!
17+
//! An implementation of the [server persistence interface](swimos_api::persistence::ServerPersistence)
18+
//! using RocksDB as the persistence store.
19+
1520
mod agent;
1621
mod engine;
1722
mod plane;
1823
mod server;
1924

2025
pub use engine::RocksOpts;
21-
pub use server::{create_rocks_store, default_db_opts};
26+
pub use server::{default_db_opts, open_rocks_store};
2227

2328
/// An enumeration over the keyspaces that exist in a store.
2429
#[derive(Debug, Copy, Clone, PartialEq, Eq)]

runtime/swimos_rocks_store/src/server/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,13 @@ impl ServerPersistence for RocksServerPersistence {
277277
}
278278
}
279279

280-
pub fn create_rocks_store(
280+
/// Open a RocksDB persistence store from a path in the local filesystem. If the specified database does
281+
/// not exist it will be crated.
282+
///
283+
/// # Arguments
284+
/// * `path` - The filesystem path to the database. If none is specified, a new database will be created in a temporary directory.
285+
/// * `options` - Configuration options for the database.
286+
pub fn open_rocks_store(
281287
path: Option<PathBuf>,
282288
options: RocksOpts,
283289
) -> Result<impl ServerPersistence + Send + Sync + 'static, StoreError> {

runtime/swimos_rocks_store/src/server/rocks.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub fn default_keyspaces() -> Keyspaces<RocksOpts> {
3838
Keyspaces::new(vec![lane_def, value_def, map_def])
3939
}
4040

41+
/// Default RocksDB parameters.
4142
pub fn default_db_opts() -> RocksOpts {
4243
let mut rock_opts = Options::default();
4344
rock_opts.create_if_missing(true);

0 commit comments

Comments
 (0)