Remove backwards compatibility with RelationPaginationToken. (#12138)

This commit is contained in:
Patrick Cloke 2022-03-04 07:10:10 -05:00 committed by GitHub
parent 36071d39f7
commit cd1ae3d0b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 144 deletions

View file

@ -54,37 +54,6 @@ class PaginationChunk:
return d
@attr.s(frozen=True, slots=True, auto_attribs=True)
class RelationPaginationToken:
"""Pagination token for relation pagination API.
As the results are in topological order, we can use the
`topological_ordering` and `stream_ordering` fields of the events at the
boundaries of the chunk as pagination tokens.
Attributes:
topological: The topological ordering of the boundary event
stream: The stream ordering of the boundary event.
"""
topological: int
stream: int
@staticmethod
def from_string(string: str) -> "RelationPaginationToken":
try:
t, s = string.split("-")
return RelationPaginationToken(int(t), int(s))
except ValueError:
raise SynapseError(400, "Invalid relation pagination token")
async def to_string(self, store: "DataStore") -> str:
return "%d-%d" % (self.topological, self.stream)
def as_tuple(self) -> Tuple[Any, ...]:
return attr.astuple(self)
@attr.s(frozen=True, slots=True, auto_attribs=True)
class AggregationPaginationToken:
"""Pagination token for relation aggregation pagination API.