Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New storage backends #319

Closed
meln1k opened this issue Apr 29, 2019 · 3 comments
Closed

New storage backends #319

meln1k opened this issue Apr 29, 2019 · 3 comments
Milestone

Comments

@meln1k
Copy link

meln1k commented Apr 29, 2019

If I want to integrate a custom storage backend, what parts do I need to implement?

So far it looks like I can start with something similar to https://github.com/umputun/remark/blob/master/backend/app/store/engine/mongo.go, but it is not clear how to implement a backend for storing images.

Are there any recommendations or best practices?

@umputun
Copy link
Owner

umputun commented Apr 29, 2019

Hi. As of now there is no documentation explaining how to deal with external storages. Example of mongo implementation is the closest one. In addition to the core storage (i.e. store/engine) you will need 2 more things:

Another thing you may want is a store for admin data and this is in store/admin.

Generally I would recommend not to do it yet. The current way to add storages is not too friendly and need way too much efforts. I'm in the process of migrating all of this to some pluggable architecture allowing much simpler extensions. As a part of this process I'll move mongo to such a plugin (bolt will stay as a core implementation inside) and will provide an example of some trivial user-defined storage covering all areas.

@umputun
Copy link
Owner

umputun commented Jun 26, 2019

The new backend interface has been merged into master. Instead of the insane amount of function we used to have, all low-level storage functionality consolidated into just a few generalized methods and several higher-level operations were moved to the common store/service.

In order to allow users to bring their own storages, I have added a special layer for RPC-like calls (see /backend/app/remote). For convenience, it also includes the code for user's plugin, i.e. server/remote/plugin side/dispatcher. Support of such custom storages was added to options (cli params and env) as well.

Both new interface and RPC protocol need some detailed documentation and examples (work in progress), but generally speaking, it should be clear from the code what the protocol is and how to use it. I'm planning to add full demo implementation of the custom storage backend (in-memory storage) this weekend.

@umputun umputun added this to the v1.4 milestone Jul 27, 2019
@umputun umputun mentioned this issue Jul 27, 2019
@umputun
Copy link
Owner

umputun commented Aug 1, 2019

I have added an example implementation of alternative storage.

@umputun umputun closed this as completed Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants