diff options
author | 2022-11-05 12:10:19 +0100 | |
---|---|---|
committer | 2022-11-05 11:10:19 +0000 | |
commit | bcb80d3ff4a669d52d63950c8830427646c05884 (patch) | |
tree | 4aa95a83545b3f87a80fe4b625cb6f2ad9c4427f /internal | |
parent | [bugfix] Increase field size limits when registering apps (#958) (diff) | |
download | gotosocial-bcb80d3ff4a669d52d63950c8830427646c05884.tar.xz |
[chore] bump gruf/go-store to v2 (#953)
* [chore] bump gruf/go-store to v2
* no more boobs
Diffstat (limited to 'internal')
-rw-r--r-- | internal/api/client/media/mediacreate_test.go | 8 | ||||
-rw-r--r-- | internal/db/bundb/migrations/20220612091800_duplicated_media_cleanup.go | 10 | ||||
-rw-r--r-- | internal/media/manager_test.go | 10 | ||||
-rw-r--r-- | internal/media/processingemoji.go | 2 | ||||
-rw-r--r-- | internal/media/prunemeta.go | 2 | ||||
-rw-r--r-- | internal/media/prunemeta_test.go | 2 | ||||
-rw-r--r-- | internal/media/pruneremote.go | 2 | ||||
-rw-r--r-- | internal/media/pruneremote_test.go | 2 | ||||
-rw-r--r-- | internal/media/pruneunusedlocal.go | 2 | ||||
-rw-r--r-- | internal/storage/local.go | 14 | ||||
-rw-r--r-- | internal/storage/storage.go | 6 |
11 files changed, 30 insertions, 30 deletions
diff --git a/internal/api/client/media/mediacreate_test.go b/internal/api/client/media/mediacreate_test.go index be3bf300e..e1e84c1c1 100644 --- a/internal/api/client/media/mediacreate_test.go +++ b/internal/api/client/media/mediacreate_test.go @@ -138,7 +138,7 @@ func (suite *MediaCreateTestSuite) TestMediaCreateSuccessful() { // see what's in storage *before* the request storageKeysBeforeRequest := []string{} - iter, err := suite.storage.KVStore.Iterator(nil) + iter, err := suite.storage.KVStore.Iterator(context.Background(), nil) if err != nil { panic(err) } @@ -170,7 +170,7 @@ func (suite *MediaCreateTestSuite) TestMediaCreateSuccessful() { // check what's in storage *after* the request storageKeysAfterRequest := []string{} - iter, err = suite.storage.KVStore.Iterator(nil) + iter, err = suite.storage.KVStore.Iterator(context.Background(), nil) if err != nil { panic(err) } @@ -232,7 +232,7 @@ func (suite *MediaCreateTestSuite) TestMediaCreateSuccessfulV2() { // see what's in storage *before* the request storageKeysBeforeRequest := []string{} - iter, err := suite.storage.KVStore.Iterator(nil) + iter, err := suite.storage.KVStore.Iterator(context.Background(), nil) if err != nil { panic(err) } @@ -264,7 +264,7 @@ func (suite *MediaCreateTestSuite) TestMediaCreateSuccessfulV2() { // check what's in storage *after* the request storageKeysAfterRequest := []string{} - iter, err = suite.storage.KVStore.Iterator(nil) + iter, err = suite.storage.KVStore.Iterator(context.Background(), nil) if err != nil { panic(err) } diff --git a/internal/db/bundb/migrations/20220612091800_duplicated_media_cleanup.go b/internal/db/bundb/migrations/20220612091800_duplicated_media_cleanup.go index b0179ec4f..bde96a86c 100644 --- a/internal/db/bundb/migrations/20220612091800_duplicated_media_cleanup.go +++ b/internal/db/bundb/migrations/20220612091800_duplicated_media_cleanup.go @@ -24,8 +24,8 @@ import ( "fmt" "path" - "codeberg.org/gruf/go-store/kv" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/kv" + "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" @@ -34,13 +34,13 @@ import ( func init() { deleteAttachment := func(ctx context.Context, l log.Entry, a *gtsmodel.MediaAttachment, s *kv.KVStore, tx bun.Tx) { - if err := s.Delete(a.File.Path); err != nil && err != storage.ErrNotFound { + if err := s.Delete(ctx, a.File.Path); err != nil && err != storage.ErrNotFound { l.Errorf("error removing file %s: %s", a.File.Path, err) } else { l.Debugf("deleted %s", a.File.Path) } - if err := s.Delete(a.Thumbnail.Path); err != nil && err != storage.ErrNotFound { + if err := s.Delete(ctx, a.Thumbnail.Path); err != nil && err != storage.ErrNotFound { l.Errorf("error removing file %s: %s", a.Thumbnail.Path, err) } else { l.Debugf("deleted %s", a.Thumbnail.Path) @@ -70,7 +70,7 @@ func init() { } return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { - s, err := kv.OpenFile(storageBasePath, &storage.DiskConfig{ + s, err := kv.OpenDisk(storageBasePath, &storage.DiskConfig{ LockFile: path.Join(storageBasePath, "store.lock"), }) if err != nil { diff --git a/internal/media/manager_test.go b/internal/media/manager_test.go index b50235054..3955c1b63 100644 --- a/internal/media/manager_test.go +++ b/internal/media/manager_test.go @@ -27,8 +27,8 @@ import ( "path" "testing" - "codeberg.org/gruf/go-store/kv" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/kv" + "codeberg.org/gruf/go-store/v2/storage" "github.com/stretchr/testify/suite" gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/media" @@ -927,7 +927,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { temp := fmt.Sprintf("%s/gotosocial-test", os.TempDir()) defer os.RemoveAll(temp) - diskStorage, err := kv.OpenFile(temp, &storage.DiskConfig{ + diskStorage, err := kv.OpenDisk(temp, &storage.DiskConfig{ LockFile: path.Join(temp, "store.lock"), }) if err != nil { @@ -974,7 +974,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { suite.NotNil(dbAttachment) // make sure the processed file is in storage - processedFullBytes, err := diskStorage.Get(attachment.File.Path) + processedFullBytes, err := diskStorage.Get(ctx, attachment.File.Path) suite.NoError(err) suite.NotEmpty(processedFullBytes) @@ -987,7 +987,7 @@ func (suite *ManagerTestSuite) TestSimpleJpegProcessBlockingWithDiskStorage() { suite.Equal(processedFullBytesExpected, processedFullBytes) // now do the same for the thumbnail and make sure it's what we expected - processedThumbnailBytes, err := diskStorage.Get(attachment.Thumbnail.Path) + processedThumbnailBytes, err := diskStorage.Get(ctx, attachment.Thumbnail.Path) suite.NoError(err) suite.NotEmpty(processedThumbnailBytes) diff --git a/internal/media/processingemoji.go b/internal/media/processingemoji.go index 79bc23998..32eac4172 100644 --- a/internal/media/processingemoji.go +++ b/internal/media/processingemoji.go @@ -29,7 +29,7 @@ import ( "sync/atomic" "time" - gostore "codeberg.org/gruf/go-store/storage" + gostore "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" diff --git a/internal/media/prunemeta.go b/internal/media/prunemeta.go index 63bdb00b5..69d79b8d9 100644 --- a/internal/media/prunemeta.go +++ b/internal/media/prunemeta.go @@ -21,7 +21,7 @@ package media import ( "context" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" diff --git a/internal/media/prunemeta_test.go b/internal/media/prunemeta_test.go index d95a1f3ed..57e1fe753 100644 --- a/internal/media/prunemeta_test.go +++ b/internal/media/prunemeta_test.go @@ -22,7 +22,7 @@ import ( "context" "testing" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/storage" "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/db" ) diff --git a/internal/media/pruneremote.go b/internal/media/pruneremote.go index 19a9642d7..011ed1dd7 100644 --- a/internal/media/pruneremote.go +++ b/internal/media/pruneremote.go @@ -22,7 +22,7 @@ import ( "context" "fmt" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" diff --git a/internal/media/pruneremote_test.go b/internal/media/pruneremote_test.go index d3a01b7be..4af01c1c5 100644 --- a/internal/media/pruneremote_test.go +++ b/internal/media/pruneremote_test.go @@ -25,7 +25,7 @@ import ( "os" "testing" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/storage" "github.com/stretchr/testify/suite" ) diff --git a/internal/media/pruneunusedlocal.go b/internal/media/pruneunusedlocal.go index ea777428b..ba74b7c90 100644 --- a/internal/media/pruneunusedlocal.go +++ b/internal/media/pruneunusedlocal.go @@ -22,7 +22,7 @@ import ( "context" "fmt" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/storage" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/log" diff --git a/internal/storage/local.go b/internal/storage/local.go index 103233219..3fde7f0b9 100644 --- a/internal/storage/local.go +++ b/internal/storage/local.go @@ -23,8 +23,8 @@ import ( "io" "net/url" - "codeberg.org/gruf/go-store/kv" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/kv" + "codeberg.org/gruf/go-store/v2/storage" ) type Local struct { @@ -32,15 +32,15 @@ type Local struct { } func (l *Local) Get(ctx context.Context, key string) ([]byte, error) { - return l.KVStore.Get(key) + return l.KVStore.Get(ctx, key) } func (l *Local) GetStream(ctx context.Context, key string) (io.ReadCloser, error) { - return l.KVStore.GetStream(key) + return l.KVStore.GetStream(ctx, key) } func (l *Local) PutStream(ctx context.Context, key string, r io.Reader) error { - err := l.KVStore.PutStream(key, r) + err := l.KVStore.PutStream(ctx, key, r) if err == storage.ErrAlreadyExists { return ErrAlreadyExists } @@ -48,7 +48,7 @@ func (l *Local) PutStream(ctx context.Context, key string, r io.Reader) error { } func (l *Local) Put(ctx context.Context, key string, value []byte) error { - err := l.KVStore.Put(key, value) + err := l.KVStore.Put(ctx, key, value) if err == storage.ErrAlreadyExists { return ErrAlreadyExists } @@ -56,7 +56,7 @@ func (l *Local) Put(ctx context.Context, key string, value []byte) error { } func (l *Local) Delete(ctx context.Context, key string) error { - return l.KVStore.Delete(key) + return l.KVStore.Delete(ctx, key) } func (l *Local) URL(ctx context.Context, key string) *url.URL { diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 7bd4c18aa..5d712bc3c 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -26,8 +26,8 @@ import ( "net/url" "path" - "codeberg.org/gruf/go-store/kv" - "codeberg.org/gruf/go-store/storage" + "codeberg.org/gruf/go-store/v2/kv" + "codeberg.org/gruf/go-store/v2/storage" "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" "github.com/superseriousbusiness/gotosocial/internal/config" @@ -60,7 +60,7 @@ func AutoConfig() (Driver, error) { return NewS3(mc, config.GetStorageS3BucketName()), nil case "local": storageBasePath := config.GetStorageLocalBasePath() - storage, err := kv.OpenFile(storageBasePath, &storage.DiskConfig{ + storage, err := kv.OpenDisk(storageBasePath, &storage.DiskConfig{ // Put the store lockfile in the storage dir itself. // Normally this would not be safe, since we could end up // overwriting the lockfile if we store a file called 'store.lock'. |