diff options
author | 2021-09-12 10:10:24 +0100 | |
---|---|---|
committer | 2021-09-12 10:10:24 +0100 | |
commit | f6492d12d948507021bbe934de94e87e20464c01 (patch) | |
tree | 6705d6ef6f3c4d70f3b3ebc77c2960d8e508cf37 /internal/processing | |
parent | Merge pull request #213 from superseriousbusiness/alpine+node_upstep (diff) | |
parent | fix keys used to access storage items (diff) | |
download | gotosocial-f6492d12d948507021bbe934de94e87e20464c01.tar.xz |
Merge pull request #214 from NyaaaWhatsUpDoc/improvement/update-storage-library
add git.iim.gay/grufwub/go-store for storage backend, replacing blob.Storage
Diffstat (limited to 'internal/processing')
-rw-r--r-- | internal/processing/account/account_test.go | 4 | ||||
-rw-r--r-- | internal/processing/media/delete.go | 4 | ||||
-rw-r--r-- | internal/processing/media/getfile.go | 2 | ||||
-rw-r--r-- | internal/processing/media/media.go | 6 | ||||
-rw-r--r-- | internal/processing/processor.go | 7 | ||||
-rw-r--r-- | internal/processing/processor_test.go | 4 |
6 files changed, 13 insertions, 14 deletions
diff --git a/internal/processing/account/account_test.go b/internal/processing/account/account_test.go index 1884f6057..cfc7130ca 100644 --- a/internal/processing/account/account_test.go +++ b/internal/processing/account/account_test.go @@ -19,10 +19,10 @@ package account_test import ( + "git.iim.gay/grufwub/go-store/kv" "github.com/go-fed/activity/pub" "github.com/sirupsen/logrus" "github.com/stretchr/testify/suite" - "github.com/superseriousbusiness/gotosocial/internal/blob" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation" @@ -43,7 +43,7 @@ type AccountStandardTestSuite struct { db db.DB log *logrus.Logger tc typeutils.TypeConverter - storage blob.Storage + storage *kv.KVStore mediaHandler media.Handler oauthServer oauth.Server fromClientAPIChan chan messages.FromClientAPI diff --git a/internal/processing/media/delete.go b/internal/processing/media/delete.go index 281ddba03..e99b4e950 100644 --- a/internal/processing/media/delete.go +++ b/internal/processing/media/delete.go @@ -24,14 +24,14 @@ func (p *processor) Delete(ctx context.Context, mediaAttachmentID string) gtserr // delete the thumbnail from storage if attachment.Thumbnail.Path != "" { - if err := p.storage.RemoveFileAt(attachment.Thumbnail.Path); err != nil { + if err := p.storage.Delete(attachment.Thumbnail.Path); err != nil { errs = append(errs, fmt.Sprintf("remove thumbnail at path %s: %s", attachment.Thumbnail.Path, err)) } } // delete the file from storage if attachment.File.Path != "" { - if err := p.storage.RemoveFileAt(attachment.File.Path); err != nil { + if err := p.storage.Delete(attachment.File.Path); err != nil { errs = append(errs, fmt.Sprintf("remove file at path %s: %s", attachment.File.Path, err)) } } diff --git a/internal/processing/media/getfile.go b/internal/processing/media/getfile.go index c9c9b556d..3cfdbe56b 100644 --- a/internal/processing/media/getfile.go +++ b/internal/processing/media/getfile.go @@ -110,7 +110,7 @@ func (p *processor) GetFile(ctx context.Context, account *gtsmodel.Account, form } } - bytes, err := p.storage.RetrieveFileFrom(storagePath) + bytes, err := p.storage.Get(storagePath) if err != nil { return nil, gtserror.NewErrorNotFound(fmt.Errorf("error retrieving from storage: %s", err)) } diff --git a/internal/processing/media/media.go b/internal/processing/media/media.go index 6b88143e2..4c8416483 100644 --- a/internal/processing/media/media.go +++ b/internal/processing/media/media.go @@ -21,9 +21,9 @@ package media import ( "context" + "git.iim.gay/grufwub/go-store/kv" "github.com/sirupsen/logrus" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" - "github.com/superseriousbusiness/gotosocial/internal/blob" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtserror" @@ -47,13 +47,13 @@ type processor struct { tc typeutils.TypeConverter config *config.Config mediaHandler media.Handler - storage blob.Storage + storage *kv.KVStore db db.DB log *logrus.Logger } // New returns a new media processor. -func New(db db.DB, tc typeutils.TypeConverter, mediaHandler media.Handler, storage blob.Storage, config *config.Config, log *logrus.Logger) Processor { +func New(db db.DB, tc typeutils.TypeConverter, mediaHandler media.Handler, storage *kv.KVStore, config *config.Config, log *logrus.Logger) Processor { return &processor{ tc: tc, config: config, diff --git a/internal/processing/processor.go b/internal/processing/processor.go index 5dcdca152..bc6e6511b 100644 --- a/internal/processing/processor.go +++ b/internal/processing/processor.go @@ -23,9 +23,9 @@ import ( "net/http" "net/url" + "git.iim.gay/grufwub/go-store/kv" "github.com/sirupsen/logrus" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" - "github.com/superseriousbusiness/gotosocial/internal/blob" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation" @@ -234,7 +234,7 @@ type processor struct { tc typeutils.TypeConverter oauthServer oauth.Server mediaHandler media.Handler - storage blob.Storage + storage *kv.KVStore timelineManager timeline.Manager db db.DB filter visibility.Filter @@ -251,8 +251,7 @@ type processor struct { } // NewProcessor returns a new Processor that uses the given federator and logger -func NewProcessor(config *config.Config, tc typeutils.TypeConverter, federator federation.Federator, oauthServer oauth.Server, mediaHandler media.Handler, storage blob.Storage, timelineManager timeline.Manager, db db.DB, log *logrus.Logger) Processor { - +func NewProcessor(config *config.Config, tc typeutils.TypeConverter, federator federation.Federator, oauthServer oauth.Server, mediaHandler media.Handler, storage *kv.KVStore, timelineManager timeline.Manager, db db.DB, log *logrus.Logger) Processor { fromClientAPI := make(chan messages.FromClientAPI, 1000) fromFederator := make(chan messages.FromFederator, 1000) diff --git a/internal/processing/processor_test.go b/internal/processing/processor_test.go index 7335b686d..daaf46726 100644 --- a/internal/processing/processor_test.go +++ b/internal/processing/processor_test.go @@ -21,9 +21,9 @@ package processing_test import ( "context" + "git.iim.gay/grufwub/go-store/kv" "github.com/sirupsen/logrus" "github.com/stretchr/testify/suite" - "github.com/superseriousbusiness/gotosocial/internal/blob" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation" @@ -43,7 +43,7 @@ type ProcessingStandardTestSuite struct { config *config.Config db db.DB log *logrus.Logger - storage blob.Storage + storage *kv.KVStore typeconverter typeutils.TypeConverter transportController transport.Controller federator federation.Federator |