by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Nicolas Sebrecht
@nicolas33
and
Yes, here on Gitter.
Have to go.
Jens Neuhalfen
@neuhalje
have a nice day!
Nicolas Sebrecht
@nicolas33
See you later. ,-)
Jens Neuhalfen
@neuhalje
see you!
Jens Neuhalfen
@neuhalje
PS: good video!
Nicolas Sebrecht
@nicolas33
I've just looked at it again.
...and I realize how much things I'm about to trash already. :-)
Jens Neuhalfen
@neuhalje
;-)
Nicolas Sebrecht
@nicolas33
hi
Jens Neuhalfen
@neuhalje
hi
Nicolas Sebrecht
@nicolas33
I'm hardly re-designing the framwork.
Jens Neuhalfen
@neuhalje
“hardly”?
like “its ok as it is”?
Nicolas Sebrecht
@nicolas33
The job is hard.
If "as it is" is any current code then no it's far from well designed.
There are so many use cases.
I should share my current code/thoughts, maybe.
Are you used to python?
Jens Neuhalfen
@neuhalje
Yepp
sorry, I have only half an eye on gitter right now
Nicolas Sebrecht
@nicolas33
np
give me a minute.
Nicolas Sebrecht
@nicolas33
20180401_200705.jpg
I've started the code with this design.
What's hard is for the framework to decide what to expose and how.
And how to implement the passing by message (direct queues or pubsub).
The green squares are the workers (either thread, process, or local callable).
Nicolas Sebrecht
@nicolas33
Also, I'm mixed between letting the user to statically define the architecture or relying on dynamic IoC ala Django. :-)
Ok, I've the answer for this one. Let's start static. It will be much easier for the beginning.
Jens Neuhalfen
@neuhalje
Sorrx, was AFK
BTW: I wrote a dependency injection implementation for one of my projects
It works pretty well (and is quite smallish)
Nicolas Sebrecht
@nicolas33
There are more than one way to do dependency injection. ,-)
Jens Neuhalfen
@neuhalje
Jupp
Nicolas Sebrecht
@nicolas33
How did you implement it?
Jens Neuhalfen
@neuhalje
Wait a sec
Nicolas Sebrecht
@nicolas33
@ishankhare07 and @aroig You might be interested in the above. ;-)
(about the imapfw design)
(restarted from scratch, BTW)
Jens Neuhalfen
@neuhalje
So this is how you declare factories and dependencies
    #
    #  storage
    #

    @di.provides(scope="PER_ROOT")
    def transaction():
        return Transaction()

    @di.provides(scope="GLOBAL")
    def storage__sqlite_instance(configuration):
        return SQLiteInstance.create_or_open(configuration.storage_root_path_sqlite)

    @di.provides(scope="PER_ROOT")
    def storage__DB(storage__sqlite_instance, transaction):
        return SQliteTX(storage__sqlite_instance, transaction)
Nicolas Sebrecht
@nicolas33
decorators and params.
Jens Neuhalfen
@neuhalje

The idea is that you normally operate in some kind of business transaction or context.

At the beginning of such a transaction (say the request handler for a REST call) you would create a new business transaction (I named it query root):

query_root  = di.new_query_root()

db = query_root.get_dependency(“storage__DB”)
Nicolas Sebrecht
@nicolas33
Easy when all in one thread. :-)
Jens Neuhalfen
@neuhalje
Instances get reused as defined: A factory method that is declared with @di.provides(scope="PER_ROOT”), e.g. the transaction() will return the same transaction instance for the query root
It should work multithreaded
Nicolas Sebrecht
@nicolas33
But not multiprocessed, I guess.