@@ -12,7 +12,7 @@ import (
1212
1313type testBackfillRequester struct {
1414 servers []ServerName
15- backfillFn func (server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error )
15+ backfillFn func (origin , server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error )
1616 authEventsToProvide [][]byte
1717 stateIDsAtEvent map [string ][]string
1818 callOrderForStateIDsBeforeEvent []string // event IDs called
@@ -28,8 +28,8 @@ func (t *testBackfillRequester) StateBeforeEvent(ctx context.Context, roomVer Ro
2828func (t * testBackfillRequester ) ServersAtEvent (ctx context.Context , roomID , eventID string ) []ServerName {
2929 return t .servers
3030}
31- func (t * testBackfillRequester ) Backfill (ctx context.Context , server ServerName , roomID string , limit int , fromEventIDs []string ) (Transaction , error ) {
32- txn , err := t .backfillFn (server , roomID , fromEventIDs , limit )
31+ func (t * testBackfillRequester ) Backfill (ctx context.Context , origin , server ServerName , roomID string , limit int , fromEventIDs []string ) (Transaction , error ) {
32+ txn , err := t .backfillFn (origin , server , roomID , fromEventIDs , limit )
3333 if err != nil {
3434 return Transaction {}, err
3535 }
@@ -92,14 +92,14 @@ func TestRequestBackfillMultipleServers(t *testing.T) {
9292 "$fnwGrQEpiOIUoDU2:baba.is.you" : {"$WCraVpPZe5TtHAqs:baba.is.you" },
9393 "$WCraVpPZe5TtHAqs:baba.is.you" : nil ,
9494 },
95- backfillFn : func (server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error ) {
95+ backfillFn : func (origin , server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error ) {
9696 if roomID != testRoomID {
9797 return nil , fmt .Errorf ("bad room id: %s" , roomID )
9898 }
9999 if server == serverA {
100100 // server A returns events 1 and 3.
101101 return & Transaction {
102- Origin : serverA ,
102+ Origin : origin ,
103103 OriginServerTS : AsTimestamp (time .Now ()),
104104 PDUs : []json.RawMessage {
105105 testBackfillEvents [1 ], testBackfillEvents [3 ],
@@ -108,7 +108,7 @@ func TestRequestBackfillMultipleServers(t *testing.T) {
108108 } else if server == serverB {
109109 // server B returns events 0 and 2 and 3.
110110 return & Transaction {
111- Origin : serverB ,
111+ Origin : origin ,
112112 OriginServerTS : AsTimestamp (time .Now ()),
113113 PDUs : []json.RawMessage {
114114 testBackfillEvents [0 ], testBackfillEvents [2 ], testBackfillEvents [3 ],
@@ -118,7 +118,7 @@ func TestRequestBackfillMultipleServers(t *testing.T) {
118118 return nil , fmt .Errorf ("bad server name: %s" , server )
119119 },
120120 }
121- result , err := RequestBackfill (ctx , tbr , keyRing , testRoomID , RoomVersionV1 , testFromEventIDs , testLimit )
121+ result , err := RequestBackfill (ctx , serverA , tbr , keyRing , testRoomID , RoomVersionV1 , testFromEventIDs , testLimit )
122122 if err != nil {
123123 t .Fatalf ("RequestBackfill got error: %s" , err )
124124 }
@@ -157,13 +157,13 @@ func TestRequestBackfillTopologicalSort(t *testing.T) {
157157 "$fnwGrQEpiOIUoDU2:baba.is.you" : {"$WCraVpPZe5TtHAqs:baba.is.you" },
158158 "$WCraVpPZe5TtHAqs:baba.is.you" : nil ,
159159 },
160- backfillFn : func (server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error ) {
160+ backfillFn : func (origin , server ServerName , roomID string , fromEventIDs []string , limit int ) (* Transaction , error ) {
161161 if roomID != testRoomID {
162162 return nil , fmt .Errorf ("bad room id: %s" , roomID )
163163 }
164164 if server == serverA {
165165 return & Transaction {
166- Origin : serverA ,
166+ Origin : origin ,
167167 OriginServerTS : AsTimestamp (time .Now ()),
168168 PDUs : []json.RawMessage {
169169 testBackfillEvents [0 ], testBackfillEvents [1 ], testBackfillEvents [2 ], testBackfillEvents [3 ],
@@ -173,7 +173,7 @@ func TestRequestBackfillTopologicalSort(t *testing.T) {
173173 return nil , fmt .Errorf ("bad server name: %s" , server )
174174 },
175175 }
176- result , err := RequestBackfill (ctx , tbr , keyRing , testRoomID , RoomVersionV1 , testFromEventIDs , testLimit )
176+ result , err := RequestBackfill (ctx , serverA , tbr , keyRing , testRoomID , RoomVersionV1 , testFromEventIDs , testLimit )
177177 if err != nil {
178178 t .Fatalf ("RequestBackfill got error: %s" , err )
179179 }
0 commit comments