Esempio n. 1
0
def loadCollection(path):
    Log.d(TAG, f"Getting a collection from {path}")
    try:
        return _pickle.load(open(path, 'rb'))
    except Exception as ex:
        Log.w(TAG, "Someone explicitly deleted the collection file from disk")
        Log.e(TAG, f"Collection is not exist on {path}. {ex}")
        return None
Esempio n. 2
0
def initMe():
    Log.c(TAG, "Starting Hyperlite Database")
    Log.w(TAG, f"We are running on {config.PLATFORM} Operating System")
    Log.i(TAG, f"Database files can be found on {config.DATABASE_PATH} ")
    if os.path.exists(config.COLLECTION_PATH):
        meta_col = initializer.getCollection(config.COLLECTION_PATH)
        Collections.meta_collection = meta_col
        Log.i(TAG, "Meta collection found on disk")
    else:
        meta_col = Collection("hyperlite.col", "MetaData")
        Collections.meta_collection = meta_col
        Log.w(
            TAG,
            "Meta collection file not found so creating new meta collection")
Esempio n. 3
0
def doctor():
    if not os.path.exists(config.DATABASE_PATH):
        Log.w(TAG, "Database directory does not exist")
        os.makedirs(config.DATABASE_PATH)
        Log.i(TAG, "Database directory Created")