Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

added support for cached roster repository #208

Merged
merged 5 commits into from
Feb 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* [ENHANCEMENT] Cached Capabilities repository. #205
* [ENHANCEMENT] Cached Private repository. #206
* [ENHANCEMENT] Cached BlockList repository. #207
* [ENHANCEMENT] Cached Roster repository. #208
* [CHANGE] Introduced measured repository transaction type. #200
* [CHANGE] Use PgSQL locker. #201
* [BUGFIX] Fix S2S db key check when nop KV is used. #199
244 changes: 220 additions & 24 deletions pkg/model/roster/roster.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions pkg/router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ package router
import (
"context"

c2smodel "github.com/ortuman/jackal/pkg/model/c2s"

"github.com/jackal-xmpp/stravaganza/v2"
streamerror "github.com/jackal-xmpp/stravaganza/v2/errors/stream"
"github.com/jackal-xmpp/stravaganza/v2/jid"
"github.com/ortuman/jackal/pkg/host"
c2smodel "github.com/ortuman/jackal/pkg/model/c2s"
"github.com/ortuman/jackal/pkg/router/stream"
)

Expand All @@ -33,10 +32,10 @@ type Router interface {
// (https://xmpp.org/rfcs/rfc3921.html#rules)
Route(ctx context.Context, stanza stravaganza.Stanza) (targets []jid.JID, err error)

// C2SRouter returns the underlying C2S router.
// C2S returns the underlying C2S router.
C2S() C2SRouter

// S2SRouter returns the underlying S2S router.
// S2S returns the underlying S2S router.
S2S() S2SRouter

// Start starts global router subsystem.
Expand Down
12 changes: 6 additions & 6 deletions pkg/storage/cached/blocklist.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type cachedBlockListRep struct {

func (c *cachedBlockListRep) UpsertBlockListItem(ctx context.Context, item *blocklistmodel.Item) error {
op := updateOp{
c: c.c,
namespace: blockListNS(item.Username),
invalidKeys: []string{blockListItems},
c: c.c,
namespace: blockListNS(item.Username),
invalidateKeys: []string{blockListItems},
updateFn: func(ctx context.Context) error {
return c.rep.UpsertBlockListItem(ctx, item)
},
Expand All @@ -67,9 +67,9 @@ func (c *cachedBlockListRep) UpsertBlockListItem(ctx context.Context, item *bloc

func (c *cachedBlockListRep) DeleteBlockListItem(ctx context.Context, item *blocklistmodel.Item) error {
op := updateOp{
c: c.c,
namespace: blockListNS(item.Username),
invalidKeys: []string{blockListItems},
c: c.c,
namespace: blockListNS(item.Username),
invalidateKeys: []string{blockListItems},
updateFn: func(ctx context.Context) error {
return c.rep.DeleteBlockListItem(ctx, item)
},
Expand Down
Loading