for-GET / http-decision-diagram

An activity diagram to describe the resolution of HTTP response status codes, given various headers.
https://github.com/for-GET/http-decision-diagram/blob/master/doc/2013-06-10-http-hell-no.md
Apache License 2.0
3.63k stars 196 forks source link

What does create_path mean? #43

Closed xpe closed 9 years ago

xpe commented 9 years ago

I don't understand the context or purpose of it. Thanks in advance for helping me understand.

P.S. I presume that create is where the actual resource creation would/should happen. Since create_path happens immediately before, I though that would be enough of a clue to figure it out, but I'm still unsure.

andreineculau commented 9 years ago

see https://github.com/for-GET/machine/blob/1bcee13974513ec1b79c6fdd1ecbbde332543361/src/FSMResource/create.coffee#L11 and https://github.com/for-GET/machine/blob/1bcee13974513ec1b79c6fdd1ecbbde332543361/src/Resource.coffee#L230

path is in charge with

1) (if the current resource doesn't have an id already) getting an id, for instance, from an external system, 2) constructing the URL for that resource 3) returning that URL

If path doesn't come out empty handed, then create_path succeeds.

With some setups (e.g. message queues and alikes), that can obviously be impossible, but then path's implementation can be that it returns true or some temporary http://example.com/item/tmp0 path which is resolved by the web server alone (when the real path cannot be constructed and known now)

andreineculau commented 9 years ago

PS: I don't know if you noticed the difference between the suffices of different callbacks :in means internal, but still overloadable, while other suffices denote the output type and those should be implemented (i.e. there is no default implementation)