Ejemplo n.º 1
0
async def init(loop):
    """Intitialize application and return app object"""
    app = baseInit(loop, 'dn')

    #
    # call app.router.add_get() here to add node-specific routes
    #
    app.router.add_route('GET', '/domains', GET_Domain)
    app.router.add_route('PUT', '/domains', PUT_Domain)
    app.router.add_route('DELETE', '/domains', DELETE_Domain)
    app.router.add_route('PUT', '/acls/{username}', PUT_ACL)
    app.router.add_route('GET', '/groups/{id}', GET_Group)
    app.router.add_route('DELETE', '/groups/{id}', DELETE_Group)
    app.router.add_route('PUT', '/groups/{id}', PUT_Group)
    app.router.add_route('POST', '/groups', POST_Group)
    app.router.add_route('GET', '/groups/{id}/links', GET_Links)
    app.router.add_route('GET', '/groups/{id}/links/{title}', GET_Link)
    app.router.add_route('DELETE', '/groups/{id}/links/{title}', DELETE_Link)
    app.router.add_route('PUT', '/groups/{id}/links/{title}', PUT_Link)
    app.router.add_route('GET', '/groups/{id}/attributes', GET_Attributes)
    app.router.add_route('GET', '/groups/{id}/attributes/{name}',
                         GET_Attribute)
    app.router.add_route('DELETE', '/groups/{id}/attributes/{name}',
                         DELETE_Attribute)
    app.router.add_route('PUT', '/groups/{id}/attributes/{name}',
                         PUT_Attribute)
    app.router.add_route('GET', '/datatypes/{id}', GET_Datatype)
    app.router.add_route('DELETE', '/datatypes/{id}', DELETE_Datatype)
    app.router.add_route('POST', '/datatypes', POST_Datatype)
    app.router.add_route('GET', '/datatypes/{id}/attributes', GET_Attributes)
    app.router.add_route('GET', '/datatypes/{id}/attributes/{name}',
                         GET_Attribute)
    app.router.add_route('DELETE', '/datatypes/{id}/attributes/{name}',
                         DELETE_Attribute)
    app.router.add_route('PUT', '/datatypes/{id}/attributes/{name}',
                         PUT_Attribute)
    app.router.add_route('GET', '/datasets/{id}', GET_Dataset)
    app.router.add_route('DELETE', '/datasets/{id}', DELETE_Dataset)
    app.router.add_route('POST', '/datasets', POST_Dataset)
    app.router.add_route('PUT', '/datasets/{id}/shape', PUT_DatasetShape)
    app.router.add_route('GET', '/datasets/{id}/attributes', GET_Attributes)
    app.router.add_route('GET', '/datasets/{id}/attributes/{name}',
                         GET_Attribute)
    app.router.add_route('DELETE', '/datasets/{id}/attributes/{name}',
                         DELETE_Attribute)
    app.router.add_route('PUT', '/datasets/{id}/attributes/{name}',
                         PUT_Attribute)
    app.router.add_route('PUT', '/chunks/{id}', PUT_Chunk)
    app.router.add_route('GET', '/chunks/{id}', GET_Chunk)
    app.router.add_route('POST', '/chunks/{id}', POST_Chunk)
    app.router.add_route('DELETE', '/chunks/{id}', DELETE_Chunk)
    app.router.add_route("POST", '/roots/{id}', POST_Root)

    return app
Ejemplo n.º 2
0
async def init(loop):
    """Intitialize application and return app object"""
    
    app = baseInit(loop, 'an')
    app.router.add_route('GET', '/async_info', GET_AsyncInfo)
    app.router.add_route('PUT', '/objects', PUT_Objects)
    app.router.add_route('PUT', '/object/{id}', PUT_Object)
    app.router.add_route('DELETE', '/object/{id}', DELETE_Object)
    app.router.add_route('PUT', '/domain', PUT_Domain)
    app.router.add_route('DELETE', '/domain', DELETE_Domain)
    # set of rootids to scans
    app["pending"] = set() 
    # set of ids to be deleted
    app["delete_set"] = set()
    app["bucket_stats"] = {}
    app["last_bucket_scan"] = 0
    app["anonymous_ttl"] = int(config.get("anonymous_ttl"))
    log.info("anonymous_ttl: {}".format(app["anonymous_ttl"]))
    app["updated_domains"] = set()
     
    return app