Skip to content

[http-api] Allow for external calls to manipulate scheduler behaviour state #17

@zampino

Description

@zampino

hallo Mark, I am hanving a look at the http-api branch
which looks nice and wanted to probe
the soundness of the following approach :-)

Would it make sense to let the specific behaviour module change
it's own state on external calls? Smth like:

% scheduler.erl
- callback handle_call( Request :: any(), From :: {tag(), pid()}, State :: any() ) 
    -> {ReplyType :: atom(), Reply :: any(), State :: any()} 

handle_call(Request, From, State) ->
    {Handler, HandlerState} = get_handler(State),
    {reply, Reply, HandlerState} = apply(Handler, handle_call, [Request, From, HandlerState]),
    State = record_update(State, HandlerState),
    {reply, Reply, State}.

This could allow e.g. to enqueue Tasks into the behaviour state,
to be scheduled in the offers callback

Also, not sure if a reply or a noreply would fit better here.

is btw the http-api branch being developed further?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions