Refactored database open api and implemented

simple backend storage based on leveldb