View Issue Details

IDProjectCategoryView StatusLast Update
0003306unrealmodule apipublic2015-08-08 16:03
ReportersyzopAssigned Tosyzop 
PrioritynormalSeverityfeatureReproducibilityN/A
Status resolvedResolutionfixed 
PlatformOSALLOS VersionALL
Product Version3.3-alpha0 
Target VersionFixed in Version3.4-beta2 
Summary0003306: Attaching objects to clients/channels for modules
DescriptionAdd the ability to add objects (an integer, string, any structure) to clients and channels.

This is needed for various modules to make things easy and fast.
Additional InformationFor stuff like a codepage module, you'll have to store for each user 'this user has codepage X'. Other modules have similar requirements.
While in my module I've used various methods, it's simpeler to do in the core (besides, others seem to find it too much of a hassle.. possibly rightfully so ;p).

The technique:
We shouldn't be using stuff like anope or other progs that let you attach a string to a structure in.. well.. however it works.

We should use something like my extcmodes slot system (see Unreal3.3*!), this means that clients and channels get some slots assigned (like 10, or 16, etc..) which then can be filled by modules. This costs some memory but that outweighs the far bigger benefits.

chptr->moddata[mymodulechanslot]
sptr->moddata[mymoduleuserslot]

Advantages vs other aproaches are the same as why we're using it for extcmodes:
* much less memory defragmentation: all reference-data is besides eachother (granted, if the data references to something, then that data is not near)
* extremely fast: fastest possible method, especially for properties like numbers, but it works fine for strings and struct/binary data as well. it's faster due to the memory layout.
Only disadvantage:
* Static amount of slots allocated per-user/per-channel. This is not much of a problem, because if we'd allocate.. say.. 10 slots per-channel for stuff (that's 10x4=40 or 10x8=80 bytes), this is already less than if you'd store 2 or 3 properties using any other method that stores moddata than slots (because every malloc() uses like 8 or 16 bytes extra, and you have to store next/prev pointers as well which are another 8 or 16 bytes, plus the modowner.. another 8 or so, etc.. this brings you easily at 40 bytes for just one entry).

in short: slots! :)

TagsNo tags attached.
3rd party modules

Activities

syzop

2015-08-08 16:03

administrator   ~0018593

Done in 3.4.x. See https://www.unrealircd.org/docs/Dev:Module_Storage

Issue History

Date Modified Username Field Change
2007-04-28 08:50 syzop New Issue
2007-04-28 08:53 syzop Additional Information Updated
2007-04-28 08:55 syzop Status new => acknowledged
2015-08-08 16:03 syzop Note Added: 0018593
2015-08-08 16:03 syzop Status acknowledged => resolved
2015-08-08 16:03 syzop Fixed in Version => 3.4-beta2
2015-08-08 16:03 syzop Resolution open => fixed
2015-08-08 16:03 syzop Assigned To => syzop
2017-01-06 15:48 syzop Category module => module api