Skip to content

Instantly share code, notes, and snippets.

View kellymclaughlin's full-sized avatar
🏠
Working from home

Kelly McLaughlin kellymclaughlin

🏠
Working from home
View GitHub Profile
@kellymclaughlin
kellymclaughlin / gist:1235246
Created September 22, 2011 16:28
Spec split before return type - ident 8 spaces after '('
-spec put(riak_object:bucket(), riak_object:key(), [index_spec()], binary(), state()) ->
{ok, state()} |
{error, term(), state()}.
@kellymclaughlin
kellymclaughlin / ring_examples.erl
Created September 20, 2011 16:50
Examining the Riak ring
%% Get the state for the local node
%% The get_my_ring function really returns the ring
%% plus other state information about the cluster.
{ok, State} = riak_core_ring_manager:get_my_ring().
%% Get number of partitions
riak_core_ring:num_partitions(State).
%% Get the names of custom buckets
riak_core_ring:get_buckets(State).
@kellymclaughlin
kellymclaughlin / be_status.txt
Created September 15, 2011 17:58
backend_status output
11:57:44:riak(1.0) $ ./bin/riak-admin backend_status
Backend status information
-------------------------------------------
VNode: 0
Backend: riak_kv_eleveldb_backend
Status: [{"MANIFEST-000007",
{error,{db_open,"IO error: ./data/leveldb/0/MANIFEST-000007/LOCK: Not a directory"}}},
{"LOG.old",
{error,{db_open,"IO error: ./data/leveldb/0/LOG.old/LOCK: Not a directory"}}},
@kellymclaughlin
kellymclaughlin / async_refactor.md
Created September 7, 2011 18:56
async_refactor.md

Folding

  • General buffer behavior

    • API same as riak_kv_fold_buffer.
    • Allow for expected set of operations without awareness of internal details
    • Then have a fold_buffer or kv_buffer that handles kv tasks such as key listing
    • Handoff buffer can handle dealing properly with accumulating handoff results
      • {Socket, ParentPid, Module, TcpMod, ?ACK_COUNT, Total, Err}
  • No explicit flush fun specification. Flush function is determined

([email protected])1> regs().
** Registered procs on node '[email protected]' **
Name Pid Initial Call Reds Msgs
alarm_handler <0.56.0> gen_event:init_it/6 28 0
application_controlle <0.7.0> erlang:apply/2 7760 0
auth <0.19.0> auth:init/1 43 0
cameron_job_data <0.66.0> cameron_job_data:init/1 26 0
cameron_job_scheduler <0.67.0> cameron_job_scheduler:ini 26 0
cameron_process_catal <0.65.0> cameron_process_catalog:i 43 0
%% @private
list_keys(Sender, Bucket, Filter, Mod, ModState) ->
BufferSize = 100,
BufferFun = fun(Results) ->
riak_core_vnode:reply(Sender, {results, {Bucket, Results}})
end,
Buffer = riak_kv_fold_buffer:new(BufferSize, BufferFun),
case Filter of
none ->
FoldKeysFun =
#! /bin/bash
#
OTPVERUC=$(echo $1 || if=- conv=ucase)
OTPVERLC=$(echo $1 || if=- conv=lcase)
TARBALL=otp_src_$OTPVERUC.tar.gz
HTML=$PWD/otp_doc_html_$OTPVERUC.tar.gz
MAN=$PWD/otp_doc_man_$OTPVERUC.tar.gz
## Build-32-bit OSX
build_32 ()
@kellymclaughlin
kellymclaughlin / 2i_queries.txt
Created July 25, 2011 16:37
2I test queries
# Index some documents...
curl -v -X PUT \
-d 'data1' \
-H "Content-Type: application/json" \
-H "x-riak-index-field1_bin: val1" \
-H "x-riak-index-field2_int: 1001" \
http://127.0.0.1:8098/riak/mybucket/mykey1
curl -v -X PUT \
@kellymclaughlin
kellymclaughlin / az475-bb-summary.png
Created July 13, 2011 17:45
Notes for Andrew on lager review.
az475-bb-summary.png
{"inputs":{
"bucket":"invoices",
"key_filters":[["tokenize", ",", 4],["eq", "key"]]
},
"query":[
{"map":
{
"language":"javascript",
"source": "function(value, key, arg) { return [value.key] }",
"keep": true