src.backend.lib.storage.Storage(3)

NAME
src.backend.lib.storage.Storage

SYNOPSIS

  Public Member Functions
def __init__ (self, config)
def get_connection_string (self)
def create_tables (self)
def insert_book (self, book)
def book_paths_list (self)
def make_collections (self)
def get_books (self, collection=None, skip=None, limit=None)
def get_book (self, book_id)
def get_collections (self)

  Public Attributes
config
sql
user
password
db_host
db_port
engine

Detailed Description

Create a new Storage object.
>>> db = Storage(config)
Parameters
----------
config : Config()
    Main program configuration.
Attributes
----------
config : Stores configuration
sql : Database Name
user : Database User Name
password : Database Password
db_host : Database Host
db_port : Database Port
engine : sqlalchemy.create_engine(url, executor, kw)

Constructor & Destructor Documentation

  def src.backend.lib.storage.Storage.__init__ ( self, config)

Initialize storage object.

Member Function Documentation

  def src.backend.lib.storage.Storage.book_paths_list ( self)

Get file paths from database for comparison to system files.
Returns
-------
_result : ScalarResult Object

  def src.backend.lib.storage.Storage.create_tables ( self)

Create table structure.

  def src.backend.lib.storage.Storage.get_book ( self, book_id)

Get book from database.
Parameters
----------
book_id : int
    Book ID to filter by.
Returns
-------
_result : ScalarResult Object

  def src.backend.lib.storage.Storage.get_books ( self, collection = None, skip = None, limit = None)

Get books from database.
Parameters
----------
collection : str
    Collection to filter by.
Returns
-------
_result : ScalarResult Object

  def src.backend.lib.storage.Storage.get_collections ( self)

Get collections from database.
Returns
-------
_result : ScalarResult Object

  def src.backend.lib.storage.Storage.get_connection_string ( self)

Get connection string.
Engine type references config.json:DB_ENGINE.
Returns
-------
str : sqlalchemy Connection String

  def src.backend.lib.storage.Storage.insert_book ( self, book)

Insert a new book into the database.
Parameters
----------
book: dict()
    Book object to insert.
Returns
-------
bool
    True on success False on failure

  def src.backend.lib.storage.Storage.make_collections ( self)

Parse book path's to determine common folder structure.
Stores collections based on shared paths.

Member Data Documentation

  src.backend.lib.storage.Storage.config

  src.backend.lib.storage.Storage.db_host

  src.backend.lib.storage.Storage.db_port

  src.backend.lib.storage.Storage.engine

  src.backend.lib.storage.Storage.password

  src.backend.lib.storage.Storage.sql

  src.backend.lib.storage.Storage.user

Author

Generated automatically by Doxygen for pyShelf Open Source Ebook Server from the source code.