@@ -7,15 +7,15 @@ import (
77 "bolte-bridge/internal/relay"
88)
99
10- // Adapter is the Matrix medium edge of the bridge. It owns the Client it talks
11- // to outright: the transport is an implementation detail of this package, so
12- // callers configure the adapter and never name the Client themselves.
13- //
14- // Its Fetch, Send, and Commit methods are not implemented yet.
10+ // Adapter is the Matrix medium edge of the bridge.
1511type Adapter struct {
1612 client Client
13+ cfg Config
1714}
1815
16+ // Compile-time assertion that Adapter satisfies core.Adapter.
17+ var _ core.Adapter = (* Adapter )(nil )
18+
1919// NewAdapter builds an Adapter and the Client it owns from ctx and cfg,
2020// reporting any configuration or initialization error from Client construction.
2121func NewAdapter (ctx context.Context , cfg Config ) (* Adapter , error ) {
@@ -34,27 +34,24 @@ func (a *Adapter) Medium() relay.Medium {
3434 return relay .MediumMatrix
3535}
3636
37- // Fetch will fetch Matrix events past the committed sync token and translate
37+ // Fetch will fetch Matrix events past the committed EventID and translate
3838// them into relay messages, advancing only the in-memory cursor.
39- func (a * Adapter ) Fetch (_ context.Context ) ([]relay.Message , error ) {
40- return nil , nil
39+ func (a * Adapter ) Fetch (ctx context.Context ) ([]relay.Message , error ) {
40+ return a . fetch ( ctx )
4141}
4242
4343// Send will translate a routed message into a Matrix event, send it to the
44- // configured room, and return the event ID assigned by the homeserver.
44+ // configured room, and return the EventID assigned by the homeserver.
4545func (a * Adapter ) Send (_ context.Context , _ relay.RoutedMessage ) (string , error ) {
4646 return "" , nil
4747}
4848
49- // Commit will durably advance the Matrix sync token to cursor. An empty cursor
49+ // Commit will durably advance the Matrix EventID cursor. An empty cursor
5050// commits everything returned by the preceding Fetch.
5151func (a * Adapter ) Commit (_ context.Context , _ string ) error {
5252 return nil
5353}
5454
55- // Compile-time assertion that Adapter satisfies core.Adapter.
56- var _ core.Adapter = (* Adapter )(nil )
57-
5855// Close closes the underlying Matrix client.
5956func (a * Adapter ) Close (ctx context.Context ) error {
6057 return a .client .Close (ctx )
0 commit comments