Revision 30e2f0291454156c4c138696866bc8e50d3c1c3e authored by Peter Teuben on 13 October 2022, 15:53:54 UTC, committed by Peter Teuben on 13 October 2022, 15:53:54 UTC
2 parent s 88a426a + 3d204ae
Raw File
savekeys.design
"savekeys" design (external)


The idea is to not only be able to set input parameters to a program,
the ones that control the program and its output, but also have
output parameters be set, that can be used in programs along the pipe.

To take a example from python, where one often does:

     v = foo(p1, p1)
     w = bar(v['a1'], v['a2'])

So in NEMO, which uses the shell, there is no such easy construct.
Imagine NEMO to have a pool of variables, controlled by $NEMOVAR
(e.g. ~/.nemovar)


An example of internal parameters re-use within a program:
(there often is not a good reason for this)

   snapgrid in=snap.dat out=ccd.dat nx=200 ny=\$nx
   or 
   snapgrid in=snap.dat out=ccd.dat nx=200 ny='$nx'

An example of keyword macro files:

   nemoinp 1:10:2 > c.lis
   ccdplot in=ccd.dat contour=@c.lis




New safekeys:   (nemovar is the new name)


Each program, like the string defv[] array, will need to define an array
of keywords that can be exported. Sort of as follows:
(we use a similar structure to defv[], so we can re-use the routines
in getparam.c)

string savekeys[] = {
	"rms=d\n	RMS value in a selection region of the map",
	"mean=d\n	MEAN value in a selection region of the map",
	"n=i\n          Number of pixels in selected region of map",
	"quartiles=d4\n Quartiles (an array)",
	NULL,
};


User code would do something like this:


  double rms, q[4];

  save_key("rms",1, &rms);
  save_key("quartiles", 4, q);
  
It also turns out I once did write a prototype for this
	void kprintf(string key, const string fmt, ...)
but this was designed to store keywords in ascii format, which we are
now arguing we should do in binary using NEMO's filestruct(3NEMO)
format. Also , the name is in use in the kernel and may cause confusion.

---------------------------------------------------------------------------
http://www.ex-parrot.com/~chris/xdata/

xdata is a set of shell-level utilities, and a perl module, which
implement an interface to arbitrary key-value pairs which is accessible
to simple shell and perl programs. Examples of applications for this
include to-do lists, contact databases, browser bookmarks and so forth--
in fact, anything which requires small pieces of data to be referenced
by keys. xdata stores timestamps for the data it manages, and comes with
a program to synchronise databases among cooperating hosts. This allows
you to propagate information among hosts in a transparent fashion
(creations, updates and deletes are correctly handled), which is nice if
you want to create a uniform environment on numerous machines.



---
could memcached be used ?
back to top