Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion ensure_all and ensure_qs

Received: by 10.236.123.43 with SMTP id u31mr553616yhh.43.1349963645751;
        Thu, 11 Oct 2012 06:54:05 -0700 (PDT)
X-BeenThere: zotonic-developers@googlegroups.com
Received: by 10.236.132.114 with SMTP id n78ls2641649yhi.9.gmail; Thu, 11 Oct
 2012 06:54:05 -0700 (PDT)
Received: by 10.101.40.15 with SMTP id s15mr151041anj.2.1349963645260;
        Thu, 11 Oct 2012 06:54:05 -0700 (PDT)
Received: by 10.101.40.15 with SMTP id s15mr151040anj.2.1349963645237;
        Thu, 11 Oct 2012 06:54:05 -0700 (PDT)
Return-Path: <mworr...@me.com>
Received: from st11p02mm-asmtp004.mac.com (st11p02mm-asmtp004.mac.com. [17.172.220.239])
        by gmr-mx.google.com with ESMTP id t29si415597yha.0.2012.10.11.06.54.05;
        Thu, 11 Oct 2012 06:54:05 -0700 (PDT)
Received-SPF: pass (google.com: domain of mworr...@me.com designates 17.172.220.239 as permitted sender) client-ip=17.172.220.239;
Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of mworr...@me.com designates 17.172.220.239 as permitted sender) smtp.mail=mworr...@me.com
MIME-version: 1.0
Content-type: multipart/alternative;
 boundary="Boundary_(ID_gcKGj1HFSD63tJp6HHf1ow)"
Received: from [192.168.1.16]
 (5469A6C2.cm-12-2c.dynamic.ziggo.nl [84.105.166.194])
 by st11p02mm-asmtp004.mac.com
 (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Jan
  3 2012)) with ESMTPSA id <0MBQ000TTEL0N...@st11p02mm-asmtp004.mac.com> for
 zotonic-developers@googlegroups.com; Thu, 11 Oct 2012 13:53:27 +0000 (GMT)
X-Proofpoint-Virus-Version: vendor=fsecure
 engine=2.50.10432:5.7.7855,1.0.431,0.0.0000
 definitions=2012-10-11_05:2012-10-11,2012-10-11,1970-01-01 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
 ipscore=0 suspectscore=1 phishscore=0 bulkscore=0 adultscore=0 classifier=spam
 adjust=0 reason=mlx scancount=1 engine=6.0.2-1203120001
 definitions=main-1210110118
From: Marc Worrell <mworr...@me.com>
Subject: Re: [Zotonic-Dev] ensure_all and ensure_qs
Date: Thu, 11 Oct 2012 15:53:23 +0200
In-reply-to: <7c3ebb1b-f320-4a07-aa39-a5aed65c9d10@googlegroups.com>
To: zotonic-developers@googlegroups.com
References: <ee706c6d-0bd3-4999-9019-38ddef9b4339@googlegroups.com>
 <827FB4C4-0F31-48C8-B8AB-ED72D12D1...@me.com>
 <e5b0d4f9-f775-46de-ae2c-b75dbbec0cf9@googlegroups.com>
 <65B49012-E108-464D-A1A9-B29716B4D...@me.com>
 <7c3ebb1b-f320-4a07-aa39-a5aed65c9d10@googlegroups.com>
Message-id: <48AADB9C-35F3-4939-AAFF-2E1D9B95E...@me.com>
X-Mailer: Apple Mail (2.1278)


--Boundary_(ID_gcKGj1HFSD63tJp6HHf1ow)
Content-type: text/plain; CHARSET=US-ASCII
Content-transfer-encoding: 7BIT

Hi,

There is a process per "open page/tab" in a browser. 
They are connected to the session and timeout when there hasn't been any activity.

We process the request in the Mochiweb/Webzmachine process.
Not in the session or page processes.

Don't use process dictionary variables.
We exclusively use the process dictionary for caching.
The caching routines periodically flush this cache to prevent it from growing too large.

When you want to store values the store them in:

  - the context for request duration/scope
  - the page process for duration of the page/websocket connections
  - the session for session duration/scope



- Marc



On 11 okt. 2012, at 13:54, Amiramix wrote:

> Mark, you mentioned there is one process per page. Is there any boundary which methods Zotonic calls within that process as opposed to methods called within the context of other processes like gen_servers (e.g. z_session)? For example, do the methods called on a resource by webzmachine (is_authorized, allowed_methods, content_types_provided, etc.) get executed within the context of the same process? If I store something in a process dictionary in one of them will that be available in the other method?
> 
> 
> On Wednesday, October 10, 2012 7:03:29 PM UTC+1, Marc Worrell wrote:
> Yes, that is the whole idea. 
> The session should be optional, especially when serving anonymous or public content. 
> 
> On 10 okt. 2012, at 19:44, Amiramix wrote: 
> 
> > Does it mean that we can process the request without extending the session? E.g. call ensure_qs with or without continue_session? What happens if a page requests some resources and, whereas the page itself extends the session, the requested resources do not? E.g. say that a page loads a JSON and the resource to return the JSON doesn't call continue_session? 
> 
> That might give different access permissions. When there is no session, then no user will come from that session, so you end up with an anonymous #context. 
> 
> - Marc 


--Boundary_(ID_gcKGj1HFSD63tJp6HHf1ow)
Content-type: text/html; CHARSET=US-ASCII
Content-transfer-encoding: quoted-printable

<html><head></head><body style=3D"word-wrap: break-word; =
-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; =
">Hi,<div><br></div><div>There is a process per "open page/tab" in a =
browser.&nbsp;</div><div>They are connected to the session and timeout =
when there hasn't been any activity.</div><div><br></div><div>We process =
the request in the Mochiweb/Webzmachine process.</div><div>Not in the =
session or page processes.</div><div><br></div><div>Don't use process =
dictionary variables.</div><div>We exclusively use the process =
dictionary for caching.</div><div>The caching routines periodically =
flush this cache to prevent it from growing too =
large.</div><div><br></div><div>When you want to store values the store =
them in:</div><div><br></div><div>&nbsp; - the context for request =
duration/scope</div><div>&nbsp; - the page process for duration of the =
page/websocket connections</div><div>&nbsp; - the session for session =
duration/scope</div><div><br></div><div><br></div><div><br></div><div>- =
Marc</div><div><br></div><div><br></div><div><br><div><div>On 11 okt. =
2012, at 13:54, Amiramix wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite">Mark, you =
mentioned there is one process per page. Is there any boundary which =
methods Zotonic calls within that process as opposed to methods called =
within the context of other processes like gen_servers (e.g. z_session)? =
For example, do the methods called on a resource by webzmachine =
(is_authorized, allowed_methods, content_types_provided, etc.) get =
executed within the context of the same process? If I store something in =
a process dictionary in one of them will that be available in the other =
method?<br><br><br>On Wednesday, October 10, 2012 7:03:29 PM UTC+1, Marc =
Worrell wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;">Yes, that is the whole idea.
<br>The session should be optional, especially when serving anonymous or =
public content.
<br>
<br>On 10 okt. 2012, at 19:44, Amiramix wrote:
<br>
<br>&gt; Does it mean that we can process the request without extending =
the session? E.g. call ensure_qs with or without continue_session? What =
happens if a page requests some resources and, whereas the page itself =
extends the session, the requested resources do not? E.g. say that a =
page loads a JSON and the resource to return the JSON doesn't call =
continue_session?
<br>
<br>That might give different access permissions. When there is no =
session, then no user will come from that session, so you end up with an =
anonymous #context.
<br>
<br>- Marc
<br></blockquote></blockquote></div><br></div></body></html>=

--Boundary_(ID_gcKGj1HFSD63tJp6HHf1ow)--