aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornork <nork@FreeBSD.org>2010-05-30 12:41:50 +0800
committernork <nork@FreeBSD.org>2010-05-30 12:41:50 +0800
commitdb445f7e1129c7429fcb2c7142ad952d5a961cb5 (patch)
tree88b3822ddc2f8ce7edab3f2b69c9267780313002
parent8c57773704267d2d585cd6b2187db0786945b9e2 (diff)
downloadfreebsd-ports-gnome-db445f7e1129c7429fcb2c7142ad952d5a961cb5.tar.gz
freebsd-ports-gnome-db445f7e1129c7429fcb2c7142ad952d5a961cb5.tar.zst
freebsd-ports-gnome-db445f7e1129c7429fcb2c7142ad952d5a961cb5.zip
Add flare 1.0.9, is distributed, and persistent key-value storage
compatible / memcached, and has more features(as follows): * persistent storage (you can use flare as persistent memcached) * pluggable storage (currently only Tokyo Cabinet is available, though:) * data replication (synchronous or asynchronous) * data partitioning (automatically partitioned according to # of master servers (clients do not have to care about it)) * dynamic reconstruction, and partitioning (you can dynamically (I mean, without any service interruption) add slave servers and partition master servers) * node monitoring and failover (if any server is down, the server is automatically isolated from active servers and another slave server is promoted to master server) * request proxy (you can always get same result regardless of servers you connect to. so you can think flare servers as one big key-value storage) * over 256 bytes keys, and over 1M bytes values are available WWW: http://labs.gree.jp/Top/OpenSource/Flare-en.html
-rw-r--r--databases/Makefile1
-rw-r--r--databases/flare/Makefile47
-rw-r--r--databases/flare/distinfo3
-rw-r--r--databases/flare/files/flared.sh.in52
-rw-r--r--databases/flare/files/flarei.sh.in53
-rw-r--r--databases/flare/files/patch-etc-flared.conf8
-rw-r--r--databases/flare/files/patch-etc-flarei.conf8
-rw-r--r--databases/flare/files/patch-flared-flared.cc21
-rw-r--r--databases/flare/files/patch-flared-ini_option.cc28
-rw-r--r--databases/flare/files/patch-flared-ini_option.h18
-rw-r--r--databases/flare/files/patch-flarei-flarei.cc21
-rw-r--r--databases/flare/files/patch-flarei-ini_option.cc28
-rw-r--r--databases/flare/files/patch-flarei-ini_option.h18
-rw-r--r--databases/flare/files/patch-kqueue-server.cc106
-rw-r--r--databases/flare/files/patch-kqueue-server.h33
-rw-r--r--databases/flare/files/patch-lib-logger.cc74
-rw-r--r--databases/flare/files/patch-lib-server.h13
-rw-r--r--databases/flare/files/pkg-message.in31
-rw-r--r--databases/flare/pkg-descr20
-rw-r--r--databases/flare/pkg-plist10
20 files changed, 593 insertions, 0 deletions
diff --git a/databases/Makefile b/databases/Makefile
index 369ed089575a..20124ff93aec 100644
--- a/databases/Makefile
+++ b/databases/Makefile
@@ -66,6 +66,7 @@
SUBDIR += firebird20-server
SUBDIR += fireprofile
SUBDIR += flamerobin
+ SUBDIR += flare
SUBDIR += fortytwo-bdb
SUBDIR += fpc-gdbm
SUBDIR += fpc-ibase
diff --git a/databases/flare/Makefile b/databases/flare/Makefile
new file mode 100644
index 000000000000..1c8e0b41c77e
--- /dev/null
+++ b/databases/flare/Makefile
@@ -0,0 +1,47 @@
+# New ports collection makefile for: flare
+# Date created: 2010-05-29
+# Whom: Norikatsu Shigemura <nork@FreeBSD.org>
+#
+# $FreeBSD$
+#
+
+PORTNAME= flare
+PORTVERSION= 1.0.9
+CATEGORIES= databases
+MASTER_SITES= http://labs.gree.jp/data/source/
+EXTRACT_SUFX= .tgz
+
+MAINTAINER= nork@FreeBSD.org
+COMMENT= Flare - distributed, and persistent key-value storage
+
+LIB_DEPENDS= boost_program_options.4:${PORTSDIR}/devel/boost-libs \
+ tokyocabinet.9:${PORTSDIR}/databases/tokyocabinet
+
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/COPYING
+
+GNU_CONFIGURE= yes
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include -DHAVE_KQUEUE" LDFLAGS=-L${LOCALBASE}/lib
+
+USE_RC_SUBR= flared.sh flarei.sh
+SUB_FILES= pkg-message
+MAKE_JOBS_SAFE= yes
+
+post-install:
+ @${INSTALL} -d ${_BINOWNGRP} -m 0750 /var/db/flare
+ @${INSTALL_DATA} ${WRKSRC}/etc/flared.conf ${PREFIX}/etc/flared.conf-dist
+ @[ -f ${PREFIX}/etc/flared.conf ] || \
+ ${CP} -p ${PREFIX}/etc/flared.conf-dist ${PREFIX}/etc/flared.conf
+ @${INSTALL_DATA} ${WRKSRC}/etc/flarei.conf ${PREFIX}/etc/flarei.conf-dist
+ @[ -f ${PREFIX}/etc/flarei.conf ] || \
+ ${CP} -p ${PREFIX}/etc/flarei.conf-dist ${PREFIX}/etc/flarei.conf
+ @${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.pre.mk>
+
+# NOT TESTED YET
+#CONFIGURE_ARGS+=--enable-mysql-replication
+#CONFIGURE_ARGS+=--enable-flarefs --with-fuse=${LOCALBASE}
+#CONFIGURE_ARGS+=--enable-memory-allocation-check
+
+.include <bsd.port.post.mk>
diff --git a/databases/flare/distinfo b/databases/flare/distinfo
new file mode 100644
index 000000000000..7521b41f830e
--- /dev/null
+++ b/databases/flare/distinfo
@@ -0,0 +1,3 @@
+MD5 (flare-1.0.9.tgz) = e59ccce1ba29e7edf6f665561678d5c8
+SHA256 (flare-1.0.9.tgz) = 44f39d79e62e6536fce6d850f10f41a0e0e8318a6c831d4497665c736637aa63
+SIZE (flare-1.0.9.tgz) = 363431
diff --git a/databases/flare/files/flared.sh.in b/databases/flare/files/flared.sh.in
new file mode 100644
index 000000000000..f22f0c74e6b3
--- /dev/null
+++ b/databases/flare/files/flared.sh.in
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: flared
+# REQUIRE: LOGIN flarei
+#
+flared_enable=${flared_enable-"NO"}
+flared_config=${flared_conffile-"%%PREFIX%%/etc/flared.conf"}
+flared_pidfile=${flared_pidfile-"/var/run/flared.pid"}
+flared_flags="--daemonize"
+
+. /etc/rc.subr
+
+name=flared
+rcvar=`set_rcvar`
+command=%%PREFIX%%/bin/${name}
+
+load_rc_config ${name}
+
+case "${flared_flags}" in
+*-p\ *)
+ echo "Warning: \$flared_flags includes -p option." \
+ "Please use \$flared_pidfile instead."
+ ;;
+*--pid\ *)
+ echo "Warning: \$flared_flags includes -p option." \
+ "Please use \$flared_pidfile instead."
+ ;;
+*)
+ flared_flags="--pid ${flared_pidfile} ${flared_flags}"
+ ;;
+esac
+
+case "${flared_flags}" in
+*-f\ *)
+ echo "Warning: \$flared_flags includes -f option." \
+ "Please use \$flared_config instead."
+ ;;
+*--config\ *)
+ echo "Warning: \$flared_flags includes --config option." \
+ "Please use \$flared_config instead."
+ ;;
+*)
+ flared_flags="--config ${flared_config} ${flared_flags}"
+ ;;
+esac
+
+pidfile=${flared_pidfile}
+required_files=${flared_conffile}
+
+run_rc_command "$1"
diff --git a/databases/flare/files/flarei.sh.in b/databases/flare/files/flarei.sh.in
new file mode 100644
index 000000000000..a89961e0f48d
--- /dev/null
+++ b/databases/flare/files/flarei.sh.in
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: flarei
+# REQUIRE: LOGIN
+# BEFORE: flared
+#
+flarei_enable=${flarei_enable-"NO"}
+flarei_config=${flarei_conffile-"%%PREFIX%%/etc/flarei.conf"}
+flarei_pidfile=${flarei_pidfile-"/var/run/flarei.pid"}
+flarei_flags="--daemonize"
+
+. /etc/rc.subr
+
+name=flarei
+rcvar=`set_rcvar`
+command=%%PREFIX%%/bin/${name}
+
+load_rc_config ${name}
+
+case "${flarei_flags}" in
+*-p\ *)
+ echo "Warning: \$flarei_flags includes -p option." \
+ "Please use \$flarei_pidfile instead."
+ ;;
+*--pid\ *)
+ echo "Warning: \$flarei_flags includes -p option." \
+ "Please use \$flarei_pidfile instead."
+ ;;
+*)
+ flarei_flags="--pid ${flarei_pidfile} ${flarei_flags}"
+ ;;
+esac
+
+case "${flarei_flags}" in
+*-f\ *)
+ echo "Warning: \$flarei_flags includes -f option." \
+ "Please use \$flarei_config instead."
+ ;;
+*--config\ *)
+ echo "Warning: \$flarei_flags includes --config option." \
+ "Please use \$flarei_config instead."
+ ;;
+*)
+ flarei_flags="--config ${flarei_config} ${flarei_flags}"
+ ;;
+esac
+
+pidfile=${flarei_pidfile}
+required_files=${flarei_conffile}
+
+run_rc_command "$1"
diff --git a/databases/flare/files/patch-etc-flared.conf b/databases/flare/files/patch-etc-flared.conf
new file mode 100644
index 000000000000..3a74feb28dd6
--- /dev/null
+++ b/databases/flare/files/patch-etc-flared.conf
@@ -0,0 +1,8 @@
+--- etc/flared.conf.orig 2009-10-09 19:08:47.000000000 +0900
++++ etc/flared.conf 2010-05-30 02:47:31.463522454 +0900
+@@ -1,4 +1,4 @@
+-data-dir = /tmp
++data-dir = /var/db/flare
+ index-server-name = localhost
+ index-server-port = 12120
+ log-facility = local1
diff --git a/databases/flare/files/patch-etc-flarei.conf b/databases/flare/files/patch-etc-flarei.conf
new file mode 100644
index 000000000000..fba5c7e9475d
--- /dev/null
+++ b/databases/flare/files/patch-etc-flarei.conf
@@ -0,0 +1,8 @@
+--- etc/flarei.conf.orig 2009-10-09 19:08:47.000000000 +0900
++++ etc/flarei.conf 2010-05-30 02:47:45.019663718 +0900
+@@ -1,4 +1,4 @@
+-data-dir = /tmp
++data-dir = /var/db/flare
+ log-facility = local0
+ max-connection = 256
+ monitor-threshold = 3
diff --git a/databases/flare/files/patch-flared-flared.cc b/databases/flare/files/patch-flared-flared.cc
new file mode 100644
index 000000000000..806e18603b27
--- /dev/null
+++ b/databases/flare/files/patch-flared-flared.cc
@@ -0,0 +1,21 @@
+--- src/flared/flared.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flared/flared.cc 2010-05-30 00:39:38.664817940 +0900
+@@ -116,6 +116,7 @@
+ log_notice("application startup in progress...", 0);
+ log_notice(" back_log: %d", ini_option_object().get_back_log());
+ log_notice(" config_path: %s", ini_option_object().get_config_path().c_str());
++ log_notice(" pid_path: %s", ini_option_object().get_pid_path().c_str());
+ log_notice(" daemonize: %s", ini_option_object().is_daemonize() ? "true" : "false");
+ log_notice(" data_dir: %s", ini_option_object().get_data_dir().c_str());
+ log_notice(" index_server_name: %s", ini_option_object().get_index_server_name().c_str());
+@@ -309,7 +310,9 @@
+
+ // {{{ protected methods
+ string flared::_get_pid_path() {
+- return ini_option_object().get_data_dir() + "/" + this->_ident + ".pid";
++ return ini_option_object().get_pid_path().empty() ?
++ ini_option_object().get_data_dir() + "/" + this->_ident + ".pid" :
++ ini_option_object().get_pid_path();
+ };
+ // }}}
+
diff --git a/databases/flare/files/patch-flared-ini_option.cc b/databases/flare/files/patch-flared-ini_option.cc
new file mode 100644
index 000000000000..281785b9386f
--- /dev/null
+++ b/databases/flare/files/patch-flared-ini_option.cc
@@ -0,0 +1,28 @@
+--- src/flared/ini_option.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flared/ini_option.cc 2010-05-30 00:32:09.744274848 +0900
+@@ -23,6 +23,7 @@
+ _argv(NULL),
+ _back_log(default_back_log),
+ _config_path(""),
++ _pid_path(""),
+ _daemonize(false),
+ _data_dir(""),
+ _index_server_name(""),
+@@ -106,6 +107,9 @@
+ if (opt_var_map.count("config")) {
+ this->_config_path = opt_var_map["config"].as<string>();
+ }
++ if (opt_var_map.count("pid")) {
++ this->_pid_path = opt_var_map["pid"].as<string>();
++ }
+
+ // parse config file
+ if (this->_config_path.empty() == false) {
+@@ -362,6 +366,7 @@
+ int ini_option::_setup_cli_option(program_options::options_description& option) {
+ option.add_options()
+ ("config,f", program_options::value<string>(), "path to config file")
++ ("pid,p", program_options::value<string>(), "path to pid file")
+ ("version,v", "display version")
+ ("help,h", "display this help");
+
diff --git a/databases/flare/files/patch-flared-ini_option.h b/databases/flare/files/patch-flared-ini_option.h
new file mode 100644
index 000000000000..6b34030ee613
--- /dev/null
+++ b/databases/flare/files/patch-flared-ini_option.h
@@ -0,0 +1,18 @@
+--- src/flared/ini_option.h.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flared/ini_option.h 2010-05-30 00:33:49.304567301 +0900
+@@ -26,6 +26,7 @@
+
+ int _back_log;
+ string _config_path;
++ string _pid_path;
+ bool _daemonize;
+ string _data_dir;
+ string _index_server_name;
+@@ -84,6 +85,7 @@
+
+ int get_back_log() { return this->_back_log; };
+ string get_config_path() { return this->_config_path; };
++ string get_pid_path() { return this->_pid_path; };
+ bool is_daemonize() { return this->_daemonize; };
+ string get_data_dir() { return this->_data_dir; };
+ string get_index_server_name() { return this->_index_server_name; };
diff --git a/databases/flare/files/patch-flarei-flarei.cc b/databases/flare/files/patch-flarei-flarei.cc
new file mode 100644
index 000000000000..f23772098db6
--- /dev/null
+++ b/databases/flare/files/patch-flarei-flarei.cc
@@ -0,0 +1,21 @@
+--- src/flarei/flarei.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flarei/flarei.cc 2010-05-30 00:46:08.682784235 +0900
+@@ -106,6 +106,7 @@
+
+ log_notice("application startup in progress...", 0);
+ log_notice(" config_path: %s", ini_option_object().get_config_path().c_str());
++ log_notice(" pid_path: %s", ini_option_object().get_pid_path().c_str());
+ log_notice(" daemonize: %s", ini_option_object().is_daemonize() ? "true" : "false");
+ log_notice(" data_dir: %s", ini_option_object().get_data_dir().c_str());
+ log_notice(" max_connection: %d", ini_option_object().get_max_connection());
+@@ -253,7 +254,9 @@
+
+ // {{{ protected methods
+ string flarei::_get_pid_path() {
+- return ini_option_object().get_data_dir() + "/" + this->_ident + ".pid";
++ return ini_option_object().get_pid_path().empty() ?
++ ini_option_object().get_data_dir() + "/" + this->_ident + ".pid" :
++ ini_option_object().get_pid_path();
+ };
+ // }}}
+
diff --git a/databases/flare/files/patch-flarei-ini_option.cc b/databases/flare/files/patch-flarei-ini_option.cc
new file mode 100644
index 000000000000..d844468edca5
--- /dev/null
+++ b/databases/flare/files/patch-flarei-ini_option.cc
@@ -0,0 +1,28 @@
+--- src/flarei/ini_option.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flarei/ini_option.cc 2010-05-30 00:47:23.289629400 +0900
+@@ -22,6 +22,7 @@
+ _argc(0),
+ _argv(NULL),
+ _config_path(""),
++ _pid_path(""),
+ _daemonize(false),
+ _data_dir(""),
+ _log_facility(""),
+@@ -92,6 +93,9 @@
+ if (opt_var_map.count("config")) {
+ this->_config_path = opt_var_map["config"].as<string>();
+ }
++ if (opt_var_map.count("pid")) {
++ this->_pid_path = opt_var_map["pid"].as<string>();
++ }
+
+ // parse config file
+ if (this->_config_path.empty() == false) {
+@@ -293,6 +297,7 @@
+ int ini_option::_setup_cli_option(program_options::options_description& option) {
+ option.add_options()
+ ("config,f", program_options::value<string>(), "path to config file")
++ ("pid,p", program_options::value<string>(), "path to pid file")
+ ("version,v", "display version")
+ ("help,h", "display this help");
+
diff --git a/databases/flare/files/patch-flarei-ini_option.h b/databases/flare/files/patch-flarei-ini_option.h
new file mode 100644
index 000000000000..7f75740a6aba
--- /dev/null
+++ b/databases/flare/files/patch-flarei-ini_option.h
@@ -0,0 +1,18 @@
+--- src/flarei/ini_option.h.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/flarei/ini_option.h 2010-05-30 00:47:47.862009797 +0900
+@@ -25,6 +25,7 @@
+ char** _argv;
+
+ string _config_path;
++ string _pid_path;
+ bool _daemonize;
+ string _data_dir;
+ string _log_facility;
+@@ -61,6 +62,7 @@
+ int set_args(int argc, char** argv) { this->_argc = argc; this->_argv = argv; return 0; };
+
+ string get_config_path() { return this->_config_path; };
++ string get_pid_path() { return this->_pid_path; };
+ bool is_daemonize() { return this->_daemonize; };
+ string get_data_dir() { return this->_data_dir; };
+ string get_log_facility() { return this->_log_facility; };
diff --git a/databases/flare/files/patch-kqueue-server.cc b/databases/flare/files/patch-kqueue-server.cc
new file mode 100644
index 000000000000..699e3fb6e57e
--- /dev/null
+++ b/databases/flare/files/patch-kqueue-server.cc
@@ -0,0 +1,106 @@
+--- src/lib/server.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/lib/server.cc 2010-05-30 06:10:23.363742550 +0900
+@@ -21,6 +21,9 @@
+ #ifdef HAVE_EPOLL
+ _epoll_socket(0),
+ #endif
++#ifdef HAVE_KQUEUE
++ _kqueue_socket(-1),
++#endif
+ _back_log(SOMAXCONN) {
+ }
+
+@@ -55,6 +58,14 @@
+ }
+ #endif
+
++#ifdef HAVE_KQUEUE
++ if (this->_kqueue_socket >= 0) {
++ if (::close(this->_kqueue_socket) < 0) {
++ log_err("close() failed: %s (%d) (sock=kqueue)", util::strerror(errno), errno);
++ }
++ }
++#endif
++
+ for (int i = 0; i < this->_listen_socket_index; i++) {
+ int sock = this->_listen_socket[i];
+
+@@ -139,6 +150,12 @@
+ }
+ #endif
+
++#ifdef HAVE_KQUEUE
++ if (this->_add_kqueue_socket(sock) < 0) {
++ return -1;
++ }
++#endif
++
+ return 0;
+ }
+
+@@ -195,6 +212,12 @@
+ }
+ #endif
+
++#ifdef HAVE_KQUEUE
++ if (this->_add_kqueue_socket(sock) < 0) {
++ return -1;
++ }
++#endif
++
+ return 0;
+ }
+
+@@ -208,6 +231,10 @@
+ const char* poll_type = "epoll_wait"; // just for logging
+ struct epoll_event ev_list[this->max_listen_socket];
+ int n = epoll_wait(this->_epoll_socket, ev_list, this->max_listen_socket, -1);
++#elifdef HAVE_KQUEUE
++ const char* poll_type = "kqueue_wait"; // just for logging
++ struct kevent kev;
++ int n = kevent(this->_kqueue_socket, &kev, 1, NULL, 0, NULL);
+ #else
+ const char* poll_type = "select"; // just for logging
+ fd_set fds;
+@@ -230,6 +257,8 @@
+ #ifdef HAVE_EPOLL
+ for (int i = 0; i < n; i++) {
+ int listen_socket = ev_list[i].data.fd;
++#elifdef HAVE_KQUEUE
++ int listen_socket = kev.ident;
+ #else
+ for (int i = 0; i < this->_listen_socket_index; i++) {
+ if (!FD_ISSET(this->_listen_socket[i], &fds)) {
+@@ -369,6 +398,32 @@
+ return 0;
+ }
+ #endif
++
++#ifdef HAVE_KQUEUE
++/**
++ * add listen socket to kqueue
++ */
++int server::_add_kqueue_socket(int sock) {
++ if (this->_kqueue_socket <= 0) {
++ this->_kqueue_socket = kqueue();
++ if (this->_kqueue_socket < 0) {
++ log_err("kqueue() failed: %s (%s)", util::strerror(errno), errno);
++ return -1;
++ }
++ }
++
++ struct kevent kev;
++ EV_SET(&kev, sock, EVFILT_READ, EV_ADD, 0, 0, NULL);
++ if (kevent(this->_kqueue_socket, &kev, 1, NULL, 0, NULL) < 0 ) {
++ log_err("kevent() failed: %s (%d) (sock=%d)", util::strerror(errno), errno, sock);
++ return -1;
++ } else {
++ log_debug("added listen socket to kevent (kqueue_socket=%d, listen_socket=%d)", this->_kqueue_socket, sock);
++ }
++
++ return 0;
++}
++#endif
+ // }}}
+
+ // {{{ private methods
diff --git a/databases/flare/files/patch-kqueue-server.h b/databases/flare/files/patch-kqueue-server.h
new file mode 100644
index 000000000000..0f41847860c4
--- /dev/null
+++ b/databases/flare/files/patch-kqueue-server.h
@@ -0,0 +1,33 @@
+--- src/lib/server.h.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/lib/server.h 2010-05-30 04:29:46.123851884 +0900
+@@ -19,6 +19,10 @@
+ #include <sys/epoll.h>
+ #endif
+
++#ifdef HAVE_KQUEUE
++#include <sys/event.h>
++#endif
++
+ #include "connection.h"
+
+ namespace gree {
+@@ -40,6 +44,9 @@
+ #ifdef HAVE_EPOLL
+ int _epoll_socket;
+ #endif
++#ifdef HAVE_KQUEUE
++ int _kqueue_socket;
++#endif
+ int _back_log;
+
+ public:
+@@ -59,6 +66,9 @@
+ #ifdef HAVE_EPOLL
+ int _add_epoll_socket(int sock);
+ #endif
++#ifdef HAVE_KQUEUE
++ int _add_kqueue_socket(int sock);
++#endif
+ };
+
+ } // namespace flare
diff --git a/databases/flare/files/patch-lib-logger.cc b/databases/flare/files/patch-lib-logger.cc
new file mode 100644
index 000000000000..cc996dd13519
--- /dev/null
+++ b/databases/flare/files/patch-lib-logger.cc
@@ -0,0 +1,74 @@
+--- src/lib/logger.cc.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/lib/logger.cc 2010-05-29 10:05:44.216154429 +0900
+@@ -69,7 +69,7 @@
+ */
+ void logger::emerg(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][EMG][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][EMG][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -85,7 +85,7 @@
+ */
+ void logger::alert(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][ALT][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][ALT][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -101,7 +101,7 @@
+ */
+ void logger::crit(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][CRT][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][CRT][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -117,7 +117,7 @@
+ */
+ void logger::err(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][ERR][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][ERR][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -133,7 +133,7 @@
+ */
+ void logger::warning(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][WRN][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][WRN][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -149,7 +149,7 @@
+ */
+ void logger::notice(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][NTC][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][NTC][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -165,7 +165,7 @@
+ */
+ void logger::info(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][INF][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][INF][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
+@@ -181,7 +181,7 @@
+ */
+ void logger::debug(const char* file, const int line, const char* func, const char *format, ...) {
+ ostringstream s;
+- s << "[" << (unsigned int)pthread_self() << "][DBG][" << file << ":" << line << "-" << func << "] ";
++ s << "[" << (unsigned long)pthread_self() << "][DBG][" << file << ":" << line << "-" << func << "] ";
+
+ char buf[1024];
+ va_list op;
diff --git a/databases/flare/files/patch-lib-server.h b/databases/flare/files/patch-lib-server.h
new file mode 100644
index 000000000000..9a1496dac61d
--- /dev/null
+++ b/databases/flare/files/patch-lib-server.h
@@ -0,0 +1,13 @@
+--- src/lib/server.h.orig 2009-10-09 19:08:47.000000000 +0900
++++ src/lib/server.h 2010-05-29 10:10:05.713330772 +0900
+@@ -10,9 +10,9 @@
+
+ #include "config.h"
+
++#include <sys/types.h>
+ #include <netinet/tcp.h>
+ #include <sys/un.h>
+-#include <sys/types.h>
+ #include <sys/stat.h>
+
+ #ifdef HAVE_EPOLL
diff --git a/databases/flare/files/pkg-message.in b/databases/flare/files/pkg-message.in
new file mode 100644
index 000000000000..484634a20d4c
--- /dev/null
+++ b/databases/flare/files/pkg-message.in
@@ -0,0 +1,31 @@
+===============================================================================
+
+ * SETUP NOTICE * SETUP NOTICE * SETUP NOTICE *
+
+o Add following lines to /etc/syslog.conf before !* line.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+!flarei
+*.* /var/log/flarei.log
+!flared
+*.* /var/log/flared.log
+!*
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+o Set flarei_enable="YES" and/or flared_enable="YES" to /etc/rc.conf.
+
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+flarei_enable="YES"
+flared_enable="YES"
+- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+o See also configuration files:
+
+%%PREFIX%%/etc/flarei.conf
+%%PREFIX%%/etc/flared.conf
+
+o And see also setup tutorial:
+
+ http://labs.gree.jp/Top/OpenSource/Flare/Document/Tutorial-en.html
+
+===============================================================================
diff --git a/databases/flare/pkg-descr b/databases/flare/pkg-descr
new file mode 100644
index 000000000000..73d93e9ad093
--- /dev/null
+++ b/databases/flare/pkg-descr
@@ -0,0 +1,20 @@
+Flare is distributed, and persistent key-value storage compatible
+w/ memcached, and has more features(as follows):
+
+ * persistent storage (you can use flare as persistent memcached)
+ * pluggable storage (currently only Tokyo Cabinet is available, though:)
+ * data replication (synchronous or asynchronous)
+ * data partitioning (automatically partitioned according to # of master
+ servers (clients do not have to care about it))
+ * dynamic reconstruction, and partitioning (you can dynamically (I mean,
+ without any service interruption) add slave servers and partition
+ master servers)
+ * node monitoring and failover (if any server is down, the server is
+ automatically isolated from active servers and another slave server
+ is promoted to master server)
+ * request proxy (you can always get same result regardless of servers
+ you connect to. so you can think flare servers as one big key-value
+ storage)
+ * over 256 bytes keys, and over 1M bytes values are available
+
+WWW: http://labs.gree.jp/Top/OpenSource/Flare-en.html
diff --git a/databases/flare/pkg-plist b/databases/flare/pkg-plist
new file mode 100644
index 000000000000..944456211be0
--- /dev/null
+++ b/databases/flare/pkg-plist
@@ -0,0 +1,10 @@
+bin/flared
+bin/flarei
+@unexec if cmp -s %D/etc/flared.conf %D/etc/flared.conf-dist; then rm -f %D/etc/flared.conf; fi
+etc/flared.conf-dist
+@exec [ ! -f %B/flared.conf ] && cp %B/%f %B/flared.conf
+@unexec if cmp -s %D/etc/flarei.conf %D/etc/flarei.conf-dist; then rm -f %D/etc/flarei.conf; fi
+etc/flarei.conf-dist
+@exec [ ! -f %B/flarei.conf ] && cp %B/%f %B/flarei.conf
+@unexec rmdir /var/db/flare 2>/dev/null || true
+@exec install -d -o root -g wheel -m 0750 /var/db/flare