[erlang-questions] Dispcount resource identification during init

Edmond Begumisa ebegumisa@REDACTED
Thu Jul 19 01:28:52 CEST 2018


The following patch appears to do what I want. Perhaps those familiar
with discount internals could confirm its correctness or suggest and
alternative approach which doesn't require a patch.

dispcount_watcher.erl

         ...
         init
(Id
,Conf
,M
,A
) ->

    -         case
 M
:init
(A
) of

    +         case
 M
:init
(Id, A
) of
         ...

dispcount.erl

         ...

         behaviour_info(callbacks) ->

    -         [{init,1},
    +        [{init,2},

         ...

- Edmond -

----- Original Message -----
From:
 <erlang-questions@REDACTED>

To:
"Edmond Begumisa" <ebegumisa@REDACTED>
Cc:
 Send my REPLY
 [1] 

Sent:
Thu, 19 Jul 2018 07:53:06 +1000
Subject:
Dispcount resource identification during init

 Hello all,

 Any dispcount[1] users out there? Your assistance on two questions
would 
 be appreciated..

 a) During init function of the callback module implementing the
dispcount 
 behaviour, I would like to know resource number assigned to that
process. 
 Is this possible?

 The reason is: each of my resources (port programs) need to be
initialised 
 to use separate directories for storage. For example:
"priv/rc1/data", 
 "priv/rc2/data", etc. If the dispcount sup restarts resource 1 for 
 instance, I would like resource 1 to always use "priv/rc1/data".
There 
 should be no possibility two or more resources ending up being
initialised 
 to the same dir due to sup restarts.

 The identifier doesn't have to be a number. But if the node/machine 
 restarts, the same directories should be used.

 b) Is this library still active? One feature mentioned on the todo
list 
 would be nice to have for our purposes (dynamically growing/shrinking
the 
 number of resources).

 Thanks in advance.

 - Edmond -

 [1] https://github.com/ferd/dispcount

 -- 
 Using Opera's mail client: http://www.opera.com/mail/ 

Links:
------
[1] http://webmail.hysteria-tech.com/#

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180718/0154b0c4/attachment.htm>


More information about the erlang-questions mailing list