summaryrefslogtreecommitdiff
path: root/internal/db/domain.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-09-02 11:17:46 +0100
committerLibravatar GitHub <noreply@github.com>2022-09-02 12:17:46 +0200
commitd68c04a6c0964d795a8d475c2f73d201bc72e68b (patch)
tree415746fa7279c4776ee822f1513f45c28a22e547 /internal/db/domain.go
parent[feature] Federate custom emoji (outbound) (#791) (diff)
downloadgotosocial-d68c04a6c0964d795a8d475c2f73d201bc72e68b.tar.xz
[performance] cache recently allowed/denied domains to cut down on db calls (#794)
* fetch creation and fetching domain blocks from db Signed-off-by: kim <grufwub@gmail.com> * add separate domainblock cache type, handle removing block from cache on delete Signed-off-by: kim <grufwub@gmail.com> * fix sentinel nil values being passed into cache Signed-off-by: kim <grufwub@gmail.com> Signed-off-by: kim <grufwub@gmail.com>
Diffstat (limited to 'internal/db/domain.go')
-rw-r--r--internal/db/domain.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/db/domain.go b/internal/db/domain.go
index b92705483..7b264165d 100644
--- a/internal/db/domain.go
+++ b/internal/db/domain.go
@@ -21,10 +21,21 @@ package db
import (
"context"
"net/url"
+
+ "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
)
// Domain contains DB functions related to domains and domain blocks.
type Domain interface {
+ // CreateDomainBlock ...
+ CreateDomainBlock(ctx context.Context, block gtsmodel.DomainBlock) Error
+
+ // GetDomainBlock ...
+ GetDomainBlock(ctx context.Context, domain string) (*gtsmodel.DomainBlock, Error)
+
+ // DeleteDomainBlock ...
+ DeleteDomainBlock(ctx context.Context, domain string) Error
+
// IsDomainBlocked checks if an instance-level domain block exists for the given domain string (eg., `example.org`).
IsDomainBlocked(ctx context.Context, domain string) (bool, Error)