From ee0e2201e02b6c7f4a628107988e1211806aa41c Mon Sep 17 00:00:00 2001 From: Joel Marcey Date: Thu, 1 Sep 2016 17:26:38 -0700 Subject: [PATCH] Transfer the current Getting Started contents to GitHub Pages Summary: This moves the current Getting Started that we have hosted over to our new GitHub pages infra. Next will be to move the blog over, along with some updates and maintenance of links, etc. in the new infra. Depends on: https://reviews.facebook.net/D62985 Test Plan: Visual Reviewers: IslamAbdelRahman, lgalanis Reviewed By: lgalanis Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D63051 --- docs/_data/nav_docs.yml | 4 -- docs/_docs/getting-started.md | 74 ++++++++++++++++++++++++++++++++++- docs/_docs/hello-world.md | 8 ---- docs/_docs/making-changes.md | 8 ---- 4 files changed, 72 insertions(+), 22 deletions(-) delete mode 100644 docs/_docs/hello-world.md delete mode 100644 docs/_docs/making-changes.md diff --git a/docs/_data/nav_docs.yml b/docs/_data/nav_docs.yml index 24fbab47a..8cdfd2d04 100644 --- a/docs/_data/nav_docs.yml +++ b/docs/_data/nav_docs.yml @@ -1,7 +1,3 @@ - title: Quick Start items: - id: getting-started - - id: hello-world -- title: Another Doc Group - items: - - id: making-changes diff --git a/docs/_docs/getting-started.md b/docs/_docs/getting-started.md index a790c7dd4..0d5360932 100644 --- a/docs/_docs/getting-started.md +++ b/docs/_docs/getting-started.md @@ -1,8 +1,78 @@ --- docid: getting-started -title: Getting started with ProjectName +title: Getting started layout: docs permalink: /docs/getting-started.html --- -This is some placeholder text, but you can use any kind of Markdown syntax here. \ No newline at end of file +## Overview + +The RocksDB library provides a persistent key value store. Keys and values are arbitrary byte arrays. The keys are ordered within the key value store according to a user-specified comparator function. + +The library is maintained by the Facebook Database Engineering Team, and is based on [LevelDB](https://github.com/google/leveldb), by Sanjay Ghemawat and Jeff Dean at Google. + +This overview gives some simple examples of how RocksDB is used. For the story of why RocksDB was created in the first place, see [Dhruba Borthakur’s introductory talk](https://github.com/facebook/rocksdb/blob/gh-pages/intro.pdf?raw=true) from the Data @ Scale 2013 conference. + +## Opening A Database + +A rocksdb database has a name which corresponds to a file system directory. All of the contents of database are stored in this directory. The following example shows how to open a database, creating it if necessary: + +```c++ +#include +#include "rocksdb/db.h" + +rocksdb::DB* db; +rocksdb::Options options; +options.create_if_missing = true; +rocksdb::Status status = + rocksdb::DB::Open(options, "/tmp/testdb", &db); +assert(status.ok()); +... +``` + +If you want to raise an error if the database already exists, add the following line before the rocksdb::DB::Open call: + +```c++ +options.error_if_exists = true; +``` + +## Status + +You may have noticed the `rocksdb::Status` type above. Values of this type are returned by most functions in RocksDB that may encounter +an error. You can check if such a result is ok, and also print an associated error message: + +```c++ +rocksdb::Status s = ...; +if (!s.ok()) cerr << s.ToString() << endl; +``` + +## Closing A Database + +When you are done with a database, just delete the database object. For example: + +```c++ +/* open the db as described above */ +/* do something with db */ +delete db; +``` + +## Reads And Writes + +The database provides Put, Delete, and Get methods to modify/query the database. For example, the following code moves the value stored under `key1` to `key2`. + +```c++ +std::string value; +rocksdb::Status s = db->Get(rocksdb::ReadOptions(), key1, &value); +if (s.ok()) s = db->Put(rocksdb::WriteOptions(), key2, value); +if (s.ok()) s = db->Delete(rocksdb::WriteOptions(), key1); +``` + +## Further documentation + +These are just simple examples of how RocksDB is used. The full documentation is currently on the [GitHub wiki](https://github.com/facebook/rocksdb/wiki). + +Here are some specific details about the RocksDB implementation: + +- [Architecture Guide](https://github.com/facebook/rocksdb/wiki/Rocksdb-Architecture-Guide) +- [Format of an immutable Table file](https://github.com/facebook/rocksdb/wiki/Rocksdb-Table-Format) +- [Format of a log file](https://github.com/facebook/rocksdb/wiki/Write-Ahead-Log-File-Format) diff --git a/docs/_docs/hello-world.md b/docs/_docs/hello-world.md deleted file mode 100644 index 34e0e3777..000000000 --- a/docs/_docs/hello-world.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -docid: hello-world -title: Hello, World! -layout: docs -permalink: /docs/hello-world.html ---- - -This is some placeholder text, but you can use any kind of Markdown syntax here. \ No newline at end of file diff --git a/docs/_docs/making-changes.md b/docs/_docs/making-changes.md deleted file mode 100644 index f4a6bd04e..000000000 --- a/docs/_docs/making-changes.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -docid: making-changes -title: Making Changes -layout: docs -permalink: /docs/making-changes.html ---- - -This is some placeholder text, but you can use any kind of Markdown syntax here. \ No newline at end of file