builder icon indicating copy to clipboard operation
builder copied to clipboard

spx-backend: store only object keys, not full URLs in the database

Open aofei opened this issue 1 year ago • 1 comments

We plan to support kodo:// and http(s):// schemes.

For kodo://, the format will be kodo://bucket/object. The host part is the bucket name, and the path part is the object key. This supports multiple buckets for different regions, improving UX by storing data closer to users. It also allows for future integration of other storage services, like s3://bucket/object.

Support for http(s):// ensures backward compatibility and the use of external data.

aofei avatar Apr 28 '24 01:04 aofei

Consider that we may store content in ways other than Object-Storage in the future. I think we need something more than object keys.

For example, to optimize user experience of code-editing, we may

  • store code content in DB / mem-cache
  • sync code content with websocket instead of HTTP post/get

To achieve that, we may need to upgrade the values in FileCollection to support multiple schemes, e.g.

  • oss:<object-key>: scheme oss, indicating files stored in Object-Storage
  • code:<code-id>: scheme code, inidcating code content stored in DB
  • https:<full-url>: scheme https, for backward compatibility, or maybe 3rd-party integration

nighca avatar Apr 30 '24 07:04 nighca

Closing as further improvements are tracked in #369.

aofei avatar Jun 28 '24 01:06 aofei