spx-backend: store only object keys, not full URLs in the database
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.
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>: schemeoss, indicating files stored in Object-Storagecode:<code-id>: schemecode, inidcating code content stored in DBhttps:<full-url>: schemehttps, for backward compatibility, or maybe 3rd-party integration
Closing as further improvements are tracked in #369.