On Riak 2.0.7, working correctly:
(riak@xxxxxxxxxx)18> {ok,Dataroot} = application:get_env(bitcask,data_root).
{ok,"/var/lib/riak/bitcask"}
{erl_opts, [debug_info, {parse_transform, lager_transform}]}. | |
{deps, [ | |
{pbkdf2, {git, "git://github.com/marianoguerra/erlang-pbkdf2-no-history", {branch, "master"}}}, | |
{exometer_core, {git, "git://github.com/basho/exometer_core.git", {branch, "th/correct-dependencies"}}}, | |
{riak_core, {git, "git://github.com/basho/riak_core", {branch, "develop"}}} | |
]}. | |
{relx, [{release, { ricor , "0.1.0"}, | |
[ricor, |
(add-to-list 'load-path (file-truename "<PATH>/projmake-mode")) | |
(require 'projmake-mode) | |
(defun projmake-mode-hook () | |
(projmake-mode) | |
(projmake-search-load-project)) | |
(add-hook 'erlang-mode-hook 'projmake-mode-hook) |
ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/deps/*/ebin | |
PROJECT_PLT=$(CURDIR)/.project_plt | |
# ============================================================================= | |
# Verify that the programs we need to run are installed on this system | |
# ============================================================================= | |
ERL = $(shell which erl) | |
ifeq ($(ERL),) |
On Riak 2.0.7, working correctly:
(riak@xxxxxxxxxx)18> {ok,Dataroot} = application:get_env(bitcask,data_root).
{ok,"/var/lib/riak/bitcask"}
###HTTP
Entry point for all object operations: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_kv_wm_object.erl
delete_resource/2 takes RequestData(Request header, ex: vclock) and Context(Record containing: Bucket, Key, Client): https://github.com/basho/riak_kv/blob/1.4.2/src/riak_kv_wm_object.erl#L888
riak_object
and populate the various fields with the headers, metadata supplied by the client.riak_client:put
: https://github.com/basho/riak_kv/blob/1.4.2/src/riak_client.erl#L143handle_common_errors
and it is nice to return human readable errors to client :)The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.
I wanted to read and write to a fifo from a C/C++ app and have an Erlang app communicate over the other end of that fifo. Put simply, Erlang doesn't really support what I was trying to do. You cannot just file:open/2
a fifo, or any special device for that matter, in Erlang and expect it to work. This is documented in Erlang's FAQ.
defmodule GCM.PushCollector do | |
use GenStage | |
# Client | |
def push(pid, push_requests) do | |
GenServer.cast(pid, {:push, push_requests}) | |
end | |
# Server |
defmodule GCM.Pusher do | |
use GenStage | |
# The maximum number of requests Firebase allows at once per XMPP connection | |
@max_demand 100 | |
defstruct [ | |
:producer, | |
:producer_from, | |
:fcm_conn_pid, | |
:pending_requests, |
defimpl String.Chars, for: Map do
import Kernel, except: [to_string: 1]
def to_string(m) when is_map(m) do
#for i <- Map.to_list(m), do: "#{to_string(elem(i,0))} -> #{to_string(elem(i,1))}"
"#{inspect(m)}"
end