This file contains 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
use Amnesia | |
defmodule DBA do | |
def install do | |
Amnesia.Schema.create | |
Amnesia.start | |
use IndexTest | |
IndexTest.create(disk: [node]) | |
IndexTest.wait | |
Amnesia.stop |
This file contains 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
use Amnesia | |
require Exquisite | |
defmodule DBA do | |
def install do | |
Amnesia.Schema.create | |
Amnesia.start | |
use IndexTest | |
IndexTest.create(disk: [node]) | |
IndexTest.wait |
This file contains 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
ran this in IEX | |
use Cnt | |
Amnesia.start | |
CntDBA.create_lots | |
Lots.last! | |
Enum.count iex(dsktest@ip-10-40-65-192)6> Cnt.Lots.last! | |
Cnt.Lots[id: 99999, oink: nil] | |
iex(dsktest@ip-10-40-65-192)7> Cnt.Lots.gt(999998) | |
** (MatchError) no match of right hand side value: {:aborted, {:function_clause, [{Amnesia.Table, :select, [Cnt.Lots, nil, [{Cnt.Lots[id: :"$1", oink: :"$2"], [{:>, :"$1", 999998}], [:"$_"]}]], [file: '/home/ec2-user/test/amnesia_test/deps/amnesia/lib/amnesia/table.ex', line: 537]}, {:mnesia_tm, :apply_fun, 3, [file: 'mnesia_tm.erl', line: 830]}, {:mnesia_tm, :execute_transaction, 5, [file: 'mnesia_tm.erl', line: 810]}, {Cnt.Lots, :gt, 1, [file: '/home/ec2-user/test/amnesia_test/lib/continuations.ex', line: 18]}, {:erl_eval, :do_apply, 6, [file: 'erl_eval.erl', line: 569]}, {:elixir, :eval_forms, 3, [file: 'src/elixir.erl', line: 152]}, {IEx.Server, :eval, 4, [file: '/home/ec2-user/elixir/lib/iex/lib/iex/server.ex', line: 112]}, {IEx.Server, :wait_input, 1, [file: '/home/ec2-user/elixir/lib/iex/lib/iex/se |
This file contains 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
use Amnesia | |
require Exquisite | |
defdatabase IndexTest do | |
deftable Unf | |
end | |
defmodule DBA do | |
def install do | |
Amnesia.Schema.create | |
Amnesia.start |
This file contains 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
use Amnesia | |
require Exquisite | |
defdatabase PCnt do | |
@how_many 10000 | |
deftable Lots, [:id, :oink],type: :ordered_set do | |
def run_next(list, nil) do | |
List.flatten list | |
end | |
def run_next(list,selection) do |
This file contains 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
defmodule Processes do | |
def werk(pid,list) do | |
pid <- {:ok,Enum.count list} | |
#exit(:normal) | |
#:timer.sleep(500) | |
#IO.puts("Done #{inspect self}") | |
end | |
def get_msg(pid) do | |
receive do | |
{:ok, value} when is_number(value) -> value |
This file contains 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
[ec2-user@ip-10-40-65-192 paxos_test]$ mix deps.get | |
* Getting gen_paxos [git: "https://github.com/gburd/gen_paxos.git"] | |
Cloning into 'deps/gen_paxos'... | |
remote: Counting objects: 139, done. | |
remote: Compressing objects: 100% (63/63), done. | |
remote: Total 139 (delta 72), reused 138 (delta 71) | |
Receiving objects: 100% (139/139), 151.91 KiB, done. | |
Resolving deltas: 100% (72/72), done. | |
* Getting edown [git: "git://github.com/esl/edown.git"] | |
Cloning into '/home/ec2-user/test/paxos_test/deps/edown'... |
This file contains 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
p = """ | |
<html> | |
<head></head> | |
<body> | |
<div id="menu">Menu</div> | |
<div id="content"> | |
<%= @unf %> | |
<%= @time %> | |
</div> | |
</body> |
This file contains 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
def do_select(s) do | |
Amnesia.transaction do | |
case __MODULE__.select(s) do | |
nil -> [] | |
selector -> selector.values | |
end | |
end | |
end | |
def all(key,operator,value) do | |
case key do |
This file contains 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
defmodule DBT do | |
def get_by_key(module,key,value) do | |
s = Exquisite.match module, | |
where: key == value | |
Amnesia.transaction do | |
case apply(module,:select,[s]) do | |
nil -> [] | |
res -> res.values | |
end | |
end |