From 16f96409b9ad2a1451c88b4e0074b57686f02269 Mon Sep 17 00:00:00 2001 From: jsdelfino Date: Mon, 16 Aug 2010 06:15:24 +0000 Subject: Test Postgresql hot standby + replication and integrated Postgresql database in store-cluster sample. Add a front cache component which can be used to wire a cache component and a database component. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@985799 13f79535-47bb-0310-9956-ffa450edef68 --- sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp') diff --git a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp index 5cbbb2feff..3a1df44490 100644 --- a/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp +++ b/sca-cpp/trunk/samples/store-cpp/shopping-cart.cpp @@ -23,8 +23,6 @@ * Shopping cart component implementation. */ -#include -#include #include "string.hpp" #include "function.hpp" #include "list.hpp" @@ -42,27 +40,21 @@ const string cartId("1234"); */ const list getcart(const value& id, const lambda&)> cache) { const value cart = cache(mklist("get", mklist(id))); + cerr << "cart value: " << cart << "\n"; + const failable fcart = cart; + cerr << "cart fvalue: " << fcart << "\n"; + cerr << "cart content: " << content(fcart) << "\n"; + cerr << "cart reason: " << reason(fcart) << "\n"; if (isNil(cart)) return value(list()); return (list)cart; } -/** - * Returns a UUID. - */ -const value uuid() { - apr_uuid_t uuid; - apr_uuid_get(&uuid); - char buf[APR_UUID_FORMATTED_LENGTH]; - apr_uuid_format(buf, &uuid); - return string(buf, APR_UUID_FORMATTED_LENGTH); -} - /** * Post a new item to the cart. Create a new cart if necessary. */ const failable post(unused const list& collection, const value& item, const lambda&)> cache) { - const value id(uuid()); + const value id(mkuuid()); const list newItem(mklist(car(item), id, caddr(item))); const list cart(cons(newItem, getcart(cartId, cache))); cache(mklist("put", mklist(cartId), cart)); -- cgit v1.2.3