当前位置: 首页>>代码示例>>Python>>正文


Python utils.validate_device_partition函数代码示例

本文整理汇总了Python中swift.common.utils.validate_device_partition函数的典型用法代码示例。如果您正苦于以下问题:Python validate_device_partition函数的具体用法?Python validate_device_partition怎么用?Python validate_device_partition使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了validate_device_partition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: GET

 def GET(self, req):
     try:
         drive, part, account, container, direr = split_path(
             unquote(req.path), 4, 5, True)
         validate_device_partition(drive, part)
     except ValueError, err:
         return jresponse('-1', 'bad request', req,400)
开发者ID:sun3shines,项目名称:swift-1.7.4,代码行数:7,代码来源:server.py

示例2: initialize_request

    def initialize_request(self):
        """
        Basic validation of request and mount check.

        This function will be called before attempting to acquire a
        replication semaphore lock, so contains only quick checks.
        """
        # This environ override has been supported since eventlet 0.14:
        # https://bitbucket.org/eventlet/eventlet/commits/ \
        #     4bd654205a4217970a57a7c4802fed7ff2c8b770
        self.request.environ['eventlet.minimum_write_chunk_size'] = 0
        self.device, self.partition, self.policy = \
            request_helpers.get_name_and_placement(self.request, 2, 2, False)
        self.frag_index = self.node_index = None
        if self.request.headers.get('X-Backend-Ssync-Frag-Index'):
            self.frag_index = int(
                self.request.headers['X-Backend-Ssync-Frag-Index'])
        if self.request.headers.get('X-Backend-Ssync-Node-Index'):
            self.node_index = int(
                self.request.headers['X-Backend-Ssync-Node-Index'])
            if self.node_index != self.frag_index:
                # a primary node should only recieve it's own fragments
                raise swob.HTTPBadRequest(
                    'Frag-Index (%s) != Node-Index (%s)' % (
                        self.frag_index, self.node_index))
        utils.validate_device_partition(self.device, self.partition)
        self.diskfile_mgr = self.app._diskfile_router[self.policy]
        if not self.diskfile_mgr.get_dev_path(self.device):
            raise swob.HTTPInsufficientStorage(drive=self.device)
        self.fp = self.request.environ['wsgi.input']
开发者ID:allen-yin,项目名称:swift,代码行数:30,代码来源:ssync_receiver.py

示例3: DELETE

 def DELETE(self, request):
     """Handle HTTP DELETE requests for the Swift Object Server."""
     try:
         device, partition, account, container, obj = split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, e:
         return HTTPBadRequest(body=str(e), request=request, content_type="text/plain")
开发者ID:schatt,项目名称:swift,代码行数:7,代码来源:server.py

示例4: POST

 def POST(self, req):
     """Handle HTTP POST request."""
     try:
         drive, part, account, container = split_path(unquote(req.path), 4)
         validate_device_partition(drive, part)
     except ValueError, err:
         return HTTPBadRequest(body=str(err), content_type="text/plain", request=req)
开发者ID:DylanYu,项目名称:swift,代码行数:7,代码来源:server.py

示例5: DELETE_RECYCLE

 def DELETE_RECYCLE(self, req):
     try:
         device, partition, account, src_container, src_obj = split_path(
             unquote(req.path), 4, 5, True)
         validate_device_partition(device, partition)
     except ValueError, err:
         return jresponse('-1', 'bad request', req,400)
开发者ID:sun7shines,项目名称:Cloudfs,代码行数:7,代码来源:server.py

示例6: DELETE_RECYCLE

 def DELETE_RECYCLE(self, req):
     try:
         drive, part, account, src_container, src_direr = split_path(
             unquote(req.path), 4, 5, True)
         validate_device_partition(drive, part)
     except ValueError, err:
         return jresponse('-1', str(err), req,400)
开发者ID:sun3shines,项目名称:swift-1.7.4,代码行数:7,代码来源:server.py

示例7: GET

 def GET(self, req):
     """Handle HTTP GET request."""
     try:
         drive, part, account, container, obj = req.split_path(4, 5, True)
         validate_device_partition(drive, part)
     except ValueError, err:
         return HTTPBadRequest(body=str(err), content_type="text/plain", request=req)
开发者ID:navidshaikh,项目名称:swift,代码行数:7,代码来源:server.py

示例8: PUT

 def PUT(self, req):
     """Handle HTTP PUT request."""
     try:
         drive, part, account, container = req.split_path(3, 4)
         validate_device_partition(drive, part)
     except ValueError, err:
         return HTTPBadRequest(body=str(err), content_type='text/plain',
                               request=req)
开发者ID:Neil-Jubinville,项目名称:swift,代码行数:8,代码来源:server.py

示例9: DELETE

 def DELETE(self, req):
     """Handle HTTP DELETE request."""
     try:
         drive, part, account = split_path(unquote(req.path), 3)
         validate_device_partition(drive, part)
     except ValueError, err:
         return HTTPBadRequest(body=str(err), content_type='text/plain',
                               request=req)
开发者ID:DylanYu,项目名称:swift,代码行数:8,代码来源:server.py

示例10: DELETE

 def DELETE(self, req):
     """Handle HTTP DELETE request."""
     
     try:
         drive, part, account = split_path(unquote(req.path), 3)
         validate_device_partition(drive, part)
     except ValueError, err:
         return jresponse('-1', 'bad request',req,400) 
开发者ID:sun3shines,项目名称:swift-1.7.4,代码行数:8,代码来源:server.py

示例11: HEAD

 def HEAD(self, req):
     """Handle HTTP HEAD request."""
     try:
         drive, part, account, container = split_path(unquote(req.path),
                                                      3, 4)
         validate_device_partition(drive, part)
     except ValueError, err:
         return jresponse('-1', 'bad request', req,400)
开发者ID:sun3shines,项目名称:swift-1.7.4,代码行数:8,代码来源:server.py

示例12: PUT

 def PUT(self, request):
     
     try:
         device, partition, account, src_container, src_link = \
             split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, err:
         return jresponse('-1', 'bad request', request,400) 
开发者ID:sun3shines,项目名称:swift-1.7.4,代码行数:8,代码来源:server.py

示例13: GET

 def GET(self, request):
     """Handle HTTP GET requests for the Swift Object Server."""
     start_time = time.time()
     try:
         device, partition, account, container, obj = split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, err:
         self.logger.increment("GET.errors")
         return HTTPBadRequest(body=str(err), request=request, content_type="text/plain")
开发者ID:andrewgaul,项目名称:swift,代码行数:9,代码来源:server.py

示例14: POST

 def POST(self, req):
     """Handle HTTP POST request."""
     
     start_time = time.time()
     try:
         drive, part, account, container = split_path(unquote(req.path), 4)
         validate_device_partition(drive, part)
     except ValueError, err:
         return jresponse('-1', 'bad request', req,400) 
开发者ID:sun7shines,项目名称:Cloudfs,代码行数:9,代码来源:server.py

示例15: DELETE

 def DELETE(self, request):
     """Handle HTTP DELETE requests for the Swift Object Server."""
     start_time = time.time()
     try:
         device, partition, account, container, obj = \
             split_path(unquote(request.path), 5, 5, True)
         validate_device_partition(device, partition)
     except ValueError, e:
         return jresponse('-1', 'bad request', request,400)
开发者ID:sun7shines,项目名称:Cloudfs,代码行数:9,代码来源:server.py


注:本文中的swift.common.utils.validate_device_partition函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。