-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El Wed, 12 Aug 2009 11:01:01 +0000 Eric MSP Veith <[email protected]> escribió: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > There's room for alot of elegant but complicated solutions. ;-) > > First of all, encapsuling "g" is a good idea. We should hide the > nitty-gritty details behind a well-documented API. That would make > InitNG less complicated. > > For read-only access, I'd just declare a function that takes a > function pointer. This function takes care of iterating and just > passes every element in the persistent data list to the function > pointer. We can specify what type an element has and take care of > datatype handling that way. >
We could do the same for write-access as long as we don't have threads... > This model would also allow us to take transparently care of any > threading issues, synchronization or whatever problems might arise at > some later point. > I would prefer to keep the single thread model. Multi-threading adds too much complexity. BTW, I'm implementing something similar to Mac OS X's GDC, but uses a different model (tree-based) as well as fibers (I think they are reading my mind or something... :P, I'm sure I thought it before!). I'm implementing it over my own microkernel (which is closely related to the concept). Until I get that standardized, I don't think there's much benefit from multi-threading on our project. > Well, what about this piece of real code just for the iterator stuff: > > void initng_map_persistent(void (*yield)(persistent_item_t *)); > typedef void iterator_func(list_t *item, void *p); void foreach(list_t *list, iterator_func *func, void *p); Through p we can pass any extra data and receive data from the function. The only problem with this model is that it's not efficient. > I'm not quite sure what we need there, but probably it is enough to > limit the persistent API to the basic CRUD features and have the > following API: > <...> I don't think having an API for each db is a good idea... Another option is to simply pass the list head back through a function (which maybe should be hidden by macros), but that's not as clean as I would like... - -- Ismael Luceno -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkqEpNoACgkQ/mxY0+yOXJovtACgvG3THA5Enc3Z3TQkBFk3c+tF 9MUAn1oUk5ZTMcfcbe3kauFHV/IgBBxz =bWs6 -----END PGP SIGNATURE----- -- _______________________________________________ Initng mailing list [email protected] http://jw.dyndns.org/mailman/listinfo/initng
