def db_flask_object_disable(db,newPath): # objPath 为restful时,则为/normal/test.txt # objPath 为db时,则为 account/normal/test.txt ?? search 时有db操作。但是不是路径。 oid = fullPath2id(db,newPath) return update_stobj(db,oid,state='disable')
def db_flask_object_disable(db, newPath): # objPath 为restful时,则为/normal/test.txt # objPath 为db时,则为 account/normal/test.txt ?? search 时有db操作。但是不是路径。 oid = fullPath2id(db, newPath) return update_stobj(db, oid, state='disable')
def db_cloudfs_dir_reset(newPath,conn): # path = unquote(path) # newPath = '/'.join(path.split('/')[3:]) did = fullPath2id(conn,newPath) return delete_child_stobj(conn,did)
def db_cloudfs_object_delete(newPath,conn): # path = unquote(path) # newPath = '/'.join(path.split('/')[3:]) oid = fullPath2id(conn,newPath) return delete_stobj(conn,oid)
def insert_account(conn, stobj_path): did = fullPath2id(conn, stobj_path) if -1 != did: return True, '' return insert_stobj(conn, 'account', stobj_path, '', 'enable')
def db_cloudfs_container_delete(newPath,conn): # path /zhu__feng00000com/0/AUTH_zhu__feng00000com/%E6%B5%8B%20%E8%AF%95 # path = unquote(path) # newPath = '/'.join(path.split('/')[3:]) cid = fullPath2id(conn,newPath) return delete_stobj(conn,cid)
def db_flask_container_list(db, atName, cntPath, tree): newPath = '/'.join([atName, cntPath]) cid = fullPath2id(db, newPath) if 'true' == tree: return id2treeAttrs(db, cid) else: return id2childAttrs(db, cid)
def db_flask_dir_list(db,atName,drPath,tree): newPath = '/'.join([atName,drPath]) did = fullPath2id(db,newPath) if 'true' == tree: return id2treeAttrs(db, did) else: return id2childAttrs(db, did)
def insert_file(conn, absPath, stobj_state='enable'): did = fullPath2id(conn, absPath) if -1 != did: return True, '' stobj_path, abs_parent = conn.splitPath(absPath) return insert_object(conn, 'file', stobj_path, abs_parent, stobj_state)
def insert_dir(conn,absPath): did = fullPath2id(conn, absPath) if -1 != did: return True,'' stobj_path,abs_parent = conn.splitPath(absPath) return insert_object(conn,'dir',stobj_path,abs_parent,'')
def db_flask_container_list(db,atName,cntPath,tree): newPath = '/'.join([atName,cntPath]) cid = fullPath2id(db, newPath) if 'true' == tree: return id2treeAttrs(db, cid) else: return id2childAttrs(db, cid)
def db_cloudfs_container_delete(newPath, conn): # path /zhu__feng00000com/0/AUTH_zhu__feng00000com/%E6%B5%8B%20%E8%AF%95 # path = unquote(path) # newPath = '/'.join(path.split('/')[3:]) cid = fullPath2id(conn, newPath) return delete_stobj(conn, cid)
def insert_link(conn,absPath,stobj_state = 'enable'): did = fullPath2id(conn, absPath) if -1 != did: return True,'' stobj_path,abs_parent = conn.splitPath(absPath) return insert_object(conn,'link',stobj_path,abs_parent,stobj_state)
def insert_dir(conn, absPath): did = fullPath2id(conn, absPath) if -1 != did: return True, '' stobj_path, abs_parent = conn.splitPath(absPath) return insert_object(conn, 'dir', stobj_path, abs_parent, '')
def insert_container(conn, stobj_path, abs_parent): did = fullPath2id(conn, '/'.join([abs_parent, stobj_path])) if -1 != did: return True, '' parent_id = account2id(conn, abs_parent) if -1 == parent_id: return False, 'fetch account id error' return insert_stobj(conn, 'container', stobj_path, parent_id, '')
def insert_container(conn,stobj_path,abs_parent): did = fullPath2id(conn, '/'.join([abs_parent,stobj_path])) if -1 != did: return True,'' parent_id = account2id(conn,abs_parent) if -1 == parent_id: return False,'fetch account id error' return insert_stobj(conn,'container',stobj_path,parent_id,'')
def record_put(db,msg,urName,objPath): uid = name2id(db, urName) oid = fullPath2id(db, objPath) msg = msg.replace('AUTH_','') return insert_record(db, msg,uid, oid)
def db_flask_object_enable(db, newPath): oid = fullPath2id(db, newPath) return update_stobj(db, oid, state='enable')
def db_flask_object_enable(db,newPath): oid = fullPath2id(db,newPath) return update_stobj(db,oid,state='enable')
def db_flask_record_object(db,objPath): oid = fullPath2id(db,objPath) return getRecords(db, oid=oid)
def record_put(db, msg, urName, objPath): uid = name2id(db, urName) oid = fullPath2id(db, objPath) msg = msg.replace('AUTH_', '') return insert_record(db, msg, uid, oid)