summaryrefslogtreecommitdiff
path: root/internal/db/relationship.go
diff options
context:
space:
mode:
authorLibravatar kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>2022-11-20 16:33:49 +0000
committerLibravatar GitHub <noreply@github.com>2022-11-20 16:33:49 +0000
commit5d55e8d920cd5969e5cff567ee88afb13f40a1b9 (patch)
tree7ad27cd4ae90a124a8d5ec04e7ff5ac9a1d27d26 /internal/db/relationship.go
parent[bugfix] fix possible infinite loop on federated AP profile delete (#1091) (diff)
downloadgotosocial-5d55e8d920cd5969e5cff567ee88afb13f40a1b9.tar.xz
[performance] add account block DB cache and remove block query joins (#1085)
* add account block DB cache and remove reliance on relational joins * actually include cache key arguments... * add a PutBlock() method which also updates the block cache, update tests accordingly * use `PutBlock` instead of `Put(ctx, block)` * add + use functions for deleting + invalidating blocks Signed-off-by: kim <grufwub@gmail.com> Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal/db/relationship.go')
-rw-r--r--internal/db/relationship.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/db/relationship.go b/internal/db/relationship.go
index 3dfc3dcc3..5ff08ad68 100644
--- a/internal/db/relationship.go
+++ b/internal/db/relationship.go
@@ -36,6 +36,21 @@ type Relationship interface {
// not if you're just checking for the existence of a block.
GetBlock(ctx context.Context, account1 string, account2 string) (*gtsmodel.Block, Error)
+ // PutBlock attempts to place the given account block in the database.
+ PutBlock(ctx context.Context, block *gtsmodel.Block) Error
+
+ // DeleteBlockByID removes block with given ID from the database.
+ DeleteBlockByID(ctx context.Context, id string) Error
+
+ // DeleteBlockByURI removes block with given AP URI from the database.
+ DeleteBlockByURI(ctx context.Context, uri string) Error
+
+ // DeleteBlocksByOriginAccountID removes any blocks with accountID equal to originAccountID.
+ DeleteBlocksByOriginAccountID(ctx context.Context, originAccountID string) Error
+
+ // DeleteBlocksByTargetAccountID removes any blocks with given targetAccountID.
+ DeleteBlocksByTargetAccountID(ctx context.Context, targetAccountID string) Error
+
// GetRelationship retrieves the relationship of the targetAccount to the requestingAccount.
GetRelationship(ctx context.Context, requestingAccount string, targetAccount string) (*gtsmodel.Relationship, Error)