aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/doc/src/disk_log.xml13
-rw-r--r--lib/kernel/src/disk_log.erl18
-rw-r--r--lib/kernel/src/disk_log.hrl3
3 files changed, 11 insertions, 23 deletions
diff --git a/lib/kernel/doc/src/disk_log.xml b/lib/kernel/doc/src/disk_log.xml
index 3c9bc7f6e8..aebeacee28 100644
--- a/lib/kernel/doc/src/disk_log.xml
+++ b/lib/kernel/doc/src/disk_log.xml
@@ -109,8 +109,7 @@
These functions log one or more Erlang terms.
By prefixing each of the functions with a <c>b</c> (for "binary"),
we get the corresponding <c>blog()</c> functions for the external format.
- These functions log one or more deep lists of bytes or, alternatively,
- binaries of deep lists of bytes.
+ These functions log one or more chunks of bytes.
For example, to log the string <c>"hello"</c> in ASCII format, you
can use <c>disk_log:blog(Log, "hello")</c>, or
<c>disk_log:blog(Log, list_to_binary("hello"))</c>. The two
@@ -219,9 +218,6 @@
<name name="dlog_head_opt"/>
</datatype>
<datatype>
- <name name="dlog_byte"/>
- </datatype>
- <datatype>
<name name="dlog_mode"/>
</datatype>
<datatype>
@@ -234,9 +230,6 @@
</desc>
</datatype>
<datatype>
- <name name="bytes"/>
- </datatype>
- <datatype>
<name name="invalid_header"/>
</datatype>
<datatype>
@@ -953,7 +946,7 @@
written first on the log file. If the log is a wrap
log, the item <c><anno>Head</anno></c> is written first in each new file.
<c><anno>Head</anno></c> is to be a term if the format is
- <c>internal</c>, otherwise a deep list of bytes (or a binary).
+ <c>internal</c>, otherwise a sequence of bytes.
Defaults to <c>none</c>, which means that
no header is written first on the file.
</p>
@@ -965,7 +958,7 @@
The call <c>M:F(A)</c> is assumed to return <c>{ok, Head}</c>.
The item <c>Head</c> is written first in each file.
<c>Head</c> is to be a term if the format is
- <c>internal</c>, otherwise a deep list of bytes (or a binary).
+ <c>internal</c>, otherwise a sequence of bytes.
</p>
</item>
<tag><c>{mode, <anno>Mode</anno>}</c></tag>
diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl
index 1b28d05691..bc31f1fbbd 100644
--- a/lib/kernel/src/disk_log.erl
+++ b/lib/kernel/src/disk_log.erl
@@ -75,8 +75,6 @@
-opaque continuation() :: #continuation{}.
--type bytes() :: binary() | [byte()].
-
-type file_error() :: term(). % XXX: refine
-type invalid_header() :: term(). % XXX: refine
@@ -131,7 +129,7 @@ log(Log, Term) ->
-spec blog(Log, Bytes) -> ok | {error, Reason :: log_error_rsn()} when
Log :: log(),
- Bytes :: bytes().
+ Bytes :: iodata().
blog(Log, Bytes) ->
req(Log, {blog, ensure_binary(Bytes)}).
@@ -145,7 +143,7 @@ log_terms(Log, Terms) ->
-spec blog_terms(Log, BytesList) ->
ok | {error, Reason :: log_error_rsn()} when
Log :: log(),
- BytesList :: [bytes()].
+ BytesList :: [iodata()].
blog_terms(Log, Bytess) ->
Bs = ensure_binary_list(Bytess),
req(Log, {blog, Bs}).
@@ -167,13 +165,13 @@ alog_terms(Log, Terms) ->
-spec balog(Log, Bytes) -> notify_ret() when
Log :: log(),
- Bytes :: bytes().
+ Bytes :: iodata().
balog(Log, Bytes) ->
notify(Log, {balog, ensure_binary(Bytes)}).
-spec balog_terms(Log, ByteList) -> notify_ret() when
Log :: log(),
- ByteList :: [bytes()].
+ ByteList :: [iodata()].
balog_terms(Log, Bytess) ->
Bs = ensure_binary_list(Bytess),
notify(Log, {balog, Bs}).
@@ -219,7 +217,7 @@ truncate(Log, Head) ->
-spec btruncate(Log, BHead) -> 'ok' | {'error', trunc_error_rsn()} when
Log :: log(),
- BHead :: bytes().
+ BHead :: iodata().
btruncate(Log, Head) ->
req(Log, {truncate, {ok, ensure_binary(Head)}, btruncate, 2}).
@@ -248,7 +246,7 @@ reopen(Log, NewFile, NewHead) ->
-spec breopen(Log, File, BHead) -> 'ok' | {'error', reopen_error_rsn()} when
Log :: log(),
File :: file:filename(),
- BHead :: bytes().
+ BHead :: iodata().
breopen(Log, NewFile, NewHead) ->
req(Log, {reopen, NewFile, {ok, ensure_binary(NewHead)}, breopen, 3}).
@@ -1348,10 +1346,8 @@ make_binary_list([B | Bs]) ->
make_binary_list([]) ->
[].
-ensure_binary(Binary) when is_binary(Binary) ->
- Binary;
ensure_binary(Bytes) ->
- list_to_binary(Bytes).
+ iolist_to_binary(Bytes).
%%-----------------------------------------------------------------
%% Change size of the logs in runtime.
diff --git a/lib/kernel/src/disk_log.hrl b/lib/kernel/src/disk_log.hrl
index 3262d979ee..3cf8a3b3a2 100644
--- a/lib/kernel/src/disk_log.hrl
+++ b/lib/kernel/src/disk_log.hrl
@@ -54,11 +54,10 @@
%% Types -- alphabetically
%%------------------------------------------------------------------------
--type dlog_byte() :: [dlog_byte()] | byte().
-type dlog_format() :: 'external' | 'internal'.
-type dlog_format_type() :: 'halt_ext' | 'halt_int' | 'wrap_ext' | 'wrap_int'.
-type dlog_head() :: 'none' | {'ok', binary()} | mfa().
--type dlog_head_opt() :: none | term() | binary() | [dlog_byte()].
+-type dlog_head_opt() :: none | term() | iodata().
-type log() :: term(). % XXX: refine
-type dlog_mode() :: 'read_only' | 'read_write'.
-type dlog_name() :: atom() | string().