erlang r19里面的mnesia_ext
r19据说支持了mnesia_ext,终于可以给那个恶心2gb limit的mnesia换存储引擎了
先下载r19源码,编译
./otp_build all -a ~/dev/erlang/r19
./Install ~/dev/erlang/r19
关于mnesia_ext,r19说是有了,但是怎么做,没有文档,也没有资料,最后在otp的pull request里面找
https://github.com/erlang/otp/pull/858/files
看到create_schema,发现有两个参数了,看来似乎是有了,但是怎么写呢
再次google mnesia_ext,找到下面这个
https://github.com/klarna/mnesia_pg
搜索
grep -nr "mnesia:create_schema" ./
看到
mnesia:create_schema([node()], [{backend_types, [{pg, mnesia_pg}]}]),
然后去mnesia_pg里面看了下,貌似有个
-behaviour(mnesia_backend_type).
那我们直接在r19里面搜索
grep -nr "module(mnesia_backend_type)" ./
ok,找到了
mnesia_backend_type.erl
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1996-2015. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
%% You may obtain a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
%%
%% Unless required by applicable law or agreed to in writing, software
%% distributed under the License is distributed on an "AS IS" BASIS,
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
%% See the License for the specific language governing permissions and
%% limitations under the License.
%%
%% %CopyrightEnd%
%% %%
%% Behaviour definition for mnesia backend types.
%% %%%header_doc_include -module(mnesia_backend_type). -export([behaviour_info/1]). %%%header_doc_include %%%impl_doc_include %% Note that mnesia considers all callbacks mandatory!!
%%
behaviour_info(callbacks) ->
[
{add_aliases, 1}, % (Aliases) -> ok
{check_definition, 4}, % (TypeAlias, Tab, Nodes, Properties) -> ok
{close_table, 2}, % (TypeAlias, Tab) -> ok
{create_table, 3}, % (TypeAlias, Tab, Properties) -> ok
{delete, 3}, % (TypeAlias, Tab, Key) -> true | ok
{delete_table, 2}, % (TypeAlias, Tab) -> ok
{first, 2}, % (TypeAlias, Tab) -> Key::Term | '$end_of_table'
{fixtable, 3}, % (TypeAlias, Tab, Bool) -> ok | true
{last, 2}, % (TypeAlias, Tab) -> Key::Term | '$end_of_table'
{index_is_consistent,3}, % (TypeAlias, IxTag, Bool) -> ok
{init_backend, 0}, % () -> ok
{info, 3}, % (TypeAlias, Tab, Item) -> Term
{insert, 3}, % (TypeAlias, Tab, Object) -> ok
{lookup, 3}, % (TypeAlias, Tab, Key) -> [Objects]
{is_index_consistent,2}, % (TypeAlias, IxTag) -> Bool
{load_table, 4}, % (TypeAlias, Tab, Reason, CsList) -> ok
{match_delete, 3}, % (TypeAlias, Tab, Pattern) -> ok
{next, 3}, % (TypeAlias, Tab, Key) -> Key::Term | '$end_of_table'
{prev, 3}, % (TypeAlias, Tab, Key) -> Key::Term | '$end_of_table'
{receiver_first_message, 4}, % (Sender, FirstMsg, Alias, Tab) -> {Size, State}
{receive_data, 5}, % (Data, Alias, Name, Sender, State) -> {more, State} | {{more, Msg}, State}
{receive_done, 4}, % (Alias, Tab, Sender, State) -> ok
{real_suffixes, 0}, % () -> [FileSuffix]
{remove_aliases, 1}, % (Aliases) -> ok
{repair_continuation, 2}, % (Continuation, MatchSpec) -> Continuation
{select, 1}, % (Continuation) -> {[Match], Continuation'} | '$end_of_table'
{select, 3}, % (TypeAlias, Tab, Pattern) -> {[Match], Continuation'} | '$end_of_table'
{select, 4}, % (TypeAlias, Tab, MatchSpec, Limit) {[Match], Continuation'} | '$end_of_table'
{sender_init, 4}, % (TypeAlias, Tab, LoadReason, Pid) ->
% {standard, Init(), Chunk()} | {Init(), Chunk()}
{semantics, 2}, % (TypeAlias, storage | types | index_fun | index_types) ->
% ram_copies | disc_copies, set | ordered_set | bag, fun(), ordered | bag
{slot, 3}, % (TypeAlias, Tab, Pos) -> '$end_of_table' | Objects | {error, Reason}
{sync_close_table, 2}, % (TypeAlias, Tab) -> ok
{tmp_suffixes, 0}, % () -> [FileSuffix]
{update_counter, 4}, % (TypeAlias, Tab, Counter, Val) -> NewVal
{validate_key, 6}, % (TypeAlias, Tab, RecName, Arity, Type, Key) -> {RecName, Arity, Type}
{validate_record, 6} % (TypeAlias, Tab, RecName, Arity, Type, Obj) -> {RecName, Arity, Type}
]. %%%impl_doc_include %% -type tab() :: atom().
%% -type alias() :: atom().
%% -type rec_name() :: atom().
%% -type type() :: set | bag | ordered_set.
%% -type proplist() :: [{atom(), any()}].
%% -type key() :: any().
%% -type db_object() :: tuple(). %% -type matchspec() :: ets:match_spec().
%% -type limit() :: integer() | infinity. %% -type cont_fun() :: any().
%% -type cont() :: '$end_of_table' | cont_fun(). %% -callback check_definition(alias(), tab(), [node()], proplist()) -> ok.
%% -callback create_table(alias(), tab(), proplist()) -> tab().
%% -callback load_table(alias(), tab(), any()) -> ok.
%% -callback delete_table(alias(), tab()) -> ok.
%% -callback first(alias(), tab()) -> key().
%% -callback last(alias(), tab()) -> key().
%% -callback next(alias(), tab(), key()) -> key().
%% -callback prev(alias(), tab(), key()) -> key().
%% -callback insert(alias(), tab(), db_object()) -> ok.
%% -callback lookup(alias(), tab(), key()) -> [db_object()].
%% -callback delete(alias(), tab(), key()) -> ok.
%% -callback update_counter(alias(), tab(), key(), integer()) -> integer().
%% -callback select(cont()) -> {list(), cont()}.
%% -callback select(alias(), tab(), matchspec()) -> list() | '$end_of_table'.
%% -callback select(alias(), tab(), matchspec(), limit()) -> {list(), cont()}.
%% -callback slot(alias(), tab(), integer()) -> key().
%% -callback validate_key(alias(), tab(), rec_name(), arity(), type(), key()) ->
%% {rec_name(), arity(), type()}.
%% -callback validate_record(alias(),tab(),rec_name(),arity(),type(),db_obj()) ->
%% {rec_name(), arity(), type()}.
%% -callback repair_continuation(cont(), matchspec()) -> cont().
应该就是这些了吧,具体的和后端存储引擎的对接,还是等大牛吧。
erlang r19里面的mnesia_ext的更多相关文章
- Activity往另外一个Activity传值,Fragment获取另外一个Activity里面的值。
在oneActivity中实现跳转到MainActivity //intent 用来跳转另外一个MainActivity,bundle传值到MainActivity Intent Ma ...
- Java基本概念(2)J2EE里面的2是什么意思
J2EE里面的2是什么意思 J2SE,J2SE,J2ME中2的含义要追溯要1998年.1998年Java 1.2版本发布,1999年发布Java 1.2的标准版,企业版,微型版三个版本,为了区分这三个 ...
- 在wex5平台grid里面的gridselect下拉不能显示汉字问题
当grid里面有gridSelect组件的时候,gridSelect里面的bind-ref是对应的数据库存入字段(int类型),bind-labelRef是对应的计算字段(视图里面的),而option ...
- dede文章调用时过滤调 body里面的style属性和值
dede 发布文章的时候会在里面的标签中添加一些style 属性,现在改网站想去掉这些属性和里面的值,因为文章太多所以就用下面的方法 \include\arc.listview.class.php 在 ...
- 提取数据库字段里面的值,并改变+图片懒加载,jquery延迟加载
要求:手机端打开某个页面的详细信息,因为网速或者别的原因,响应太慢,因为图片大的原因,希望先进来,图片在网页运行的情况再慢慢加载(jquer延迟加载) http://www.w3cways.com/1 ...
- JAVA里面的IO流(一)分类2(节点流和处理流及构造方法概要)
IO流根据处理对象的不同分为节点流和处理流. 直接对文件进行处理的流为节点流: 对流进行包装从而实现对文件的优化处理的流为处理流. 节点流类型: 可以看出,节点流主要分这几大类: 文件流 文件流构造方 ...
- 头文件里面的ifndef /define/endif的作用
c,c++里面,头文件里面的ifndef /define/endif的作用 今天和宿舍同学讨论一个小程序,发现有点地方不大懂······ 是关于头文件里面的一些地方: 例如:要编写头文件test.h ...
- 尝试一下sql server2016里面的json功能
前2天下载了一个2016的rc版本来玩一下,首先感觉是~开发者版本免费啦!!撒花!!!另外一个东西,sql server 2016能支持json 的解析和应用啦,虽然我不知道它的性能如何,先来一发测试 ...
- 友盟推送里面的Alias怎么用?可以理解成账号吗?
友盟推送里面的Alias怎么用?可以理解成账号吗? 我们的App有自己的账号体系的,想在每次用户登陆的时候,给用户发一个欢迎消息. 看了一下友盟推送,里面有一个概念叫做Alias(别名),但是官方文档 ...
随机推荐
- mysql-server 的一些记录
为避免 innodb 文件的增大.个人倾向于读立表空间.以 innodb_file_per_table=1 参数调整. 不使用默认数据目录的话,须得将 grp own 都循环设置为mysql. 昨天晚 ...
- css ul li 水平布局问题
可以有俩种方法,暂时只用float:left: 找到每一个li进行水平浮动 #hd_nav li{ border-right: 1px solid rgba(255,255,255,0.2); f ...
- PHP新手入门1——表单
注:本身是Android,Android之前是java.但公司后台PHP特别多.就好奇php后台是怎么通过一个url给我数据的(完全不懂php).于是就学呗.学习系列随笔第一人称是一个Android小 ...
- 横向滚动条展示 css
<div class="shuaixuan" style="overflow:hidden;"> <div style="ov ...
- 推荐一些android开发学习的资料
网址: 1:http://v.youku.com/v_show/id_XMTgwMTQ1MTgw.html 2:http://mars.apkbus.com/ 3:http://wenku.baidu ...
- RViz 实时观测机器人建立导航2D封闭空间地图过程 (SLAM) ----27
原创博客:转载请表明出处:http://www.cnblogs.com/zxouxuewei/ ROS提供了非常强大的图形化模拟环境 RViz,这个 RViz 能做的事情非常多.今天我们学习一下如何使 ...
- 02java语法基础问题总结
S和t引用的不是同一个对象 不是原始数据类型 结论: 枚举类型是引用类型,枚举不属于原始数据类型.它的每一个具体值都引用一个特定的对象. 2. 以下代码的输出结果是什么? int X=100; int ...
- jqueryflot图表x轴坐标过长完美解决方案(转)
近段时间,项目中使用到了flot这个图表工具,在实际使用的过程中,遇到了一个看似很简单的问题:当坐标的刻度如果过长时,会重叠在一起,影响阅读: 看到这个效果后的第一反应就是,能不能让坐标斜着显示啊?去 ...
- ISBN号码
总时间限制: 1000ms 内存限制: 65536kB 描述 每一本正式出版的图书都有一个ISBN号码与之对应,ISBN码包括9位数字.1位识别码和3位分隔符,其规定格式如"x-xxx- ...
- 关押罪犯(2010年NOIP全国联赛提高组)
题目描述 Description S 城现有两座监狱,一共关押着N 名罪犯,编号分别为1~N.他们之间的关系自然也极 不和谐.很多罪犯之间甚至积怨已久,如果客观条件具备则随时可能爆发冲突.我们用&qu ...