Getting Started with LevelDB

Getting Started with LevelDB
eBook: $17.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $47.98    Print cover: $29.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • Understand how a sorted key-value store like LevelDB can support any app
  • Learn to use LevelDB from simple C++ code on iOS and OS/X
  • Use LevelDB as a support for any OS/X, iPhone, or iPad app through a series of practical examples

Book Details

Language : English
Paperback : 130 pages [ 235mm x 191mm ]
Release Date : November 2013
ISBN : 1783281014
ISBN 13 : 9781783281015
Author(s) : Andy Dent
Topics and Technologies : All Books, Open Source

Table of Contents

Chapter 1: Downloading LevelDB and Building with OS X
Chapter 2: Installing LevelDB and Building for iOS
Chapter 3: Basic Key-value Operations – Creating and Deleting Data
Chapter 4: Iteration and Searching Keys
Chapter 5: Using Objective-C
Chapter 6: Integrating with a Cocoa UI
Chapter 7: Debugging with REPLs and Command Lines
Chapter 8: Richer Keys and Data Structures
Chapter 9: A Document Database
Chapter 10: Tuning and Key Policies
Appendix: Scripting Languages
      • Chapter 3: Basic Key-value Operations – Creating and Deleting Data
        • Understanding C++ idioms in LevelDbHelper.h
        • Using Get and Put for strings
        • Understanding Slice – the efficient LevelDB parameter object
        • Using Get and Put with binary values
        • Using Delete – the final third of Key-value operations
        • Wrapping operations in WriteBatch for increased safety
        • Summary
        • Chapter 4: Iteration and Searching Keys
          • Introducing Sample04 to show you loops and searches
            • Creating test records with a loop
              • Stepping through all the records with iterators
            • Searching for ranges of keys
              • Linking records in a simple relational style
          • Summary
          • Chapter 5: Using Objective-C
            • Open source wrappers for LevelDB in Objective-C
            • Using Objective-C for simple data access
            • Extending APLevelDB to expose the C++ API
            • Importing text data to load a database
            • Summary
            • Chapter 6: Integrating with a Cocoa UI
              • Meeting the data source needs with LevelDB
              • Creating the OS X GUI
              • Connecting the database to the NSTableView
              • Connecting record details to the editing form
              • Recommended Xcode books
              • Summary
                • Chapter 8: Richer Keys and Data Structures
                  • Completing the data source for a rich GUI
                  • Extending the OS X GUI to fully support editing
                  • Connecting the database to the NSTableView
                  • Connecting record details to the editing form
                  • Saving data with key updates
                  • Responding to the new and delete commands
                    • Key design for LevelDB versus relational theory and SQL
                  • Deciding when to store one record or split values
                  • Implementing schemas for LevelDB
                  • Dealing with integer key endianness
                    • Using comparators to vary key ordering
                  • Summary
                  • Chapter 9: A Document Database
                    • Key design for searching the document database
                      • Defining the schema using APLevelDBSS
                    • Database fields for tracking documents
                    • Databases as documents via packages
                    • Summary
                    • Chapter 10: Tuning and Key Policies
                      • Understanding the Level in LevelDB
                        • Understanding that deleting is another form of write
                        • Understanding how reads work from the top down
                        • Understanding how snapshots make reading predictable
                      • Understanding how Bloom filters help guesses
                        • Tuning using Bloom filters or alternatives
                      • Using settings that affect performance
                      • Tuning and structuring data by scenario
                        • Choosing to structure data according to update rate
                        • Caching choices for key performance based on expected access
                        • Using multiple databases depending on role
                        • Reconsidering policies for generating keys
                      • Summary

                        Andy Dent

                        Andy Dent is a cross-platform developer from Perth, Western Australia, who started programming Macs with a 512 K Fat Mac in 1986. He has worked on mainframe, desktop, and mobile apps in Perth and remotely for US-based clients. The latter US work on retail products includes developing code generators for all the pre-OS X GUI C++ application-generation tools. Andy’s background in ISAM filesystems and love of writing frameworks coalesced in creation of the OOFILE products, designed to make C++ programming as easy as xBase. These included an object-oriented data layer, forms integration, and report-writing. He created the expatpp lightweight parser framework to simplify writing XML parsers and capped a love of writing XML tooling with several years working on complex geospatial data interchange at Australia’s CSIRO. His search for a more flexible data store led him to LevelDB. He is currently working on a range of iOS apps for his own label and contract clients.

                        Code Downloads

                        Download the code and support files for this book.

                        Submit Errata

                        Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

                        Sample chapters

                        You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                        Frequently bought together

                        Getting Started with LevelDB +    Kendo UI Cookbook =
                        50% Off
                        the second eBook
                        Price for both: $34.50

                        Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                        What you will learn from this book

                        • Install LevelDB and program in C++ or Objective-C to build OS/X, iPhone, and iPad apps
                        • Extend simple sorted key-value stores to support graph and relational data styles
                        • Understand iOS interface building for an app that uses databases
                        • Learn the GUI patterns needed for a database-backed app
                        • Explore debugging features by adding an embedded web server to your iOS app
                        • Install additional libraries and see how to use LevelDB from JavaScript via Node as well as Ruby and Python
                        • Compare SQL to LevelDB including SQL-like relational schemas and learn the implementation obligations to maintain database integrity

                        In Detail

                        Mobile and standalone desktop apps often need to store and rapidly retrieve data. LevelDB scales from a few simple values up to trillions of records and is flexible enough to store any kind of data.

                        Getting Started with LevelDB progresses through the sophisticated ways to use databases. It starts by explaining how to install and build LevelDB from the basics, and moves on to explain the different Objective-C layers for LevelDB. It can be used as an introduction to database-backed iOS apps, as well as provides clarification to key-value stores and helps you understand how they relate to SQL.

                        LevelDB is a flexible data solution that uses key-value stores to allow for the development of highly complex, efficient data storage systems. From the basics of data storage and retrieval to complex cases involving data storage for apps, this book covers a wide range of LevelDB topics

                        Even relatively simple apps may have the need to search their data using different terms. Getting Started with LevelDB shows how to design keys to retrieve and store data efficiently. You will learn how its “levelled” nature delivers speedy writes and how to tune its settings and design for performance. You will also see a few techniques for debugging and tuning.

                        Getting Started with LevelDB will leave you as an accomplished LevelDB programmer, confident you can build a complex database-backed app with high performance on iOS or OS/X.


                        The book is a concise guide for using LevelDB. It explains database concepts and the use of C++, ranging from the basics all the way to high level topics in an easy to follow, step-by-step format.

                        Who this book is for

                        The book is meant for developers who want an embedded database for their applications. Experienced programmers can pick up on the sophisticated data mapping patterns and tuning tips.

                        Getting Started with LevelDB requires a minimal background in programming in C++ or Objective-C for OS/X or iOS and familiarity with XCode. Therefore it teaches enough C++ to use LevelDB without presuming any C++ knowledge, so is suitable for beginner Objective-C programmers.

                        Code Download and Errata
                        Packt Anytime, Anywhere
                        Register Books
                        Print Upgrades
                        eBook Downloads
                        Video Support
                        Contact Us
                        Awards Voting Nominations Previous Winners
                        Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                        Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software