EricssonResearch / calvin-base

Calvin is an application environment that lets things talk to things, among other things.
Apache License 2.0
282 stars 91 forks source link

Suggestions for csdocs #77

Open peiworld opened 7 years ago

peiworld commented 7 years ago

I am trying to go through various parts of the calvin framework. Some actors require inputs at init. However, the documentation for those is a bit lacking. For example, I understand that std.Constant(data) requires data as input. But, what is 'data'? Can I specify a datafile?

https://github.com/EricssonResearch/calvin-base/blob/master/calvin/actorstore/systemactors/std/Constant.py

""" Send predetermined data on output. Never ending sequence. Outputs: token : Some data """ @manage(['data']) def init(self, data): self.data = data

persquare commented 7 years ago

Ah, yes, the documentation is a bit terse...

Send predetermined data on output. Never ending sequence. Outputs: token : Some data

As a rule of convention, not enforced, a port named token as above consumes/produces "any kind" of data, where "any kind" means valid JSON data. So in this particular case, the following examples are both valid:

foo : std.Constant(data=null)
bar : std.Constant(data={"hey":"you", "array":[1,2,3,4]}) 

It is not possible to specify a file, but if you have complex data to pass in it is possible to use constant definitions:

define BAZ={"hey":"you", ... long and complex JSON structure ... }
baz : std.Constant(data=BAZ)

BTW, we'd love pull requests for documentation improvement :)

peiworld commented 7 years ago

On Jul 20, 2017, at 6:46 AM, Per Persson notifications@github.com wrote:

Ah, yes, the documentation is a bit terse...

Send predetermined data on output. Never ending sequence. Outputs: token : Some data

As a rule of convention, not enforced, a port named token as above consumes/produces "any kind" of data, where "any kind" means valid JSON data.

Ok, this needs to be clarified.

So in this particular case, the following examples are both valid:

foo : std.Constant(data=null) bar : std.Constant(data={"hey":"you", "array":[1,2,3,4]}) It is not possible to specify a file, but if you have complex data to pass in it is possible to use constant definitions:

define BAZ={"hey":"you", ... long and complex JSON structure ... } baz : std.Constant(data=BAZ) BTW, we'd love pull requests for documentation improvement :)

Will do that! — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.