lapis icon indicating copy to clipboard operation
lapis copied to clipboard

Implement a read-only mode

Open Nidoxs opened this issue 1 year ago • 12 comments

It would be useful to have a way to read a player's data while they're not in the game. For example, if there's a leaderboard system where it shows the top 3 players on podiums and you want to show things they own like skins, guns etc. The read-only feature would allow you to load their data and hold it temporarily to extract the value(s) you need.

I believe ProfileService has a similar feature.

Thanks! 👍

Nidoxs avatar Mar 11 '24 19:03 Nidoxs

Thanks for the issue, Lapis should definitely have this feature!

nezuo avatar Mar 11 '24 20:03 nezuo

Yeah, having a way to read data without imposing a session lock would be great!

jackTabsCode avatar May 04 '24 22:05 jackTabsCode

I've been thinking about this and I'm not sure how it should work with migrations. Would you expect this to return API to return data with an outdated migration version?

nezuo avatar May 04 '24 23:05 nezuo

Maybe it runs the migration code locally but doesn't save that data back?

sasial-dev avatar May 05 '24 08:05 sasial-dev

Either way feels like it's a 'gotcha' territory.

sasial-dev avatar May 05 '24 08:05 sasial-dev

Maybe it runs the migration code locally but doesn't save that data back?

I think applying a temporary unsaved migration is a necessary compromise for the proposed read-only mode.

I certainly don't have a use case for reading data that is out of date, so I think the natural step there is just running whatever migration is needed to bring the data up to date.

Nidoxs avatar May 05 '24 08:05 Nidoxs

Even if we did run the migration, you could have a situation where a server reads a document with a migration version higher than its own.

nezuo avatar May 05 '24 17:05 nezuo

That could still happen on it's normal write mode though? So I don't think it's in the scope of this issue?

sasial-dev avatar May 19 '24 04:05 sasial-dev

If you load a document that has a higher migration version than the servers, it will error and not load the document. We could do that here as well. I just don't know the specific use-cases people have for a read-only mode, so I don't know if that's acceptable.

nezuo avatar May 19 '24 06:05 nezuo

I think it makes the most sense to return the data migrated to the version that the server calling it expects.

jackTabsCode avatar May 21 '24 01:05 jackTabsCode

I think it makes the most sense to return the data migrated to the version that the server calling it expects.

I agree, but if it is passed the server's migration version, you would expect it to error then?

nezuo avatar May 21 '24 03:05 nezuo

I think it makes the most sense to return the data migrated to the version that the server calling it expects.

I agree, but if it is passed the server's migration version, you would expect it to error then?

Yes

jackTabsCode avatar May 21 '24 18:05 jackTabsCode

Resolved with #59.

nezuo avatar Aug 01 '24 00:08 nezuo