Custom IRoomStorage

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Custom IRoomStorage

Postby weberekt » 07 Nov 2016, 21:43

Is it possible to have our own implementation of the interface and set it to the zone?
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom IRoomStorage

Postby Lapo » 08 Nov 2016, 10:31

Hi,
sorry, at the moment this is not supported.

What would be the use case?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Custom IRoomStorage

Postby weberekt » 08 Nov 2016, 21:11

By documentation, it's using DBManager assigned to the zone, but I'm using Hibernate to access database.
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom IRoomStorage

Postby Lapo » 09 Nov 2016, 08:00

Since the serialization and storage to the DB is done by the component, why is Hibernate relevant? You still have your Room data stored to the DB, no?
Lapo

--

gotoAndPlay()

...addicted to flash games
weberekt
Posts: 35
Joined: 16 Sep 2014, 00:47

Re: Custom IRoomStorage

Postby weberekt » 09 Nov 2016, 22:19

Yup true. But I don't want to activate DbManager just for Room Persistence and I also want to have a custom Room table structure.

It's okay now, I'll implement my own db structure to store data.

THanks :)
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom IRoomStorage

Postby Lapo » 10 Nov 2016, 09:04

Fair enough. I've added a note in our TODO list to investigate whether we can generalize the Room storage so that developers can plug their own code.

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
Luke64
Posts: 21
Joined: 08 Nov 2020, 23:15

Re: Custom IRoomStorage

Postby Luke64 » 06 Jul 2021, 21:08

Hi Lapo, I also came across the need to replace the RoomStorage class... for the simple reasons that PostgreSQL's syntax for binary fields ("bytea") is not supported by the supplied database implementation and even when switching to useTextSerialization = true, it serializes the room configuration as JSON and loses all information about the numeric types (Long 1 becomes Int 1 on deserialization) which "breaks" (mistypes) stored room variables on room reload.

Did you by any chance find a way for me to plug in my own IRoomStorage class now?

Inside that class, I'd like to use the DBManager for connection handling, basically just as I do with my custom BuddyStorage.

Thanks a lot!

Cheers,
Niklas
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom IRoomStorage

Postby Lapo » 07 Jul 2021, 16:11

Hi,
we haven't made any progress on this front, sorry, the main reason being it's not a very requested features.

Have you considered using plain local file storage? Room data files are very small and even if you have thousands of Room it won't eat up much disk space.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
Luke64
Posts: 21
Joined: 08 Nov 2020, 23:15

Re: Custom IRoomStorage

Postby Luke64 » 07 Jul 2021, 16:44

Hi Lapo,
Lapo wrote:we haven't made any progress on this front, sorry, the main reason being it's not a very requested features.

Not a problem, but is there a way to replace the way Rooms are persisted? Because:
Lapo wrote:Have you considered using plain local file storage? Room data files are very small and even if you have thousands of Room it won't eat up much disk space.

Yes, and the main issue here is simply: cloud- and container-hosting. The SFS2X is not bound to a host in our (container-based) setup (as is nothing except the database and even that is being worked on). It could become teared down and fired up again, even with two instances running simultaneously during a very short period of time during deployment. We could set up a networking file system we can mount into the SFS2X instance - or use the database, with the latter being much easier... That's why I put quite some time into bringing everything into the database.

Cheers,
Niklas
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom IRoomStorage

Postby Lapo » 08 Jul 2021, 07:05

Hi,
Not a problem, but is there a way to replace the way Rooms are persisted? Because:

You can bypass the standard Room persistence system entirely and build your own that stores data to your database, if this is what you're asking.

If it can help I can send you the sources of the database persistence class we use, so you can see how we serialize Rooms and implement something similar that works for you.

You can request it to our support@... email box, adding a link to this discussion for reference.

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 38 guests