def set_server_meta(server_meta): return dict_set(get_threadlocal(), ["server_meta"], server_meta)
def set_request_meta(request_meta): return dict_set(get_threadlocal(), ["request_meta"], request_meta)
def get_server_meta(): server_meta = dict_get(get_threadlocal(), ["server_meta"], {}) set_server_meta(server_meta) return server_meta
def set_new_request_id(): request_id = generate_request_id() dict_set(get_threadlocal(), ["request_meta", "request_id"], request_id) return request_id
def get_request_meta(): request_meta = dict_get(get_threadlocal(), ["request_meta"], {}) # write back dictionary in case it was newly created set_request_meta(request_meta) return request_meta
def get_request_id(): return dict_get(get_threadlocal(), ["request_meta", "request_id"], None)