Skip to content

Instantly share code, notes, and snippets.

View moonpolysoft's full-sized avatar

Cliff Moon moonpolysoft

View GitHub Profile
diff --git a/elibs/rate.erl b/elibs/rate.erl
index 5f2d357..dd30e7c 100644
--- a/elibs/rate.erl
+++ b/elibs/rate.erl
@@ -13,6 +13,8 @@
-behaviour(gen_server).
+-define(MAX_POINTS, 300).
+
require 'thin'
module Thin
module Backends
class DualServer < Base
# UNIX domain socket on which the server is listening for connections.
attr_accessor :socket, :host, :port
def initialize(host, port, opts={})
puts "host #{host.inspect} port #{port.inspect} opts #{opts.inspect}"
%% this is necessary because the binlists returned from the port driver driver_outputv
%% come back as a list with a binary as the last element, not a null list. In other words
%% [a|b] rather than [a|[b|[]]]. Thus breaking *everything* that expects a well formed list.
normalize_tarded_binlist(List) ->
normalize_tarded_binlist(List, []).
normalize_tarded_binlist(Bin, Acc) when not is_list(Bin) ->
lists:reverse([Bin|Acc]);
index 3018cf0..094614c 100644
--- a/rlibs/cli/start.rb
+++ b/rlibs/cli/start.rb
@@ -13,7 +13,7 @@ OptionParser.new do |opts|
opts.separator "Specific options:"
opts.on("-c", "--config [CONFIGFILE]", "path to the config file") do |config|
- options[:config] = %Q(-dynomite config "#{config}")
+ options[:config] = %Q(-dynomite config "\\"#{config}\\"")
end
test_membership_server_throughput() ->
{timeout, 500, {?LINE, fun() ->
{ok, _} = membership:start_link(a, [a,b,c,d,e,f]),
{Keys, _} = lib_misc:fast_acc(fun({List, Str}) ->
Mod = lib_misc:succ(Str),
{[Mod|List], Mod}
end, {[], "aaaaaaaa"}, 10000),
Start = lib_misc:now_float(),
lists:foreach(fun(Str) ->
membership:servers_for_key(Str)
diff --git a/elibs/membership.erl b/elibs/membership.erl
index a68d8df..516c7eb 100644
--- a/elibs/membership.erl
+++ b/elibs/membership.erl
@@ -171,13 +171,10 @@ handle_call({nodes_for_partition, Partition}, _From, State) ->
handle_call({servers_for_key, Key}, From, State) ->
Config = configuration:get_config(),
- spawn_link(fun() ->
- Nodes = int_nodes_for_key(Key, State, Config),
test_storage_server_throughput() ->
configuration:start_link(#config{}),
{ok, Pid} = storage_server:start_link(ets_storage, db_key(throughput), through, 0, (2 bsl 31), undefined),
{Keys, _} = lib_misc:fast_acc(fun({List, Str}) ->
Mod = lib_misc:succ(Str),
{[Mod|List], Mod}
end, {[], "aaaaaaaa"}, 10000),
Vector = vector_clock:create(a),
Start = lib_misc:now_float(),
lists:foreach(fun(Key) ->
%%%-------------------------------------------------------------------
%%% File: mediator.erl
%%% @author Cliff Moon <> []
%%% @copyright 2008 Cliff Moon
%%% @doc
%%% N = Replication factor of data.
%%% R = Number of hosts that need to participate in a successful read operation
%%% W = Number of hosts that need to participate in a successful write operation
%%% @end
%%%
%%%-------------------------------------------------------------------
%%% File: mock_fun.erl
%%% @author Cliff Moon <> []
%%% @copyright 2009 Cliff Moon
%%% @doc
%%%
%%% @end
%%%
%%% @since 2009-04-03 by Cliff Moon
%%%-------------------------------------------------------------------
class Object
class Bypass
instance_methods.each do |m|
undef_method m unless m =~ /^__/
end
def initialize(ref)
@ref = ref
end