File tree Expand file tree Collapse file tree
app/backend/src/couchers/servicers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232logger = logging .getLogger (__name__ )
3333
3434
35- def pack_thread_id (database_id : int , depth : int ) -> int :
36- """Pack (database_id, depth) into a single API thread id.
35+ # Since the API exposes a single ID space regardless of nesting level,
36+ # we construct the API id by appending the nesting level to the
37+ # database ID.
38+
3739
38- The API exposes a single ID space regardless of nesting level, so we append
39- the nesting level (depth) as the trailing digit of the database id: depth 0
40- = Thread, depth 1 = Comment, depth 2 = Reply.
41- """
40+ def pack_thread_id (database_id : int , depth : int ) -> int :
4241 return database_id * 10 + depth
4342
4443
4544def unpack_thread_id (thread_id : int ) -> tuple [int , int ]:
46- """Inverse of pack_thread_id; returns (database_id, depth)."""
45+ """Returns (database_id, depth) tuple ."""
4746 return divmod (thread_id , 10 )
4847
4948
You can’t perform that action at this time.
0 commit comments