From: Brett S. <bre...@ya...> - 2007-08-10 21:40:02
|
I always wondered if Tcl's namespace mechanism could have been used for the= config file, and by your example below, it is tending towards that. Again,= the idea would be to utilize, where possible, existing Tcl mechanisms. So,= something like:=0A=0Anamespace eval fastpath {=0A set cache = false=0A set cachemaxsize 5120000=0A set cachema= xentry 512000=0A set mmap false=0A}=0A=0A .= =0A .=0A .=0A=0Anamespace eval server::${servername} {=0A set connspert= hread 0=0A set flushcontent false=0A set maxcon= nections 100=0A set maxthreads 10=0A set mint= hreads 0=0A set threadtimeout 120=0A}=0A=0AWhat'= s good about this as well, is if you needed to access that variable later o= n in the config file, then you could just use the FQ name, i.e.=0A=0A set = some_val [$fastpath::cache]=0A=0A=0AHaven't really thought this all the way= through, so there might be some pitfalls.=0A=0AJust an idea,=0A=0A --br= ett=0A=0A----- Original Message ----=0AFrom: Vlad Seryakov <vlad@crystalbal= linc.com>=0ATo: nav...@li...=0ASent: Friday, Augu= st 10, 2007 3:37:07 PM=0ASubject: Re: [naviserver-devel] Proposal: just an = idea about config syntax=0A=0AAlso if section command be made recursive-awa= re, so it will track =0Acurrent position then the syntax can be event more = eaiser=0A=0A=0Asection "server/$servername" {=0A connsperthread = 0=0A flushcontent false=0A maxconnections 100= =0A maxthreads 10=0A minthreads 0=0A = threadtimeout 120=0A=0A section "modules" {=0A nsdb = nsdb.so=0A nssock nssock.so=0A }=0A=0A section "adp" {= =0A map "/*.adp"=0A enableexpire false=0A = }=0A=0A section "tcl" {=0A nsvbuckets 16=0A = library ${homedir}/modules/tcl=0A lazyloader = false=0A }=0A=0A section "module/nssock" {=0A por= t $port=0A address $address=0A = }=0A}=0A=0A=0AVlad Seryakov wrote:=0A> For example instead of this (or i= t could be used at the same time, it is =0A> not a replacement)=0A> =0A> ns= _section "ns/fastpath"=0A> ns_param cache fal= se=0A> ns_param cachemaxsize 5120000=0A> ns_param = cachemaxentry 512000=0A> ns_param mmap = false=0A> =0A> it may look like this (still Tcl)=0A> =0A> section "fastpath= " {=0A> cache false=0A> cachemaxsize = 5120000=0A> cachemaxentry 512000=0A> mmap = false=0A> }=0A> =0A> section "server/${servername}" {=0A> conns= perthread 0=0A> flushcontent false=0A> maxcon= nections 100=0A> maxthreads 10=0A> minthrea= ds 0=0A> threadtimeout 120=0A> }=0A> =0A> =0A> = As you can see this is Tcl command section=0A> =0A> proc section { name arg= s } {=0A> =0A> ns_section ns/$name=0A> foreach { key val } $args {= =0A> ns_param $key $val=0A> }=0A> }=0A> =0A> But config looks li= ke more 21 century and more structured and easier to =0A> read. Very simila= r to lighttpd by the way.=0A> =0A> =0A=0A-- =0AVlad Seryakov=0Avlad@crystal= ballinc.com=0Ahttp://www.crystalballinc.com/vlad/=0A=0A--------------------= -----------------------------------------------------=0AThis SF.net email i= s sponsored by: Splunk Inc.=0AStill grepping through log files to find prob= lems? Stop.=0ANow Search log events and configuration files using AJAX and= a browser.=0ADownload your FREE copy of Splunk now >> http://get.splunk.c= om/=0A_______________________________________________=0Anaviserver-devel ma= iling list=0An...@li...=0Ahttps://lists.sourcef= orge.net/lists/listinfo/naviserver-devel=0A=0A=0A=0A=0A=0A =0A_______= ___________________________________________________________________________= __=0ANeed a vacation? Get great deals=0Ato amazing places on Yahoo! Travel.= =0Ahttp://travel.yahoo.com/ |