示例#1
0
文件: objTools.py 项目: weijia/ufs
def isUfsUrl(url):
    '''
    In format of xxxx://xxxx
    '''
    if url.find(config.getFsProtocolSeparator()) == -1:
        return False
    else:
        return True
示例#2
0
def get_fs_protocol_separator():
    try:
        import configurationTools as config
        return config.getFsProtocolSeparator()
    except ImportError:
        return "://"
示例#3
0
文件: objTools.py 项目: weijia/ufs
def getUrlForUuid(id):
    return u"uuid"+config.getFsProtocolSeparator()+id
示例#4
0
文件: objTools.py 项目: weijia/ufs
def isUuid(url):
    return (url.find(u"uuid"+config.getFsProtocolSeparator()) == 0)
示例#5
0
文件: objTools.py 项目: weijia/ufs
def parseUrl(url):
    return url.split(config.getFsProtocolSeparator(),2)
示例#6
0
文件: objTools.py 项目: weijia/ufs
import socket

import configurationTools as config
import transform
import localLibSys
from localLibs.logSys.logSys import *


gUfsObjUrlPrefix = u'ufsFs'+config.getFsProtocolSeparator()
gUfsObjUrlSeparator = u'/'


def parseUrl(url):
    return url.split(config.getFsProtocolSeparator(),2)
    


def getHostName():
    return unicode(socket.gethostname())

def getUfsUrlForPath(fullPath):
    fullPath = transform.transformDirToInternal(fullPath)
    return gUfsObjUrlPrefix + getHostName() + gUfsObjUrlSeparator + fullPath
       
def getFullPathFromUfsUrl(ufsUrl):
    if not isUfsFs(ufsUrl):
        cl(ufsUrl)
        raise "not ufs url"
    objPath = parseUrl(ufsUrl)[1]
    hostname, fullPath = objPath.split(gUfsObjUrlSeparator, 1)
    #print hostname, fullPath