From 298a7ad21b367912340201bc76e3e23249043814 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 6 Nov 2022 12:18:52 +0100 Subject: [PATCH 1/2] [docs] add note about Alpha status right at the top (#971) --- README.md | 4 ++-- docs/index.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd6998ea..740dd946 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ With GoToSocial, you can keep in touch with your friends, post, read, and share

+**GoToSocial is still [ALPHA SOFTWARE](https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha)**. It is already deployable and useable, and it federates cleanly with many other Fediverse servers (not yet all). However, many things are not yet implemented, and there are plenty of bugs! We foresee entering beta somewhere in 2023. + Documentation is at [docs.gotosocial.org](https://docs.gotosocial.org). You can skip straight to the API documentation [here](https://docs.gotosocial.org/en/latest/api/swagger/). Here's a screenshot of the instance landing page! @@ -79,8 +81,6 @@ This project sprang up in February/March 2021 out of a dissatisfaction with the It began as a solo project, and then picked up steam as more developers became interested and jumped on. -The project is still [alpha software](https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha), but is already deployable and very useable, and it federates cleanly with many other Fediverse servers (not yet all). - For a detailed view on what's implemented and what's not, and progress made towards [beta release](https://en.wikipedia.org/wiki/Software_release_life_cycle#Beta), please see [the roadmap document](./ROADMAP.md). ## Features diff --git a/docs/index.md b/docs/index.md index 35d6c25d..b8f10b6f 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,6 +10,8 @@ With GoToSocial, you can keep in touch with your friends, post, read, and share GoToSocial provides a lightweight, customizable, and safety-focused entryway into the [Fediverse](https://en.wikipedia.org/wiki/Fediverse), and is comparable to (but distinct from) existing projects such as [Mastodon](https://joinmastodon.org/), [Pleroma](https://pleroma.social/), [Friendica](https://friendica.net), and [PixelFed](https://pixelfed.org/). +**GoToSocial is still [ALPHA SOFTWARE](https://en.wikipedia.org/wiki/Software_release_life_cycle#Alpha)**. It is already deployable and useable, and it federates cleanly with many other Fediverse servers (not yet all). However, many things are not yet implemented, and there are plenty of bugs! We foresee entering beta somewhere in 2023. + Here's a screenshot of the instance landing page! ![Screenshot of the landing page for the GoToSocial instance goblin.technology. It shows basic information about the instance; number of users and posts etc.](./assets/instancesplash.png) From 05a8baa53ae7983b8fa2d79589ff0cab7ab1b22b Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Sun, 6 Nov 2022 12:30:08 +0000 Subject: [PATCH 2/2] [bugfix] KVStore doesn't like lost+found directory (#972) * bump go-store version to v2.0.5, init kv.KVStore without initial clean (as we are using for storage, not as a key-value store) Signed-off-by: kim * remove newline Signed-off-by: kim Signed-off-by: kim --- cmd/gotosocial/action/server/server.go | 1 - go.mod | 2 +- go.sum | 4 +-- internal/storage/local.go | 32 +------------------ internal/storage/storage.go | 16 ++++++---- .../codeberg.org/gruf/go-store/v2/kv/store.go | 16 +++++++--- vendor/modules.txt | 2 +- 7 files changed, 25 insertions(+), 48 deletions(-) diff --git a/cmd/gotosocial/action/server/server.go b/cmd/gotosocial/action/server/server.go index e695e078..3da9e997 100644 --- a/cmd/gotosocial/action/server/server.go +++ b/cmd/gotosocial/action/server/server.go @@ -104,7 +104,6 @@ var Start action.GTSAction = func(ctx context.Context) error { typeConverter := typeutils.NewConverter(dbService) // Open the storage backend - storage, err := gtsstorage.AutoConfig() if err != nil { return fmt.Errorf("error creating storage backend: %w", err) diff --git a/go.mod b/go.mod index f55477ec..63181a2f 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( codeberg.org/gruf/go-logger/v2 v2.2.1 codeberg.org/gruf/go-mutexes v1.1.3 codeberg.org/gruf/go-runners v1.3.1 - codeberg.org/gruf/go-store/v2 v2.0.4 + codeberg.org/gruf/go-store/v2 v2.0.5 github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.4.0 github.com/disintegration/imaging v1.6.2 diff --git a/go.sum b/go.sum index f30b4dd0..f2f57033 100644 --- a/go.sum +++ b/go.sum @@ -95,8 +95,8 @@ codeberg.org/gruf/go-runners v1.3.1 h1:d/OQMMMiA6yPaDSbSr0/Jc+lucWmm7AiAZjWffpNK codeberg.org/gruf/go-runners v1.3.1/go.mod h1:rl0EdZNozkRMb21DAtOL5L4oTfmslYQdZgq2RMMc/H4= codeberg.org/gruf/go-sched v1.1.1 h1:YtLSQhpypzuD3HTup5oF7LLWB79gTL4nqW06kH4Vwks= codeberg.org/gruf/go-sched v1.1.1/go.mod h1:SRcdP/5qim+EBT3n3r4aUra1C30yPqV4OJOXuqvgdQM= -codeberg.org/gruf/go-store/v2 v2.0.4 h1:CpGkJUz7qINh3krjtR6dKmKwJKjprbEKKq4dWF+AemI= -codeberg.org/gruf/go-store/v2 v2.0.4/go.mod h1:vKId86ET4ZzG1tE1dMNkfV66rZkcsyqt64UhKt6EYfc= +codeberg.org/gruf/go-store/v2 v2.0.5 h1:AbOka6LkyT9jobPYfK3h5f5dPqx5AjFPhaaqdOWkGyA= +codeberg.org/gruf/go-store/v2 v2.0.5/go.mod h1:vKId86ET4ZzG1tE1dMNkfV66rZkcsyqt64UhKt6EYfc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= diff --git a/internal/storage/local.go b/internal/storage/local.go index 3fde7f0b..9a5f971a 100644 --- a/internal/storage/local.go +++ b/internal/storage/local.go @@ -20,43 +20,13 @@ package storage import ( "context" - "io" "net/url" "codeberg.org/gruf/go-store/v2/kv" - "codeberg.org/gruf/go-store/v2/storage" ) type Local struct { - KVStore *kv.KVStore -} - -func (l *Local) Get(ctx context.Context, key string) ([]byte, error) { - return l.KVStore.Get(ctx, key) -} - -func (l *Local) GetStream(ctx context.Context, key string) (io.ReadCloser, error) { - return l.KVStore.GetStream(ctx, key) -} - -func (l *Local) PutStream(ctx context.Context, key string, r io.Reader) error { - err := l.KVStore.PutStream(ctx, key, r) - if err == storage.ErrAlreadyExists { - return ErrAlreadyExists - } - return err -} - -func (l *Local) Put(ctx context.Context, key string, value []byte) error { - err := l.KVStore.Put(ctx, key, value) - if err == storage.ErrAlreadyExists { - return ErrAlreadyExists - } - return err -} - -func (l *Local) Delete(ctx context.Context, key string) error { - return l.KVStore.Delete(ctx, key) + *kv.KVStore } func (l *Local) URL(ctx context.Context, key string) *url.URL { diff --git a/internal/storage/storage.go b/internal/storage/storage.go index 5d712bc3..e44c4718 100644 --- a/internal/storage/storage.go +++ b/internal/storage/storage.go @@ -33,8 +33,10 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/config" ) -var ErrNotSupported = errors.New("driver does not suppport functionality") -var ErrAlreadyExists = errors.New("storage key already exists") +var ( + ErrNotSupported = errors.New("driver does not suppport functionality") + ErrAlreadyExists = storage.ErrAlreadyExists +) // Driver implements the functionality to store and retrieve blobs // (images,video,audio) @@ -59,19 +61,19 @@ func AutoConfig() (Driver, error) { } return NewS3(mc, config.GetStorageS3BucketName()), nil case "local": - storageBasePath := config.GetStorageLocalBasePath() - storage, err := kv.OpenDisk(storageBasePath, &storage.DiskConfig{ + basePath := config.GetStorageLocalBasePath() + disk, err := storage.OpenDisk(basePath, &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'. // However, in this case it's OK because the keys are set by // GtS and not the user, so we know we're never going to overwrite it. - LockFile: path.Join(storageBasePath, "store.lock"), + LockFile: path.Join(basePath, "store.lock"), }) if err != nil { - return nil, fmt.Errorf("error creating storage backend: %s", err) + return nil, fmt.Errorf("error openingdisk storage: %v", err) } - return &Local{KVStore: storage}, nil + return &Local{kv.New(disk)}, nil } return nil, fmt.Errorf("invalid storage backend %s", config.GetStorageBackend()) } diff --git a/vendor/codeberg.org/gruf/go-store/v2/kv/store.go b/vendor/codeberg.org/gruf/go-store/v2/kv/store.go index 86ba73f6..5ea795e7 100644 --- a/vendor/codeberg.org/gruf/go-store/v2/kv/store.go +++ b/vendor/codeberg.org/gruf/go-store/v2/kv/store.go @@ -38,10 +38,7 @@ func OpenBlock(path string, cfg *storage.BlockConfig) (*KVStore, error) { } func OpenMemory(overwrites bool) *KVStore { - return &KVStore{ - mu: mutexes.NewMap(-1, -1), - st: storage.OpenMemory(100, overwrites), - } + return New(storage.OpenMemory(100, overwrites)) } func OpenS3(endpoint string, bucket string, cfg *storage.S3Config) (*KVStore, error) { @@ -55,6 +52,7 @@ func OpenS3(endpoint string, bucket string, cfg *storage.S3Config) (*KVStore, er return OpenStorage(storage) } +// OpenStorage will return a new KVStore instance based on Storage, performing an initial storage.Clean(). func OpenStorage(storage storage.Storage) (*KVStore, error) { // Perform initial storage clean err := storage.Clean(context.Background()) @@ -63,10 +61,18 @@ func OpenStorage(storage storage.Storage) (*KVStore, error) { } // Return new KVStore + return New(storage), nil +} + +// New will simply return a new KVStore instance based on Storage. +func New(storage storage.Storage) *KVStore { + if storage == nil { + panic("nil storage") + } return &KVStore{ mu: mutexes.NewMap(-1, -1), st: storage, - }, nil + } } // RLock acquires a read-lock on supplied key, returning unlock function. diff --git a/vendor/modules.txt b/vendor/modules.txt index 517cf1eb..9fd28ccf 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -50,7 +50,7 @@ codeberg.org/gruf/go-runners # codeberg.org/gruf/go-sched v1.1.1 ## explicit; go 1.19 codeberg.org/gruf/go-sched -# codeberg.org/gruf/go-store/v2 v2.0.4 +# codeberg.org/gruf/go-store/v2 v2.0.5 ## explicit; go 1.19 codeberg.org/gruf/go-store/v2/kv codeberg.org/gruf/go-store/v2/storage