- Http://www.statetrace.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Updating History for <<”some_user”>> | |
Users value: [{{<<”email”>>,riak_dt_lwwreg},<<”[email protected]”>>}] | |
Users history before update: [] | |
Updating History for <<”some_user”>> | |
Users value: [{{<<”email”>>,riak_dt_lwwreg},<<”[email protected]”>>}] | |
Users history before update: [{{<<”num_commits”>>,riak_dt_emcntr},1},{{<<”all_emails”>>,riak_dt_orswot},[<<”[email protected]”>>]}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Update Counter | |
increment | |
decrement | |
{increment, 4} | |
{decrement, 9} | |
% Update Set | |
{add, <<"Value">>} | |
{add_all, [<<"Value">>]} | |
{remove, <<"Value">>} | |
{remove_all, <<"Value">>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user = riak_client.bucket_type('app_objects').bucket('users').get("some_user") | |
user.registers['email'].assign("[email protected]") | |
user.store() | |
user.registers['email'].assign("[email protected]") | |
user.store() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(example_hook). | |
-export([postcommit/1]). | |
postcommit(RObj) -> | |
{ok, Client} = riak:local_client(), | |
ThisNode = atom_to_binary(node(), latin1), | |
UserKey = riak_object:key(RObj), | |
% The Users value from a riak_dt_map (Map) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ curl http://localhost:8098/buckets/test/props | |
{"props":{"allow_mult":false,"basic_quorum":false,"big_vclock":50,"chash_keyfun":{"mod":"riak_core_util","fun":"chash_std_keyfun"},"dvv_enabled":false,"dw":"quorum","last_write_wins":false,"linkfun":{"mod":"riak_kv_wm_link_walker","fun":"mapreduce_linkfun"},"n_val":3,"name":"test","notfound_ok":true,"old_vclock":86400,"postcommit":[{"mod":"riak_DNE","fun":"postcommit_send_DNE"}],"pr":0,"precommit":[],"pw":0,"r":"quorum","rw":"quorum","small_vclock":50,"w":"quorum","young_vclock":20}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==> riak_api (get-deps) | |
Pulling riak_pb from {git,"git://github.com/basho/riak_pb.git", | |
{tag,"2.0.0.16"}} | |
Cloning into 'riak_pb'... | |
ERROR: Dependency dir /riak-build/deps/riak_pb failed application validation with reason: | |
{version_mismatch,{"/riak-build/deps/riak_pb/src/riak_pb.app.src", | |
{expected,"2.0.0.16"}, | |
{has,"2.0.0.15-15-gd10c567"}}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings, DeriveGeneric, TypeOperators #-} | |
import qualified Data.Text as T | |
import Database.MongoDB | |
import Control.Monad.Trans (liftIO, MonadIO) | |
import Control.Monad | |
import Control.Monad (forM_) | |
import qualified Data.Bson as B | |
import Data.Bson.Generic |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | Returns the subset of an index whose key when run against the provided | |
-- function returns True. | |
filterByKey :: (Indexable a, Typeable a, Ord a, Typeable k) | |
=> (k -> Bool) -> IxSet a -> IxSet a | |
filterByKey func ixset@(IxSet indexes) = collect indexes | |
where | |
collect [] = [] -- FIXME: should be an error | |
collect (Ix index _:is) = maybe (collect is) f $ cast index | |
where | |
f index'' = insertList (concatMap Set.elems [ val | (key, val) <- (Map.toList index''), (func key)]) empty |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask.ext.security import RoleMixin, UserMixin, MongoEngineUserDatastore, Security | |
from flask.ext.mongoengine import MongoEngine | |
from werkzeug.local import LocalProxy | |
app = Flask(__name__) | |
app.config['MONGODB_SETTINGS'] = dict( | |
db='flask_security_test', | |
host='localhost', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module SnapApp.Processing (sanatizeSourceString) where | |
import GHC | |
import Outputable | |
import HsDecls | |
import Data.List | |
import Data.Maybe | |
import Control.Monad (unless) | |
import Text.Regex.Posix |