未公開的ram file 記憶體檔案

2021-08-30 00:05:56 字數 1148 閱讀 6143

ram_file是erlang未公開的乙個模組, 是在記憶體檔案的乙個實現,erts的內建驅動ram_file_drv提供底層快速的記憶體訪問。它的用途是需要檔案訪問介面的模組如erl_tar之類的可以在記憶體裡面提供高速的檔案訪問服務。 所以ram_file提供file所提供的正常介面以外,還支援以下介面:

%% specialized file operations

-export([get_size/1, get_file/1, set_file/2, get_file_close/1]).

-export([compress/1, uncompress/1, uuencode/1, uudecode/1]).

主要用於zip壓縮.

root@yufeng-desktop:~/otp_src_r13b/lib/stdlib/src# erl

erlang r13b (erts-5.7.1) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]

eshell v5.7.1 (abort with ^g)

1> erl_ddll:loaded_drivers().

2> f(r),=ram_file:open("hello", ).

}3> ram_file:get_size(r).

4> ram_file:get_file(r).

5> ram_file:compress(r).

6> ram_file:get_file(r).

7> ram_file:uncompress(r).

8> ram_file:get_file(r).

9> ram_file:close(r).

okctrl+c o可以看到ram_file的port的資訊:

=port:#port<0.456>

slot: 456

connected: <0.63.0>

links: <0.63.0>

port controls linked-in driver: ram_file_drv

注意ram_file:open的檔名實際上是個資料。

另外如果file:open(***, [ram]) 方式開啟的話,其返回的實際上是ram_file的handle.

PB絕對有用的未公開函式

已知乙個dw中的某列的列名 在字串變數中 以獲得這個列物件的dwo 方法是 dwobject ldwo use,ldwo name ldwo use dw 1.object ldwo name ldwo use.get attribute name false 這樣就可以在用setitem 設定值時...

Win XP六條未公開的秘技

支援137 gb以上大硬碟 id ad top name ad top align left marginwidth 0 marginheight 0 src http adv.pconline.adpuba show?id pc.rjzx.yingyong.wenzhang.hzh.media h...

微軟乙個未公開的BUG

前段時間客戶打 給我,說自從公司office與檔案伺服器公升級後,許可權完全亂套了,開始還以為是客戶未正確設定許可權而造成,今天有空來研究了一下,原來一切都是微軟的錯。問題描述 檔案伺服器配置 windows server 2008 r2,客戶端使用office 2007 office 2010 故...