Permalink
Browse files

sync with tokyotyrant-1.1.21

  • Loading branch information...
1 parent c4fbf3d commit 2ff3a29aa43df67321b786b4cc49831771b10dff @etrepum etrepum committed Apr 11, 2009
Showing with 57 additions and 62 deletions.
  1. +6 −0 ChangeLog
  2. +10 −10 configure
  3. +2 −2 configure.in
  4. +1 −2 doc/index.html
  5. +2 −6 ext/mapreduce.lua
  6. +34 −40 scrext.c
  7. +2 −2 ttutil.h
View
@@ -1,3 +1,9 @@
+2009-04-06 Mikio Hirabayashi <mikio@users.sourceforge.net>
+
+ * scrext.c (serv_mapreduce): the parameter for the session ID was abolished.
+
+ - Release: 1.1.21
+
2009-04-01 Mikio Hirabayashi <mikio@users.sourceforge.net>
* configure.in: a bug related to support for traditional shells was fixed.
View
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for tokyotyrant 1.1.20.
+# Generated by GNU Autoconf 2.61 for tokyotyrant 1.1.21.
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='tokyotyrant'
PACKAGE_TARNAME='tokyotyrant'
-PACKAGE_VERSION='1.1.20'
-PACKAGE_STRING='tokyotyrant 1.1.20'
+PACKAGE_VERSION='1.1.21'
+PACKAGE_STRING='tokyotyrant 1.1.21'
PACKAGE_BUGREPORT=''
# Factoring default headers for most tests.
@@ -1194,7 +1194,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures tokyotyrant 1.1.20 to adapt to many kinds of systems.
+\`configure' configures tokyotyrant 1.1.21 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1255,7 +1255,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of tokyotyrant 1.1.20:";;
+ short | recursive ) echo "Configuration of tokyotyrant 1.1.21:";;
esac
cat <<\_ACEOF
@@ -1350,7 +1350,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-tokyotyrant configure 1.1.20
+tokyotyrant configure 1.1.21
generated by GNU Autoconf 2.61
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -1364,7 +1364,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by tokyotyrant $as_me 1.1.20, which was
+It was created by tokyotyrant $as_me 1.1.21, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -1720,7 +1720,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# Package information
MYLIBVER=3
-MYLIBREV=4
+MYLIBREV=5
MYPROTVER="0.9"
# Targets
@@ -5929,7 +5929,7 @@ exec 6>&1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by tokyotyrant $as_me 1.1.20, which was
+This file was extended by tokyotyrant $as_me 1.1.21, which was
generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5972,7 +5972,7 @@ Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-tokyotyrant config.status 1.1.20
+tokyotyrant config.status 1.1.21
configured by $0, generated by GNU Autoconf 2.61,
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
View
@@ -7,11 +7,11 @@
#================================================================
# Package name
-AC_INIT(tokyotyrant, 1.1.20)
+AC_INIT(tokyotyrant, 1.1.21)
# Package information
MYLIBVER=3
-MYLIBREV=4
+MYLIBREV=5
MYPROTVER="0.9"
# Targets
View
@@ -1321,9 +1321,8 @@ <h3 id="luaext_builtinfunc">Built-in Functions</h3>
<dd>Process each record atomically.</dd>
<dd>`<var>func</var>' the iterator function called for each record. It receives two parameters of the key and the value, and returns true to continue iteration or false to stop iteration.</dd>
<dd>If successful, the return value is true, else, it is false.</dd>
-<dt><code>_mapreduce(<var>sid</var>, <var>keys</var>, <var>mapper</var>, <var>reducer</var>)</code></dt>
+<dt><code>_mapreduce(<var>keys</var>, <var>mapper</var>, <var>reducer</var>)</code></dt>
<dd>Perform operations based on MapReduce.</dd>
-<dd>`<var>sid</var>' specifies the session ID number, which should be positive.</dd>
<dd>`<var>keys</var>' specifies the keys of target records. If it is not defined, every record in the database is processed.</dd>
<dd>`<var>mapper</var>' specifies the mapper function. It is called for each target record and receives the key, the value, and the function to emit the mapped records. The emitter function receives a key and a value. The mapper function should return true normally or false on failure.</dd>
<dd>`<var>reducer</var>' specifies the reducer function. It is called for each record generated by sorting emitted records by keys, and receives the key and an array of values. The reducer function should return true normally or false on failure.</dd>
View
@@ -10,11 +10,7 @@
-- count words of all records
-function wordcount(sid, texpr)
- sid = tonumber(sid)
- if not sid then
- sid = math.floor(_time()) % 65535 + 1
- end
+function wordcount(texpr)
local targets = nil
if texpr and #texpr > 0 then
targets = {}
@@ -31,7 +27,7 @@ function wordcount(sid, texpr)
res = res .. key .. "\t" .. #values .. "\n"
return true
end
- if not _mapreduce(sid, targets, mapper, reducer) then
+ if not _mapreduce(targets, mapper, reducer) then
res = nil
end
return res
View
@@ -465,8 +465,12 @@ static int serv_putfunc(lua_State *lua){
lua_pushstring(lua, "putfunc: invalid arguments");
lua_error(lua);
}
+
+ /*
lua_getglobal(lua, SERVVAR);
SERV *serv = lua_touserdata(lua, -1);
+ */
+
bool err = false;
printf("%s:%s\n", name, expr);
@@ -884,64 +888,54 @@ static int serv_foreach(lua_State *lua){
/* for _mapreduce function */
static int serv_mapreduce(lua_State *lua){
int argc = lua_gettop(lua);
- if(argc < 1){
+ if(argc < 3){
lua_pushstring(lua, "_mapreduce: invalid arguments");
lua_error(lua);
}
- int id = lua_tonumber(lua, 1);
- if(id < 1){
+ if(!lua_isfunction(lua, 2) || !lua_isfunction(lua, 3)){
lua_pushstring(lua, "_mapreduce: invalid arguments");
lua_error(lua);
}
lua_getglobal(lua, SERVVAR);
SERV *serv = lua_touserdata(lua, -1);
TCLIST *keys = NULL;
- if(argc > 1){
- const char *kbuf;
- size_t ksiz;
- int len;
- switch(lua_type(lua, 2)){
- case LUA_TNUMBER:
- case LUA_TSTRING:
- keys = tclistnew2(1);
- kbuf = lua_tolstring(lua, 2, &ksiz);
- tclistpush(keys, kbuf, ksiz);
- break;
- case LUA_TTABLE:
- len = lua_objlen(lua, 2);
- keys = tclistnew2(len);
- for(int i = 1; i <= len; i++){
- lua_rawgeti(lua, 2, i);
- switch(lua_type(lua, -1)){
- case LUA_TNUMBER:
- case LUA_TSTRING:
- kbuf = lua_tolstring(lua, -1, &ksiz);
- tclistpush(keys, kbuf, ksiz);
- break;
- }
- lua_pop(lua, 1);
+ const char *kbuf;
+ size_t ksiz;
+ int len;
+ switch(lua_type(lua, 1)){
+ case LUA_TNUMBER:
+ case LUA_TSTRING:
+ keys = tclistnew2(1);
+ kbuf = lua_tolstring(lua, 1, &ksiz);
+ tclistpush(keys, kbuf, ksiz);
+ break;
+ case LUA_TTABLE:
+ len = lua_objlen(lua, 1);
+ keys = tclistnew2(len);
+ for(int i = 1; i <= len; i++){
+ lua_rawgeti(lua, 1, i);
+ switch(lua_type(lua, -1)){
+ case LUA_TNUMBER:
+ case LUA_TSTRING:
+ kbuf = lua_tolstring(lua, -1, &ksiz);
+ tclistpush(keys, kbuf, ksiz);
+ break;
}
- break;
+ lua_pop(lua, 1);
}
+ break;
}
- if(argc > 2 && lua_isfunction(lua, 3)){
- lua_pushvalue(lua, 3);
- } else {
- lua_pushnil(lua);
- }
+ lua_pushvalue(lua, 2);
lua_setglobal(lua, MRMAPVAR);
- if(argc > 3 && lua_isfunction(lua, 4)){
- lua_pushvalue(lua, 4);
- } else {
- lua_pushnil(lua);
- }
+ lua_pushvalue(lua, 3);
lua_setglobal(lua, MRREDVAR);
bool err = false;
TCBDB *bdb = tcbdbnew();
lua_getglobal(lua, "_tmpdir_");
const char *tmpdir = lua_tostring(lua, -1);
if(!tmpdir) tmpdir = "/tmp";
- char *path = tcsprintf("%s%c%s-%d-%d", tmpdir, MYPATHCHR, "mapbdb", getpid(), id);
+ char *path = tcsprintf("%s%c%s-%d-%u",
+ tmpdir, MYPATHCHR, "mapbdb", getpid(), (unsigned int)(tctime() * 1000));
unlink(path);
if(!tcbdbopen(bdb, path, BDBOWRITER | BDBOCREAT | BDBOTRUNC)) err = true;
unlink(path);
@@ -969,8 +963,8 @@ static int serv_mapreduce(lua_State *lua){
} else if(lua_gettop(lua) < 1 || !lua_toboolean(lua, 1)){
err = true;
}
- lua_settop(lua, 0);
}
+ lua_settop(lua, 0);
lua_getglobal(lua, MRREDVAR);
lua_pushlstring(lua, kbuf, ksiz);
lua_newtable(lua);
View
@@ -419,8 +419,8 @@ bool ttserviskilled(TTSERV *serv);
*************************************************************************************************/
-#define _TT_VERSION "1.1.20"
-#define _TT_LIBVER 304
+#define _TT_VERSION "1.1.21"
+#define _TT_LIBVER 305
#define _TT_PROTVER "0.9"

0 comments on commit 2ff3a29

Please sign in to comment.