Beispiel #1
0
def handle_leaves(table_id, node_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    leaf_ids = common.handle_leaves(table_id, node_id)
    resp = {"leaf_ids": leaf_ids}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #2
0
def handle_subgraph(table_id, node_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    subgraph_result = common.handle_subgraph(table_id, node_id)
    resp = {"atomic_edges": subgraph_result}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #3
0
def handle_root(table_id, node_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    root_id = common.handle_root(table_id, node_id)
    resp = {"root_id": root_id}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #4
0
def handle_rollback(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    rollback_result = common.handle_rollback(table_id)
    resp = rollback_result
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #5
0
def handle_is_latest_roots(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    is_latest_roots = common.handle_is_latest_roots(table_id, is_binary=False)
    resp = {"is_latest": is_latest_roots}

    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #6
0
def last_edit(table_id, root_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    delimiter = request.args.get("delimiter", default=" ", type=str)
    latest_timestamp = common.last_edit(table_id, root_id)
    resp = {"iso": latest_timestamp.isoformat(delimiter)}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #7
0
def oldest_timestamp(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    delimiter = request.args.get("delimiter", default=" ", type=str)
    earliest_timestamp = common.oldest_timestamp(table_id)
    resp = {"iso": earliest_timestamp.isoformat(delimiter)}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #8
0
def find_path(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    precision_mode = request.args.get("precision_mode",
                                      default=True,
                                      type=toboolean)
    find_path_result = common.handle_find_path(table_id, precision_mode)
    return jsonify_with_kwargs(find_path_result, int64_as_str=int64_as_str)
Beispiel #9
0
def handle_split(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    split_result = common.handle_split(table_id)
    resp = {
        "operation_id": split_result.operation_id,
        "new_root_ids": split_result.new_root_ids
    }
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #10
0
def handle_pairwise_contact_sites(table_id, first_node_id, second_node_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    contact_sites, contact_site_metadata = common.handle_pairwise_contact_sites(
        table_id, first_node_id, second_node_id)
    resp = {
        "contact_sites": contact_sites,
        "contact_site_metadata": contact_site_metadata,
    }
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #11
0
def handle_l2_chunk_children(table_id, chunk_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    as_array = request.args.get("as_array", default=False, type=toboolean)
    l2_chunk_children = common.handle_l2_chunk_children(
        table_id, chunk_id, as_array)
    if as_array:
        resp = {"l2_chunk_children": l2_chunk_children}
    else:
        resp = {"l2_chunk_children": pickle.dumps(l2_chunk_children)}
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #12
0
def handle_roots(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    root_ids = common.handle_roots(table_id, is_binary=False)
    resp = {"root_ids": root_ids}

    arg_as_binary = request.args.get("as_binary", default="", type=str)
    if arg_as_binary in resp:
        return tobinary(resp[arg_as_binary])
    else:
        return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #13
0
def handle_roots_from_coords(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    resp = common.handle_roots_from_coord(table_id)
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #14
0
def handle_get_lvl2_graph(table_id, node_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    resp = common.handle_get_layer2_graph(table_id, node_id)
    return jsonify_with_kwargs(resp, int64_as_str=int64_as_str)
Beispiel #15
0
def merge_log(table_id, root_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    log = common.merge_log(table_id, root_id)
    return jsonify_with_kwargs(log, int64_as_str=int64_as_str)
Beispiel #16
0
def handle_split_preview(table_id):
    int64_as_str = request.args.get("int64_as_str",
                                    default=False,
                                    type=toboolean)
    split_preview = common.handle_split_preview(table_id)
    return jsonify_with_kwargs(split_preview, int64_as_str=int64_as_str)