mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 05:42:46 +00:00
Add support for logs in StreamingToken (#1229)
* Add support for logs in StreamingToken Tokens now end up looking like `s11_22|dl-0-123|ab-0-12224` where `dl` and `ab` are log names, `0` is the partition and `123` and `12224` are the offsets. * Also test reserialisation * s/|/./g so tokens url escape nicely
This commit is contained in:
parent
9a5fb489c5
commit
0fdd4f14d1
12 changed files with 189 additions and 55 deletions
|
@ -32,11 +32,11 @@ var (
|
|||
randomMessageEvent gomatrixserverlib.HeaderedEvent
|
||||
aliceInviteBobEvent gomatrixserverlib.HeaderedEvent
|
||||
bobLeaveEvent gomatrixserverlib.HeaderedEvent
|
||||
syncPositionVeryOld = types.NewStreamToken(5, 0)
|
||||
syncPositionBefore = types.NewStreamToken(11, 0)
|
||||
syncPositionAfter = types.NewStreamToken(12, 0)
|
||||
syncPositionNewEDU = types.NewStreamToken(syncPositionAfter.PDUPosition(), 1)
|
||||
syncPositionAfter2 = types.NewStreamToken(13, 0)
|
||||
syncPositionVeryOld = types.NewStreamToken(5, 0, nil)
|
||||
syncPositionBefore = types.NewStreamToken(11, 0, nil)
|
||||
syncPositionAfter = types.NewStreamToken(12, 0, nil)
|
||||
syncPositionNewEDU = types.NewStreamToken(syncPositionAfter.PDUPosition(), 1, nil)
|
||||
syncPositionAfter2 = types.NewStreamToken(13, 0, nil)
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -65,7 +65,7 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
|
|||
since = &tok
|
||||
}
|
||||
if since == nil {
|
||||
tok := types.NewStreamToken(0, 0)
|
||||
tok := types.NewStreamToken(0, 0, nil)
|
||||
since = &tok
|
||||
}
|
||||
timelineLimit := DefaultTimelineLimit
|
||||
|
|
|
@ -138,7 +138,7 @@ func (rp *RequestPool) OnIncomingSyncRequest(req *http.Request, device *userapi.
|
|||
func (rp *RequestPool) currentSyncForUser(req syncRequest, latestPos types.StreamingToken) (res *types.Response, err error) {
|
||||
res = types.NewResponse()
|
||||
|
||||
since := types.NewStreamToken(0, 0)
|
||||
since := types.NewStreamToken(0, 0, nil)
|
||||
if req.since != nil {
|
||||
since = *req.since
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue