コード例 #1
0
 def POST(self, env):
     """Handle posts dealing with metadata alteration"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     version, acc, con, obj = split_path(req.path, 1, 4, True)
     if not con:
         try:
             info = get_account_info(env, self.app)
             if info:
                 stor_policy = info['storage_policy']
                 headers['storage_policy'] = stor_policy
         except:
             pass
     else:
         try:
             info = get_container_info(env, self.app)
             if info:
                 stor_policy = info['storage_policy']
                 headers['storage_policy'] = stor_policy
         except:
             pass
     conn.request('POST', req.path, headers=headers)
     resp = conn.getresponse()
     #confirm response then pass along the request
     return self.app
コード例 #2
0
ファイル: metadata.py プロジェクト: 2015-ucsc-hp/swift
 def GET(self, req):
     """Handle the query request."""
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     conn.request('GET', req.path, headers=headers)
     resp = conn.getresponse()
     return Response(request=req, body=resp.read(), content_type=resp.getheader('Content-Type'))
コード例 #3
0
ファイル: metadata.py プロジェクト: 2015-ucsc-hp/swift
 def POST(self, env):
     """Handle posts dealing with metadata alteration"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     version, acc, con, obj = split_path(req.path, 1, 4, True)
     if not con:
         try:
             info = get_account_info(env, self.app)
             if info:
                 stor_policy = info['storage_policy']
                 headers['storage_policy'] = stor_policy
         except:
             pass
     else:
         try:
             info = get_container_info(env, self.app)
             if info:
                 stor_policy = info['storage_policy']
                 headers['storage_policy'] = stor_policy
         except:
             pass
     conn.request('POST', req.path, headers=headers)
     resp = conn.getresponse()
     #confirm response then pass along the request
     return self.app
コード例 #4
0
 def COPY(self, env):
     """Eliminate metadata for deleted objects"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     conn.request('COPY', req.path, headers=headers)
     resp = conn.getresponse()
     #confirm response then pass along the request
     return self.app
コード例 #5
0
 def GET(self, req):
     """Handle the query request."""
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     conn.request('GET', req.path, headers=headers)
     resp = conn.getresponse()
     return Response(request=req,
                     body=resp.read(),
                     content_type=resp.getheader('Content-Type'))
コード例 #6
0
ファイル: metadata.py プロジェクト: 2015-ucsc-hp/swift
 def COPY(self, env):
     """Eliminate metadata for deleted objects"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     conn.request('COPY', req.path, headers=headers)
     resp = conn.getresponse()
     #confirm response then pass along the request
     return self.app
コード例 #7
0
ファイル: utils.py プロジェクト: 2015-ucsc-hp/swift
 def sendData(self, metaList, data_type, server_ip, server_port):
     ip = server_ip
     port = server_port
     updatedData = json.dumps(metaList)
     headers = {'user-agent': data_type}
     with ConnectionTimeout(self.conn_timeout):
         try:
             conn = HTTPConnection('%s:%s' % (ip, port))
             conn.request('PUT', '/', headers=headers, body=updatedData)
             resp = conn.getresponse()
             return resp
         except (Exception, Timeout):
             return HTTP_INTERNAL_SERVER_ERROR
コード例 #8
0
ファイル: utils.py プロジェクト: xyuanlu/swift
 def sendData(self, metaList, data_type, server_ip, server_port):
     ip = server_ip
     port = server_port
     updatedData = json.dumps(metaList)
     headers = {'user-agent': data_type}
     with ConnectionTimeout(self.conn_timeout):
         try:
             conn = HTTPConnection('%s:%s' % (ip, port))
             conn.request('PUT', '/', headers=headers, body=updatedData)
             resp = conn.getresponse()
             return resp
         except (Exception, Timeout):
             return HTTP_INTERNAL_SERVER_ERROR
コード例 #9
0
 def PUT(self, env):
     """Handle PUT requests related to metadata"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     try:
         info = get_container_info(env, self.app)
         if info:
             stor_policy = info['storage_policy']
             headers['storage_policy'] = stor_policy
     except:
         pass
     conn.request('PUT', req.path, headers=headers)
     resp = conn.getresponse()
     return self.app
コード例 #10
0
ファイル: metadata.py プロジェクト: 2015-ucsc-hp/swift
 def PUT(self, env):
     """Handle PUT requests related to metadata"""
     req = Request(env)
     conn = HTTPConnection('%s:%s' % (self.mds_ip, self.mds_port))
     headers = req.params
     try:
         info = get_container_info(env, self.app)
         if info:
             stor_policy = info['storage_policy']
             headers['storage_policy'] = stor_policy
     except:
         pass
     conn.request('PUT', req.path, headers=headers)
     resp = conn.getresponse()
     return self.app